Scoped all controllers inside body_trackers
Fixed main menu item highlighting
This commit is contained in:
parent
158685459d
commit
628578cda5
@ -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
|
||||||
|
|
||||||
|
@ -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]
|
||||||
|
@ -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
|
||||||
|
@ -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]
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
Reference in New Issue
Block a user