Rails-ish route
This commit is contained in:
parent
36d8f4e056
commit
4c0592d631
4 changed files with 4 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
|||
module Manager
|
||||
class ProceduresController < Manager::ApplicationController
|
||||
def whitelist
|
||||
procedure = Procedure.find(params[:procedure_id])
|
||||
procedure = Procedure.find(params[:id])
|
||||
procedure.whitelist!
|
||||
redirect_to manager_procedure_path(procedure)
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
%h1.header__heading= content_for(:title)
|
||||
.header__actions
|
||||
- if !procedure.whitelisted?
|
||||
= link_to 'whitelister', manager_procedure_whitelist_path(procedure), method: :post, class: 'button'
|
||||
= link_to 'whitelister', whitelist_manager_procedure_path(procedure), method: :post, class: 'button'
|
||||
|
||||
%dl
|
||||
- page.attributes.each do |attribute|
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Rails.application.routes.draw do
|
||||
namespace :manager do
|
||||
resources :procedures, only: [:index, :show] do
|
||||
post '/whitelist' => 'procedures#whitelist'
|
||||
post 'whitelist', on: :member
|
||||
end
|
||||
|
||||
resources :administrateurs, only: [:index, :show]
|
||||
|
|
|
@ -5,7 +5,7 @@ describe Manager::ProceduresController, type: :controller do
|
|||
|
||||
before do
|
||||
sign_in administration
|
||||
post :whitelist, procedure_id: procedure.id
|
||||
post :whitelist, id: procedure.id
|
||||
procedure.reload
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue