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 class BodyTrackersController < ApplicationController
menu_item :body_trackers
before_action :find_project_by_project_id, only: [:index, :defaults] before_action :find_project_by_project_id, only: [:index, :defaults]
before_action :authorize before_action :authorize

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,35 +1,35 @@
# Plugin's routes # Plugin's routes
# See: http://guides.rubyonrails.org/routing.html # See: http://guides.rubyonrails.org/routing.html
resources :projects do resources :projects, shallow: true do
shallow do resources :body_trackers, only: [:index] do
resources :body_trackers, only: [:index] do collection do
post 'defaults', on: :collection post 'defaults'
end resources :measurements, only: [:index, :create, :destroy] do
resources :measurements, only: [:index, :create, :destroy] do post 'toggle', on: :member
post 'toggle', on: :member
end
resources :ingredients, only: [:index, :create, :destroy] do
post 'toggle', on: :member
collection do
get 'nutrients'
get 'filter'
get 'filter_nutrients'
post 'toggle_nutrient_column'
post 'import'
end end
end resources :ingredients, only: [:index, :create, :destroy] do
resources :sources, only: [:index, :create, :destroy] post 'toggle', on: :member
resources :quantities, only: [:index, :create, :edit, :update, :destroy] do collection do
member do get 'nutrients'
post 'toggle' get 'filter'
post 'move/:direction', to: 'quantities#move', as: :move get 'filter_nutrients'
post 'toggle_nutrient_column'
post 'import'
end
end end
collection do resources :sources, only: [:index, :create, :destroy]
get 'parents' resources :quantities, only: [:index, :create, :edit, :update, :destroy] do
get 'filter' member do
post 'toggle'
post 'move/:direction', to: 'quantities#move', as: :move
end
collection do
get 'parents'
get 'filter'
end
end end
resources :units, only: [:index, :create, :destroy]
end end
resources :units, only: [:index, :create, :destroy]
end end
end end