diff --git a/app/controllers/body_trackers_controller.rb b/app/controllers/body_trackers_controller.rb
index 77f94be..a081878 100644
--- a/app/controllers/body_trackers_controller.rb
+++ b/app/controllers/body_trackers_controller.rb
@@ -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,
diff --git a/app/controllers/units_controller.rb b/app/controllers/units_controller.rb
index e15afc8..7cff925 100644
--- a/app/controllers/units_controller.rb
+++ b/app/controllers/units_controller.rb
@@ -1,5 +1,4 @@
class UnitsController < ApplicationController
-
def create
end
diff --git a/app/views/body_trackers/_sidebar.html.erb b/app/views/body_trackers/_sidebar.html.erb
index 4348eb4..ec1abcd 100644
--- a/app/views/body_trackers/_sidebar.html.erb
+++ b/app/views/body_trackers/_sidebar.html.erb
@@ -1 +1,9 @@
+
<%= t ".heading_body_trackers" %>
+
+ - <%= link_to t(".link_summary"), project_body_trackers_path(@project) %>
+
+
<%= t ".heading_common" %>
+
+ - <%= link_to t(".link_units"), units_project_body_trackers_path(@project) %>
+
diff --git a/app/views/body_trackers/index.html.erb b/app/views/body_trackers/index.html.erb
index 26e8bea..12b2ca1 100644
--- a/app/views/body_trackers/index.html.erb
+++ b/app/views/body_trackers/index.html.erb
@@ -1,5 +1,5 @@
<%= t ".heading" %>
<% content_for :sidebar do %>
- <%= render :partial => 'sidebar' %>
+ <%= render :partial => 'body_trackers/sidebar' %>
<% end %>
diff --git a/app/views/body_trackers/units.html.erb b/app/views/body_trackers/units.html.erb
new file mode 100644
index 0000000..12b2ca1
--- /dev/null
+++ b/app/views/body_trackers/units.html.erb
@@ -0,0 +1,5 @@
+<%= t ".heading" %>
+
+<% content_for :sidebar do %>
+ <%= render :partial => 'body_trackers/sidebar' %>
+<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 702b1b7..ae4cf8c 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -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'
diff --git a/config/routes.rb b/config/routes.rb
index 8fc68ae..9de821b 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -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
diff --git a/init.rb b/init.rb
index 49b9ea4..61967a3 100644
--- a/init.rb
+++ b/init.rb
@@ -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