1
0

Scoped all controllers inside body_trackers

Fixed main menu item highlighting
This commit is contained in:
cryptogopher 2019-11-27 22:43:58 +01:00
parent 158685459d
commit 628578cda5
7 changed files with 38 additions and 26 deletions

View File

@ -1,4 +1,6 @@
class BodyTrackersController < ApplicationController
menu_item :body_trackers
before_action :find_project_by_project_id, only: [:index, :defaults]
before_action :authorize

View File

@ -1,6 +1,8 @@
class IngredientsController < ApplicationController
require 'csv'
menu_item :body_trackers
before_action :init_session_filters
before_action :find_project_by_project_id,
only: [:index, :nutrients, :create, :import, :filter, :filter_nutrients]

View File

@ -1,4 +1,6 @@
class MeasurementsController < ApplicationController
menu_item :body_trackers
before_action :find_project_by_project_id, only: [:index, :create]
before_action :find_measurement, only: [:destroy, :toggle]
before_action :authorize

View File

@ -1,4 +1,6 @@
class QuantitiesController < ApplicationController
menu_item :body_trackers
before_action :init_session_filters
before_action :find_project_by_project_id, only: [:index, :parents, :create, :filter]
before_action :find_quantity, only: [:edit, :update, :destroy, :toggle, :move]

View File

@ -1,4 +1,6 @@
class SourcesController < ApplicationController
menu_item :body_trackers
before_action :find_project_by_project_id, only: [:index, :create]
before_action :find_source, only: [:destroy]
before_action :authorize

View File

@ -1,4 +1,6 @@
class UnitsController < ApplicationController
menu_item :body_trackers
before_action :find_project_by_project_id, only: [:index, :create]
before_action :find_unit, only: [:destroy]
before_action :authorize

View File

@ -1,11 +1,10 @@
# Plugin's routes
# See: http://guides.rubyonrails.org/routing.html
resources :projects do
shallow do
resources :projects, shallow: true do
resources :body_trackers, only: [:index] do
post 'defaults', on: :collection
end
collection do
post 'defaults'
resources :measurements, only: [:index, :create, :destroy] do
post 'toggle', on: :member
end
@ -32,4 +31,5 @@ resources :projects do
end
resources :units, only: [:index, :create, :destroy]
end
end
end