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]
|
before_action :retrieve_procedure, only: [:show, :edit, :delete_logo, :delete_deliberation, :delete_notice]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
if current_administrateur.procedures.count != 0
|
||||||
@procedures = smart_listing_create :procedures,
|
@procedures = smart_listing_create :procedures,
|
||||||
current_administrateur.procedures.publiees.order(published_at: :desc),
|
current_administrateur.procedures.publiees.order(published_at: :desc),
|
||||||
partial: "admin/procedures/list",
|
partial: "admin/procedures/list",
|
||||||
array: true
|
array: true
|
||||||
|
|
||||||
active_class
|
active_class
|
||||||
|
else
|
||||||
|
redirect_to new_from_existing_admin_procedures_path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def archived
|
def archived
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
.row.white-back
|
- if current_administrateur.procedures.brouillons.count == 0
|
||||||
%a#from-scratch{ href: new_admin_procedure_path, class: 'btn-sm btn-primary' }
|
%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
|
Créer une nouvelle démarche de zéro
|
||||||
|
|
||||||
.row.white-back
|
.row.white-back
|
||||||
%h2
|
%h3
|
||||||
Créer une nouvelle démarche à partir d'une démarche existante
|
Créer une nouvelle démarche à partir d'une démarche existante
|
||||||
|
|
||||||
.section.section-label
|
.section.section-label
|
||||||
|
|
|
@ -39,6 +39,10 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'GET #index with sorting and pagination' do
|
describe 'GET #index with sorting and pagination' do
|
||||||
|
before do
|
||||||
|
admin.procedures << create(:procedure)
|
||||||
|
end
|
||||||
|
|
||||||
subject {
|
subject {
|
||||||
get :index, params: {
|
get :index, params: {
|
||||||
'procedures_smart_listing[page]': 1,
|
'procedures_smart_listing[page]': 1,
|
||||||
|
|
|
@ -9,6 +9,7 @@ feature 'Administrator connection' do
|
||||||
let!(:gestionnaire) { create(:gestionnaire, :with_trusted_device, email: email, password: password) }
|
let!(:gestionnaire) { create(:gestionnaire, :with_trusted_device, email: email, password: password) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
admin.procedures << create(:procedure)
|
||||||
visit new_administrateur_session_path
|
visit new_administrateur_session_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,12 +9,11 @@ feature 'As an administrateur I wanna clone a procedure', js: true do
|
||||||
before do
|
before do
|
||||||
Flipflop::FeatureSet.current.test!.switch!(:publish_draft, true)
|
Flipflop::FeatureSet.current.test!.switch!(:publish_draft, true)
|
||||||
login_as administrateur, scope: :administrateur
|
login_as administrateur, scope: :administrateur
|
||||||
visit root_path
|
visit new_from_existing_admin_procedures_path
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'Cloning procedure' do
|
context 'Cloning procedure' do
|
||||||
before 'Create procedure' do
|
before 'Create procedure' do
|
||||||
page.find_by_id('new-procedure').click
|
|
||||||
page.find_by_id('from-scratch').click
|
page.find_by_id('from-scratch').click
|
||||||
fill_in_dummy_procedure_details
|
fill_in_dummy_procedure_details
|
||||||
page.find_by_id('save-procedure').click
|
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) }
|
let(:administrateur) { create(:administrateur) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
administrateur.procedures << create(:procedure)
|
||||||
Flipflop::FeatureSet.current.test!.switch!(:publish_draft, true)
|
Flipflop::FeatureSet.current.test!.switch!(:publish_draft, true)
|
||||||
login_as administrateur, scope: :administrateur
|
login_as administrateur, scope: :administrateur
|
||||||
visit root_path
|
visit root_path
|
||||||
|
|
Loading…
Reference in a new issue