1
0

Introduced plugin layout instead of using Redmine ViewListener render_on

This commit is contained in:
cryptogopher
2020-02-22 22:39:12 +01:00
parent 0f8f74ffec
commit 2d778c831b
13 changed files with 27 additions and 45 deletions

View File

@@ -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

View 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

View File

@@ -1,8 +1,6 @@
class IngredientsController < ApplicationController
class IngredientsController < BodyTrackingPluginController
require 'csv'
menu_item :body_trackers
helper :body_trackers
helper_method :current_view

View File

@@ -1,6 +1,4 @@
class MeasurementsController < ApplicationController
menu_item :body_trackers
class MeasurementsController < BodyTrackingPluginController
helper :body_trackers
before_action :init_session_filters

View File

@@ -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,

View File

@@ -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

View File

@@ -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