Rename :procedure_path -> :path
This commit is contained in:
parent
f1fd1b38ec
commit
725e88a89a
13 changed files with 31 additions and 31 deletions
|
@ -101,7 +101,7 @@ class Admin::ProceduresController < AdminController
|
||||||
end
|
end
|
||||||
|
|
||||||
def publish
|
def publish
|
||||||
path = params[:procedure_path]
|
path = params[:path]
|
||||||
procedure = current_administrateur.procedures.find(params[:procedure_id])
|
procedure = current_administrateur.procedures.find(params[:procedure_id])
|
||||||
|
|
||||||
procedure.path = path
|
procedure.path = path
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Users::DossiersController < UsersController
|
||||||
end
|
end
|
||||||
|
|
||||||
def commencer_test
|
def commencer_test
|
||||||
procedure = Procedure.brouillons.find_by(path: params[:procedure_path])
|
procedure = Procedure.brouillons.find_by(path: params[:path])
|
||||||
|
|
||||||
if procedure.present?
|
if procedure.present?
|
||||||
redirect_to new_users_dossier_path(procedure_id: procedure.id, brouillon: true)
|
redirect_to new_users_dossier_path(procedure_id: procedure.id, brouillon: true)
|
||||||
|
@ -23,7 +23,7 @@ class Users::DossiersController < UsersController
|
||||||
end
|
end
|
||||||
|
|
||||||
def commencer
|
def commencer
|
||||||
procedure = Procedure.publiees.find_by(path: params[:procedure_path])
|
procedure = Procedure.publiees.find_by(path: params[:path])
|
||||||
|
|
||||||
if procedure.present?
|
if procedure.present?
|
||||||
redirect_to new_users_dossier_path(procedure_id: procedure.id)
|
redirect_to new_users_dossier_path(procedure_id: procedure.id)
|
||||||
|
|
|
@ -2,9 +2,9 @@ module ProcedureHelper
|
||||||
def procedure_lien(procedure)
|
def procedure_lien(procedure)
|
||||||
if procedure.path.present?
|
if procedure.path.present?
|
||||||
if procedure.brouillon_avec_lien?
|
if procedure.brouillon_avec_lien?
|
||||||
commencer_test_url(procedure_path: procedure.path)
|
commencer_test_url(path: procedure.path)
|
||||||
else
|
else
|
||||||
commencer_url(procedure_path: procedure.path)
|
commencer_url(path: procedure.path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,9 +21,9 @@ class ProcedureSerializer < ActiveModel::Serializer
|
||||||
def link
|
def link
|
||||||
if object.path.present?
|
if object.path.present?
|
||||||
if object.brouillon_avec_lien?
|
if object.brouillon_avec_lien?
|
||||||
commencer_test_url(procedure_path: object.path)
|
commencer_test_url(path: object.path)
|
||||||
else
|
else
|
||||||
commencer_url(procedure_path: object.path)
|
commencer_url(path: object.path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
%h4 Lien public*
|
%h4 Lien public*
|
||||||
.procedure-lien
|
.procedure-lien
|
||||||
%span.prefix
|
%span.prefix
|
||||||
= commencer_test_url(procedure_path: '')
|
= commencer_test_url(path: '')
|
||||||
= f.text_field :path, value: @path, class: 'form-control', data: { remote: true, debounce: true, url: admin_procedures_available_path, params: { id: @procedure.id }.to_query(:procedure) }
|
= f.text_field :path, value: @path, class: 'form-control', data: { remote: true, debounce: true, url: admin_procedures_available_path, params: { id: @procedure.id }.to_query(:procedure) }
|
||||||
%p.unavailable-path-message.text-warning
|
%p.unavailable-path-message.text-warning
|
||||||
- if !@available
|
- if !@available
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
%br
|
%br
|
||||||
%h4 Lien de la démarche
|
%h4 Lien de la démarche
|
||||||
%p.center
|
%p.center
|
||||||
= commencer_url(procedure_path: '')
|
= commencer_url(path: '')
|
||||||
= text_field_tag('procedure_path', @procedure.path || @procedure.default_path,
|
= text_field_tag(:path, @procedure.path || @procedure.default_path,
|
||||||
id: 'procedure_path',
|
id: 'procedure_path',
|
||||||
placeholder: 'Chemin vers la démarche',
|
placeholder: 'Chemin vers la démarche',
|
||||||
data: { autocomplete: 'path' },
|
data: { autocomplete: 'path' },
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
%br
|
%br
|
||||||
Vous ne pouvez pas l’utiliser car il appartient à un autre administrateur.
|
Vous ne pouvez pas l’utiliser car il appartient à un autre administrateur.
|
||||||
#path_is_invalid.text-danger.center.message
|
#path_is_invalid.text-danger.center.message
|
||||||
= t('activerecord.errors.models.procedure_path.attributes.path.format')
|
= t('activerecord.errors.models.procedure.attributes.path.format')
|
||||||
.modal-footer
|
.modal-footer
|
||||||
= submit_tag procedure_modal_text(@procedure, :submit), class: %w(btn btn btn-success), disabled: :disabled, id: 'publish'
|
= submit_tag procedure_modal_text(@procedure, :submit), class: %w(btn btn btn-success), disabled: :disabled, id: 'publish'
|
||||||
= button_tag "Annuler", class: %w(btn btn btn-default), data: { dismiss: :modal }, id: 'cancel'
|
= button_tag "Annuler", class: %w(btn btn btn-default), data: { dismiss: :modal }, id: 'cancel'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- if field.data.present?
|
- if field.data.present?
|
||||||
= link_to "/commencer/#{field.data}", commencer_url(procedure_path: field.data), target: '_blank'
|
= link_to "/commencer/#{field.data}", commencer_url(path: field.data), target: '_blank'
|
||||||
- else
|
- else
|
||||||
Plus en ligne
|
Plus en ligne
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
%ul.demarche-links
|
%ul.demarche-links
|
||||||
- @previous_demarches_still_active.each do |demarche|
|
- @previous_demarches_still_active.each do |demarche|
|
||||||
%li
|
%li
|
||||||
= link_to(commencer_url(procedure_path: demarche.path), class: "demarche-link") do
|
= link_to(commencer_url(path: demarche.path), class: "demarche-link") do
|
||||||
= demarche.libelle
|
= demarche.libelle
|
||||||
%br
|
%br
|
||||||
.service-name
|
.service-name
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
%ul.demarche-links
|
%ul.demarche-links
|
||||||
- @popular_demarches.each do |demarche|
|
- @popular_demarches.each do |demarche|
|
||||||
%li
|
%li
|
||||||
= link_to(commencer_url(procedure_path: demarche.path), class: "demarche-link") do
|
= link_to(commencer_url(path: demarche.path), class: "demarche-link") do
|
||||||
= demarche.libelle
|
= demarche.libelle
|
||||||
%br
|
%br
|
||||||
.service-name
|
.service-name
|
||||||
|
|
|
@ -129,8 +129,8 @@ Rails.application.routes.draw do
|
||||||
end
|
end
|
||||||
|
|
||||||
namespace :commencer do
|
namespace :commencer do
|
||||||
get '/test/:procedure_path' => '/users/dossiers#commencer_test', as: :test
|
get '/test/:path' => '/users/dossiers#commencer_test', as: :test
|
||||||
get '/:procedure_path' => '/users/dossiers#commencer'
|
get '/:path' => '/users/dossiers#commencer'
|
||||||
end
|
end
|
||||||
|
|
||||||
get "patron" => "root#patron"
|
get "patron" => "root#patron"
|
||||||
|
|
|
@ -359,28 +359,28 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
|
|
||||||
context 'when admin is the owner of the procedure' do
|
context 'when admin is the owner of the procedure' do
|
||||||
before do
|
before do
|
||||||
put :publish, params: { procedure_id: procedure.id, procedure_path: procedure_path }
|
put :publish, params: { procedure_id: procedure.id, path: path }
|
||||||
procedure.reload
|
procedure.reload
|
||||||
procedure2.reload
|
procedure2.reload
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'procedure path does not exist' do
|
context 'procedure path does not exist' do
|
||||||
let(:procedure_path) { 'new_path' }
|
let(:path) { 'new_path' }
|
||||||
|
|
||||||
it 'publish the given procedure' do
|
it 'publish the given procedure' do
|
||||||
expect(procedure.publiee?).to be_truthy
|
expect(procedure.publiee?).to be_truthy
|
||||||
expect(procedure.path).to eq(procedure_path)
|
expect(procedure.path).to eq(path)
|
||||||
expect(response.status).to eq 302
|
expect(response.status).to eq 302
|
||||||
expect(flash[:notice]).to have_content 'Démarche publiée'
|
expect(flash[:notice]).to have_content 'Démarche publiée'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'procedure path exists and is owned by current administrator' do
|
context 'procedure path exists and is owned by current administrator' do
|
||||||
let(:procedure_path) { procedure2.path }
|
let(:path) { procedure2.path }
|
||||||
|
|
||||||
it 'publish the given procedure' do
|
it 'publish the given procedure' do
|
||||||
expect(procedure.publiee?).to be_truthy
|
expect(procedure.publiee?).to be_truthy
|
||||||
expect(procedure.path).to eq(procedure_path)
|
expect(procedure.path).to eq(path)
|
||||||
expect(response.status).to eq 302
|
expect(response.status).to eq 302
|
||||||
expect(flash[:notice]).to have_content 'Démarche publiée'
|
expect(flash[:notice]).to have_content 'Démarche publiée'
|
||||||
end
|
end
|
||||||
|
@ -392,7 +392,7 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'procedure path exists and is not owned by current administrator' do
|
context 'procedure path exists and is not owned by current administrator' do
|
||||||
let(:procedure_path) { procedure3.path }
|
let(:path) { procedure3.path }
|
||||||
|
|
||||||
it 'does not publish the given procedure' do
|
it 'does not publish the given procedure' do
|
||||||
expect(procedure.publiee?).to be_falsey
|
expect(procedure.publiee?).to be_falsey
|
||||||
|
@ -408,7 +408,7 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'procedure path is invalid' do
|
context 'procedure path is invalid' do
|
||||||
let(:procedure_path) { 'Invalid Procedure Path' }
|
let(:path) { 'Invalid Procedure Path' }
|
||||||
|
|
||||||
it 'does not publish the given procedure' do
|
it 'does not publish the given procedure' do
|
||||||
expect(procedure.publiee?).to be_falsey
|
expect(procedure.publiee?).to be_falsey
|
||||||
|
@ -426,7 +426,7 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
sign_out admin
|
sign_out admin
|
||||||
sign_in admin_2
|
sign_in admin_2
|
||||||
|
|
||||||
put :publish, params: { procedure_id: procedure.id, procedure_path: 'fake_path' }
|
put :publish, params: { procedure_id: procedure.id, path: 'fake_path' }
|
||||||
procedure.reload
|
procedure.reload
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -454,7 +454,7 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
|
|
||||||
context 'when owner want to re-enable procedure' do
|
context 'when owner want to re-enable procedure' do
|
||||||
before do
|
before do
|
||||||
put :publish, params: { procedure_id: procedure.id, procedure_path: 'fake_path' }
|
put :publish, params: { procedure_id: procedure.id, path: 'fake_path' }
|
||||||
procedure.reload
|
procedure.reload
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'GET #commencer' do
|
describe 'GET #commencer' do
|
||||||
subject { get :commencer, params: { procedure_path: path } }
|
subject { get :commencer, params: { path: path } }
|
||||||
let(:path) { procedure.path }
|
let(:path) { procedure.path }
|
||||||
|
|
||||||
it { expect(subject.status).to eq 302 }
|
it { expect(subject.status).to eq 302 }
|
||||||
|
@ -83,7 +83,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
Flipflop::FeatureSet.current.test!.switch!(:publish_draft, true)
|
Flipflop::FeatureSet.current.test!.switch!(:publish_draft, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { get :commencer_test, params: { procedure_path: path } }
|
subject { get :commencer_test, params: { path: path } }
|
||||||
let(:procedure) { create(:procedure, :with_path) }
|
let(:procedure) { create(:procedure, :with_path) }
|
||||||
let(:path) { procedure.path }
|
let(:path) { procedure.path }
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ feature 'Creating a new dossier:' do
|
||||||
let(:expected_birthday) { nil }
|
let(:expected_birthday) { nil }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
visit commencer_path(procedure_path: procedure.path)
|
visit commencer_path(path: procedure.path)
|
||||||
fill_in 'individual_nom', with: 'Nom'
|
fill_in 'individual_nom', with: 'Nom'
|
||||||
fill_in 'individual_prenom', with: 'Prenom'
|
fill_in 'individual_prenom', with: 'Prenom'
|
||||||
end
|
end
|
||||||
|
@ -76,7 +76,7 @@ feature 'Creating a new dossier:' do
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'the user can enter the SIRET of its etablissement and create a new draft', vcr: { cassette_name: 'api_adresse_search_paris_3' }, js: true do
|
scenario 'the user can enter the SIRET of its etablissement and create a new draft', vcr: { cassette_name: 'api_adresse_search_paris_3' }, js: true do
|
||||||
visit commencer_path(procedure_path: procedure.path)
|
visit commencer_path(path: procedure.path)
|
||||||
expect(page).to have_current_path(siret_dossier_path(dossier))
|
expect(page).to have_current_path(siret_dossier_path(dossier))
|
||||||
|
|
||||||
fill_in 'Numéro SIRET', with: siret
|
fill_in 'Numéro SIRET', with: siret
|
||||||
|
@ -93,7 +93,7 @@ feature 'Creating a new dossier:' do
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'the user is notified when its SIRET is invalid' do
|
scenario 'the user is notified when its SIRET is invalid' do
|
||||||
visit commencer_path(procedure_path: procedure.path)
|
visit commencer_path(path: procedure.path)
|
||||||
expect(page).to have_current_path(siret_dossier_path(dossier))
|
expect(page).to have_current_path(siret_dossier_path(dossier))
|
||||||
|
|
||||||
fill_in 'Numéro SIRET', with: '0000'
|
fill_in 'Numéro SIRET', with: '0000'
|
||||||
|
|
|
@ -53,7 +53,7 @@ describe 'admin/procedures/show.html.haml', type: :view do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'procedure link is present' do
|
describe 'procedure link is present' do
|
||||||
it { expect(rendered).to have_content(commencer_url(procedure_path: procedure.path)) }
|
it { expect(rendered).to have_content(commencer_url(path: procedure.path)) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue