Added project menu, body_trackers#index and sidebar
This commit is contained in:
parent
3e83693c28
commit
40f39a955c
@ -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
|
||||
|
1
app/views/body_trackers/_sidebar.html.erb
Normal file
1
app/views/body_trackers/_sidebar.html.erb
Normal file
@ -0,0 +1 @@
|
||||
<h3><%= t ".heading_common" %></h3>
|
@ -1 +1,5 @@
|
||||
<h2>BodyTrackersController#index</h2>
|
||||
<h2><%= t ".heading" %></h2>
|
||||
|
||||
<% content_for :sidebar do %>
|
||||
<%= render :partial => 'sidebar' %>
|
||||
<% end %>
|
||||
|
@ -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'
|
||||
|
@ -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
|
||||
|
7
init.rb
7
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
|
||||
|
Reference in New Issue
Block a user