1
0

Added project menu, body_trackers#index and sidebar

This commit is contained in:
cryptogopher 2019-08-09 12:09:18 +02:00
parent 3e83693c28
commit 40f39a955c
6 changed files with 37 additions and 2 deletions

View File

@ -1,5 +1,17 @@
class BodyTrackersController < ApplicationController class BodyTrackersController < ApplicationController
before_action :find_project, only: [:index]
before_action :authorize
def index def index
end 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 end

View File

@ -0,0 +1 @@
<h3><%= t ".heading_common" %></h3>

View File

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

View File

@ -1,3 +1,8 @@
# English strings go here for Rails i18n # English strings go here for Rails i18n
en: en:
# my_label: "My label" body_trackers_menu_caption: 'Body trackers'
body_trackers:
index:
heading: 'Summary'
sidebar:
heading_common: 'Common'

View File

@ -1,2 +1,8 @@
# Plugin's routes # Plugin's routes
# See: http://guides.rubyonrails.org/routing.html # See: http://guides.rubyonrails.org/routing.html
resources :projects do
shallow do
resources :body_trackers, :controller => 'body_trackers', :only => [:index]
end
end

View File

@ -5,4 +5,11 @@ Redmine::Plugin.register :body_tracking do
version '0.1' version '0.1'
url 'https://github.com/cryptogopher/body_tracking' url 'https://github.com/cryptogopher/body_tracking'
author_url 'https://github.com/cryptogopher' 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 end