commit
03bee7cb7a
6 changed files with 23 additions and 10 deletions
|
@ -5,12 +5,16 @@ class Admin::ProceduresController < AdminController
|
|||
before_action :retrieve_procedure, only: [:show, :edit, :delete_logo, :delete_deliberation, :delete_notice]
|
||||
|
||||
def index
|
||||
if current_administrateur.procedures.count != 0
|
||||
@procedures = smart_listing_create :procedures,
|
||||
current_administrateur.procedures.publiees.order(published_at: :desc),
|
||||
partial: "admin/procedures/list",
|
||||
array: true
|
||||
|
||||
active_class
|
||||
else
|
||||
redirect_to new_from_existing_admin_procedures_path
|
||||
end
|
||||
end
|
||||
|
||||
def archived
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
.row.white-back
|
||||
%a#from-scratch{ href: new_admin_procedure_path, class: 'btn-sm btn-primary' }
|
||||
- if current_administrateur.procedures.brouillons.count == 0
|
||||
%h4{ style: 'padding: 20px; margin: 20px !important;' }
|
||||
Bienvenue, vous allez pouvoir créer une première démarche de test. Celle-ci sera visible uniquement par vous et ne sera publiée nulle part, alors pas de crainte à avoir.
|
||||
|
||||
.row{ style: 'padding: 20px; margin: 20px !important;' }
|
||||
%a#from-scratch{ href: new_admin_procedure_path, class: 'btn-lg btn-primary' }
|
||||
Créer une nouvelle démarche de zéro
|
||||
|
||||
.row.white-back
|
||||
%h2
|
||||
%h3
|
||||
Créer une nouvelle démarche à partir d'une démarche existante
|
||||
|
||||
.section.section-label
|
||||
|
|
|
@ -39,6 +39,10 @@ describe Admin::ProceduresController, type: :controller do
|
|||
end
|
||||
|
||||
describe 'GET #index with sorting and pagination' do
|
||||
before do
|
||||
admin.procedures << create(:procedure)
|
||||
end
|
||||
|
||||
subject {
|
||||
get :index, params: {
|
||||
'procedures_smart_listing[page]': 1,
|
||||
|
|
|
@ -9,6 +9,7 @@ feature 'Administrator connection' do
|
|||
let!(:gestionnaire) { create(:gestionnaire, :with_trusted_device, email: email, password: password) }
|
||||
|
||||
before do
|
||||
admin.procedures << create(:procedure)
|
||||
visit new_administrateur_session_path
|
||||
end
|
||||
|
||||
|
|
|
@ -9,12 +9,11 @@ feature 'As an administrateur I wanna clone a procedure', js: true do
|
|||
before do
|
||||
Flipflop::FeatureSet.current.test!.switch!(:publish_draft, true)
|
||||
login_as administrateur, scope: :administrateur
|
||||
visit root_path
|
||||
visit new_from_existing_admin_procedures_path
|
||||
end
|
||||
|
||||
context 'Cloning procedure' do
|
||||
before 'Create procedure' do
|
||||
page.find_by_id('new-procedure').click
|
||||
page.find_by_id('from-scratch').click
|
||||
fill_in_dummy_procedure_details
|
||||
page.find_by_id('save-procedure').click
|
||||
|
|
|
@ -7,6 +7,7 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
|
|||
let(:administrateur) { create(:administrateur) }
|
||||
|
||||
before do
|
||||
administrateur.procedures << create(:procedure)
|
||||
Flipflop::FeatureSet.current.test!.switch!(:publish_draft, true)
|
||||
login_as administrateur, scope: :administrateur
|
||||
visit root_path
|
||||
|
|
Loading…
Reference in a new issue