1
0

Added units view and sidebar link

This commit is contained in:
cryptogopher 2019-08-09 12:43:28 +02:00
parent 40f39a955c
commit 2cd9900cea
8 changed files with 30 additions and 6 deletions

View File

@ -1,10 +1,13 @@
class BodyTrackersController < ApplicationController
before_action :find_project, only: [:index]
before_action :find_project, only: [:index, :units]
before_action :authorize
def index
end
def units
end
private
# :find_* methods are called before :authorize,

View File

@ -1,5 +1,4 @@
class UnitsController < ApplicationController
def create
end

View File

@ -1 +1,9 @@
<h3><%= t ".heading_body_trackers" %></h3>
<ul>
<li><%= link_to t(".link_summary"), project_body_trackers_path(@project) %></li>
</ul>
<h3><%= t ".heading_common" %></h3>
<ul>
<li><%= link_to t(".link_units"), units_project_body_trackers_path(@project) %></li>
</ul>

View File

@ -1,5 +1,5 @@
<h2><%= t ".heading" %></h2>
<% content_for :sidebar do %>
<%= render :partial => 'sidebar' %>
<%= render :partial => 'body_trackers/sidebar' %>
<% end %>

View File

@ -0,0 +1,5 @@
<h2><%= t ".heading" %></h2>
<% content_for :sidebar do %>
<%= render :partial => 'body_trackers/sidebar' %>
<% end %>

View File

@ -5,4 +5,9 @@ en:
index:
heading: 'Summary'
sidebar:
heading_body_trackers: 'Body trackers'
heading_common: 'Common'
link_summary: 'Summary'
link_units: 'Units'
units:
heading: 'Units'

View File

@ -3,6 +3,10 @@
resources :projects do
shallow do
resources :body_trackers, :controller => 'body_trackers', :only => [:index]
resources :body_trackers, :controller => 'body_trackers', :only => [:index] do
collection do
get 'units'
end
end
end
end

View File

@ -7,9 +7,9 @@ Redmine::Plugin.register :body_tracking do
author_url 'https://github.com/cryptogopher'
project_module :body_tracking do
permission :view_body_trackers, {:body_trackers => [:index]}, read: true
permission :view_body_trackers, {:body_trackers => [:index, :units]}, read: true
end
menu :project_menu, :body_trackers, {:controller => 'body_trackers', :action => 'index'},
:caption => :body_trackers_menu_caption, :last => :true, :param => :project_id
:caption => :body_trackers_menu_caption, :before => :settings, :param => :project_id
end