Merge pull request #1212 from betagouv/improve_whitelisting
Improve whitelisting
This commit is contained in:
commit
bcf3246e89
5 changed files with 7 additions and 4 deletions
|
@ -1,8 +1,9 @@
|
||||||
module Manager
|
module Manager
|
||||||
class ProceduresController < Manager::ApplicationController
|
class ProceduresController < Manager::ApplicationController
|
||||||
def whitelist
|
def whitelist
|
||||||
procedure = Procedure.find(params[:procedure_id])
|
procedure = Procedure.find(params[:id])
|
||||||
procedure.whitelist!
|
procedure.whitelist!
|
||||||
|
flash[:notice] = "Procédure whitelistée."
|
||||||
redirect_to manager_procedure_path(procedure)
|
redirect_to manager_procedure_path(procedure)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,6 +26,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
|
||||||
published_at: Field::DateTime,
|
published_at: Field::DateTime,
|
||||||
hidden_at: Field::DateTime,
|
hidden_at: Field::DateTime,
|
||||||
archived_at: Field::DateTime,
|
archived_at: Field::DateTime,
|
||||||
|
whitelisted_at: Field::DateTime,
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
# COLLECTION_ATTRIBUTES
|
# COLLECTION_ATTRIBUTES
|
||||||
|
@ -54,6 +55,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
|
||||||
:created_at,
|
:created_at,
|
||||||
:updated_at,
|
:updated_at,
|
||||||
:published_at,
|
:published_at,
|
||||||
|
:whitelisted_at,
|
||||||
:hidden_at,
|
:hidden_at,
|
||||||
:archived_at,
|
:archived_at,
|
||||||
:types_de_champ,
|
:types_de_champ,
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
%h1.header__heading= content_for(:title)
|
%h1.header__heading= content_for(:title)
|
||||||
.header__actions
|
.header__actions
|
||||||
- if !procedure.whitelisted?
|
- 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
|
%dl
|
||||||
- page.attributes.each do |attribute|
|
- page.attributes.each do |attribute|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
namespace :manager do
|
namespace :manager do
|
||||||
resources :procedures, only: [:index, :show] do
|
resources :procedures, only: [:index, :show] do
|
||||||
post '/whitelist' => 'procedures#whitelist'
|
post 'whitelist', on: :member
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :administrateurs, only: [:index, :show]
|
resources :administrateurs, only: [:index, :show]
|
||||||
|
|
|
@ -5,7 +5,7 @@ describe Manager::ProceduresController, type: :controller do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
sign_in administration
|
sign_in administration
|
||||||
post :whitelist, procedure_id: procedure.id
|
post :whitelist, id: procedure.id
|
||||||
procedure.reload
|
procedure.reload
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue