Introduced plugin layout instead of using Redmine ViewListener render_on
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
class BodyTrackersController < ApplicationController
|
||||
menu_item :body_trackers
|
||||
|
||||
class BodyTrackersController < BodyTrackingPluginController
|
||||
before_action :find_project_by_project_id, only: [:index, :defaults]
|
||||
before_action :authorize
|
||||
|
||||
|
||||
17
app/controllers/body_tracking_plugin_controller.rb
Normal file
17
app/controllers/body_tracking_plugin_controller.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
class BodyTrackingPluginController < ApplicationController
|
||||
menu_item :body_trackers
|
||||
layout 'body_tracking'
|
||||
|
||||
private
|
||||
|
||||
def find_quantity(id = :id)
|
||||
@quantity = Quantity.find(params[id])
|
||||
@project = @quantity.project
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
def find_quantity_by_quantity_id
|
||||
find_quantity(:quantity_id)
|
||||
end
|
||||
end
|
||||
@@ -1,8 +1,6 @@
|
||||
class IngredientsController < ApplicationController
|
||||
class IngredientsController < BodyTrackingPluginController
|
||||
require 'csv'
|
||||
|
||||
menu_item :body_trackers
|
||||
|
||||
helper :body_trackers
|
||||
helper_method :current_view
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
class MeasurementsController < ApplicationController
|
||||
menu_item :body_trackers
|
||||
|
||||
class MeasurementsController < BodyTrackingPluginController
|
||||
helper :body_trackers
|
||||
|
||||
before_action :init_session_filters
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
class QuantitiesController < ApplicationController
|
||||
menu_item :body_trackers
|
||||
|
||||
class QuantitiesController < BodyTrackingPluginController
|
||||
before_action :init_session_filters
|
||||
before_action :find_project_by_project_id, only: [:index, :new, :create, :filter, :parents]
|
||||
before_action :find_quantity, only: [:edit, :update, :destroy, :move,
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
class SourcesController < ApplicationController
|
||||
menu_item :body_trackers
|
||||
|
||||
class SourcesController < BodyTrackingPluginController
|
||||
before_action :find_project_by_project_id, only: [:index, :create]
|
||||
before_action :find_source, only: [:destroy]
|
||||
before_action :authorize
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
class UnitsController < ApplicationController
|
||||
menu_item :body_trackers
|
||||
|
||||
class UnitsController < BodyTrackingPluginController
|
||||
before_action :find_project_by_project_id, only: [:index, :create]
|
||||
before_action :find_unit, only: [:destroy]
|
||||
before_action :authorize
|
||||
|
||||
@@ -3,5 +3,7 @@
|
||||
<% end %>
|
||||
|
||||
<% content_for :sidebar do %>
|
||||
<%= render partial: 'body_trackers/sidebar' %>
|
||||
<%= render partial: 'layouts/sidebar' %>
|
||||
<% end %>
|
||||
|
||||
<%= render :file => "layouts/base" %>
|
||||
Reference in New Issue
Block a user