diff --git a/app/controllers/body_trackers_controller.rb b/app/controllers/body_trackers_controller.rb
index 08939fb..77f94be 100644
--- a/app/controllers/body_trackers_controller.rb
+++ b/app/controllers/body_trackers_controller.rb
@@ -1,5 +1,17 @@
class BodyTrackersController < ApplicationController
+ before_action :find_project, only: [:index]
+ before_action :authorize
def index
end
+
+ private
+
+ # :find_* methods are called before :authorize,
+ # @project is required for :authorize to succeed
+ def find_project
+ @project = Project.find(params[:project_id])
+ rescue ActiveRecord::RecordNotFound
+ render_404
+ end
end
diff --git a/app/views/body_trackers/_sidebar.html.erb b/app/views/body_trackers/_sidebar.html.erb
new file mode 100644
index 0000000..4348eb4
--- /dev/null
+++ b/app/views/body_trackers/_sidebar.html.erb
@@ -0,0 +1 @@
+
<%= t ".heading_common" %>
diff --git a/app/views/body_trackers/index.html.erb b/app/views/body_trackers/index.html.erb
index 7c44427..26e8bea 100644
--- a/app/views/body_trackers/index.html.erb
+++ b/app/views/body_trackers/index.html.erb
@@ -1 +1,5 @@
-BodyTrackersController#index
+<%= t ".heading" %>
+
+<% content_for :sidebar do %>
+ <%= render :partial => 'sidebar' %>
+<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 642b07f..702b1b7 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1,3 +1,8 @@
# English strings go here for Rails i18n
en:
- # my_label: "My label"
+ body_trackers_menu_caption: 'Body trackers'
+ body_trackers:
+ index:
+ heading: 'Summary'
+ sidebar:
+ heading_common: 'Common'
diff --git a/config/routes.rb b/config/routes.rb
index 1803173..8fc68ae 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,2 +1,8 @@
# Plugin's routes
# See: http://guides.rubyonrails.org/routing.html
+
+resources :projects do
+ shallow do
+ resources :body_trackers, :controller => 'body_trackers', :only => [:index]
+ end
+end
diff --git a/init.rb b/init.rb
index 512a6c8..49b9ea4 100644
--- a/init.rb
+++ b/init.rb
@@ -5,4 +5,11 @@ Redmine::Plugin.register :body_tracking do
version '0.1'
url 'https://github.com/cryptogopher/body_tracking'
author_url 'https://github.com/cryptogopher'
+
+ project_module :body_tracking do
+ permission :view_body_trackers, {:body_trackers => [:index]}, read: true
+ end
+
+ menu :project_menu, :body_trackers, {:controller => 'body_trackers', :action => 'index'},
+ :caption => :body_trackers_menu_caption, :last => :true, :param => :project_id
end