Publications page to the new UI (admin)
This commit is contained in:
parent
d755a23dd9
commit
13e4589905
32 changed files with 440 additions and 714 deletions
|
@ -25,6 +25,10 @@
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.justify-end {
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
&.wrap {
|
&.wrap {
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.mb-4 {
|
.mb-4 {
|
||||||
margin-bottom: 4 * $default-spacer;
|
margin-bottom: 4 * $default-spacer !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ml-1 {
|
.ml-1 {
|
||||||
|
@ -20,6 +20,10 @@
|
||||||
padding-left: 0px !important;
|
padding-left: 0px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bold {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
.numbers-delimiter {
|
.numbers-delimiter {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 5px;
|
width: 5px;
|
||||||
|
|
|
@ -62,40 +62,6 @@ class Admin::ProceduresController < AdminController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def publish_validate
|
|
||||||
@procedure.assign_attributes(publish_params)
|
|
||||||
end
|
|
||||||
|
|
||||||
def publish
|
|
||||||
@procedure.assign_attributes(publish_params)
|
|
||||||
|
|
||||||
@procedure.publish_or_reopen!(current_administrateur)
|
|
||||||
|
|
||||||
flash.notice = "Démarche publiée"
|
|
||||||
render js: "window.location='#{admin_procedures_path}'"
|
|
||||||
rescue ActiveRecord::RecordInvalid
|
|
||||||
respond_to do |format|
|
|
||||||
format.js { render :publish_validate }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def transfer
|
|
||||||
admin = Administrateur.by_email(params[:email_admin].downcase)
|
|
||||||
|
|
||||||
if admin.nil?
|
|
||||||
respond_to do |format|
|
|
||||||
format.js { render :transfer, status: :not_found }
|
|
||||||
end
|
|
||||||
else
|
|
||||||
procedure = current_administrateur.procedures.find(params[:procedure_id])
|
|
||||||
procedure.clone(admin, false)
|
|
||||||
|
|
||||||
flash.now.notice = "La démarche a correctement été clonée vers le nouvel administrateur."
|
|
||||||
|
|
||||||
respond_to(&:js)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def archive
|
def archive
|
||||||
procedure = current_administrateur.procedures.find(params[:procedure_id])
|
procedure = current_administrateur.procedures.find(params[:procedure_id])
|
||||||
procedure.close!
|
procedure.close!
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module NewAdministrateur
|
module NewAdministrateur
|
||||||
class ProceduresController < AdministrateurController
|
class ProceduresController < AdministrateurController
|
||||||
before_action :retrieve_procedure, only: [:champs, :annotations, :edit, :monavis, :update_monavis, :jeton, :update_jeton]
|
before_action :retrieve_procedure, only: [:champs, :annotations, :edit, :monavis, :update_monavis, :jeton, :update_jeton, :publication, :publish]
|
||||||
before_action :procedure_locked?, only: [:champs, :annotations]
|
before_action :procedure_locked?, only: [:champs, :annotations]
|
||||||
|
|
||||||
ITEMS_PER_PAGE = 25
|
ITEMS_PER_PAGE = 25
|
||||||
|
@ -132,6 +132,41 @@ module NewAdministrateur
|
||||||
render 'jeton'
|
render 'jeton'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def publication
|
||||||
|
if @procedure.brouillon?
|
||||||
|
@procedure_lien = commencer_test_url(path: @procedure.path)
|
||||||
|
else
|
||||||
|
@procedure_lien = commencer_url(path: @procedure.path)
|
||||||
|
end
|
||||||
|
@procedure.path = @procedure.suggested_path(current_administrateur)
|
||||||
|
@current_administrateur = current_administrateur
|
||||||
|
end
|
||||||
|
|
||||||
|
def publish
|
||||||
|
@procedure.assign_attributes(publish_params)
|
||||||
|
|
||||||
|
if @procedure.publish_or_reopen!(current_administrateur)
|
||||||
|
redirect_to admin_procedure_path(@procedure)
|
||||||
|
flash.notice = "Démarche publiée"
|
||||||
|
else
|
||||||
|
redirect_to admin_procedure_path(@procedure)
|
||||||
|
flash.alert = @procedure.errors.full_messages
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def transfer
|
||||||
|
admin = Administrateur.by_email(params[:email_admin].downcase)
|
||||||
|
if admin.nil?
|
||||||
|
redirect_to admin_procedure_publication_path(params[:procedure_id])
|
||||||
|
flash.alert = "Envoi vers #{params[:email_admin]} impossible : cet administrateur n'existe pas"
|
||||||
|
else
|
||||||
|
procedure = current_administrateur.procedures.find(params[:procedure_id])
|
||||||
|
procedure.clone(admin, false)
|
||||||
|
redirect_to admin_procedure_path(params[:procedure_id])
|
||||||
|
flash.notice = "La démarche a correctement été clonée vers le nouvel administrateur."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def apercu_tab
|
def apercu_tab
|
||||||
|
@ -154,5 +189,9 @@ module NewAdministrateur
|
||||||
end
|
end
|
||||||
permited_params
|
permited_params
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def publish_params
|
||||||
|
params.permit(:path, :lien_site_web)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,7 +13,7 @@ module ProcedureHelper
|
||||||
safe_join(parts, ' ')
|
safe_join(parts, ' ')
|
||||||
end
|
end
|
||||||
|
|
||||||
def procedure_modal_text(procedure, key)
|
def procedure_publish_text(procedure, key)
|
||||||
action = procedure.close? ? :reopen : :publish
|
action = procedure.close? ? :reopen : :publish
|
||||||
t(action, scope: [:modal, :publish, key])
|
t(action, scope: [:modal, :publish, key])
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
- if smart_listing.present?
|
|
||||||
%table.table#dossiers-list
|
|
||||||
%thead
|
|
||||||
%th#ID= smart_listing.sortable 'ID', 'id'
|
|
||||||
%th#libelle= smart_listing.sortable 'Libellé', 'libelle'
|
|
||||||
- if @active_class
|
|
||||||
%th Lien
|
|
||||||
- if @active_class || @archived_class
|
|
||||||
%th#published_at= smart_listing.sortable 'Date publication', 'published_at'
|
|
||||||
- else
|
|
||||||
%th#created_at= smart_listing.sortable 'Date création', 'created_at'
|
|
||||||
%th Actions
|
|
||||||
|
|
||||||
- @procedures.each do |procedure|
|
|
||||||
- procedure = procedure
|
|
||||||
- admin_procedure_href = admin_procedure_path(procedure)
|
|
||||||
%tr{ id: "tr_dossier_#{procedure.id}", data: { href: admin_procedure_href } }
|
|
||||||
%td= link_to(procedure.id, admin_procedure_href)
|
|
||||||
%td.col-xs-6= link_to(procedure.libelle, admin_procedure_href)
|
|
||||||
- if procedure.publiee?
|
|
||||||
%td.procedure-lien= link_to(procedure_lien(procedure), procedure_lien(procedure))
|
|
||||||
- if procedure.locked?
|
|
||||||
%td= link_to(procedure.published_at.present? ? try_format_datetime(procedure.published_at) : "", admin_procedure_href)
|
|
||||||
- else
|
|
||||||
%td= link_to(try_format_datetime(procedure.created_at), admin_procedure_href)
|
|
||||||
%td
|
|
||||||
= link_to('Cloner', admin_procedure_clone_path(procedure.id), data: { method: :put }, class: 'btn-sm btn-primary clone-btn')
|
|
||||||
- if procedure.can_be_deleted_by_administrateur?
|
|
||||||
= link_to('X', url_for(controller: 'admin/procedures', action: :destroy, id: procedure.id), data: { method: :delete, confirm: "Confirmez-vous la suppression de la démarche ? \n\n Attention : toute suppression est définitive et s’appliquera aux éventuels autres administrateurs de cette démarche !" }, class: 'btn-sm btn-danger')
|
|
||||||
|
|
||||||
= smart_listing.paginate
|
|
||||||
= smart_listing.pagination_per_page_links
|
|
||||||
%br
|
|
||||||
|
|
||||||
|
|
||||||
- else
|
|
||||||
%h4.center
|
|
||||||
Aucune démarche
|
|
|
@ -1,49 +0,0 @@
|
||||||
#publish-modal.modal{ "aria-labelledby" => "myModalLabel", :role => "dialog", :tabindex => "-1" }
|
|
||||||
.modal-dialog.modal-lg{ :role => "document" }
|
|
||||||
= form_tag admin_procedure_publish_path(procedure_id: procedure.id), method: :put, remote: true do
|
|
||||||
.modal-content
|
|
||||||
.modal-header
|
|
||||||
%button.close{ "aria-label" => "Close", "data-dismiss" => "modal", :type => "button" }
|
|
||||||
%span{ "aria-hidden" => "true" } ×
|
|
||||||
%h4#myModalLabel.modal-title
|
|
||||||
= procedure_modal_text(procedure, :title)
|
|
||||||
%span#publish-modal-title
|
|
||||||
.modal-body
|
|
||||||
.text-info
|
|
||||||
%p
|
|
||||||
= procedure_modal_text(procedure, :body)
|
|
||||||
%b Elle ne pourra plus être modifiée à l’issue de cette publication.
|
|
||||||
.form-group
|
|
||||||
%h4 Adresse de la démarche
|
|
||||||
%p Vous pouvez personnaliser le lien public de la démarche pour en faciliter l’accès.
|
|
||||||
%p
|
|
||||||
= commencer_url(path: '')
|
|
||||||
= text_field_tag(:path, procedure.path,
|
|
||||||
id: 'procedure_path',
|
|
||||||
placeholder: 'chemin-de-la-démarche',
|
|
||||||
required: true,
|
|
||||||
class: 'form-control',
|
|
||||||
pattern: '^[a-z0-9_-]{3,50}$',
|
|
||||||
title: "De 3 à 50 caractères; minuscules, chiffres et tiret seulement",
|
|
||||||
data: { remote: true, debounce: true, url: admin_procedure_publish_validate_path(procedure) },
|
|
||||||
autocomplete: 'off',
|
|
||||||
style: 'width: 300px; display: inline;')
|
|
||||||
= render 'publish_path_message', procedure: procedure, administrateur: administrateur
|
|
||||||
.text-info
|
|
||||||
Attention, diffusez toujours le <strong>lien complet</strong> affiché ci-dessus, et non pas un lien générique vers #{APPLICATION_NAME}. Ne dites pas non plus aux usagers de se rendre sur le site générique #{APPLICATION_NAME}, donnez-leur toujours le lien complet.
|
|
||||||
.form-group
|
|
||||||
%h4 Diffusion de la démarche
|
|
||||||
%p Où les utilisateurs trouveront-ils le lien de la démarche ? Typiquement, il s’agit d’une page de votre site web.
|
|
||||||
%p.center
|
|
||||||
= text_field_tag(:lien_site_web, procedure.lien_site_web,
|
|
||||||
required: true,
|
|
||||||
class: 'form-control',
|
|
||||||
autocomplete: 'off',
|
|
||||||
placeholder: 'https://exemple.gouv.fr/ma_demarche')
|
|
||||||
.text-info
|
|
||||||
Prenez quelques minutes pour savoir comment établir une bonne relation avec les usagers de votre démarche :
|
|
||||||
= link_to "Regarder la vidéo de 5 minutes.",
|
|
||||||
"https://vimeo.com/334463514",
|
|
||||||
target: "_blank"
|
|
||||||
.modal-footer
|
|
||||||
= render 'publish_buttons', procedure: procedure, administrateur: administrateur
|
|
|
@ -1,27 +0,0 @@
|
||||||
#transfer-modal.modal.fade{ "aria-labelledby" => "TransferProcedureModal", :role => "dialog", :tabindex => "-1" }
|
|
||||||
.modal-dialog.modal-md{ :role => "document" }
|
|
||||||
= form_tag admin_procedure_transfer_path(procedure_id: @procedure.id), method: :post, remote: true do
|
|
||||||
.modal-content
|
|
||||||
.modal-header
|
|
||||||
%button.close{ "aria-label" => "Close", "data-dismiss" => "modal", :type => "button" }
|
|
||||||
%span{ "aria-hidden" => "true" } ×
|
|
||||||
|
|
||||||
%h4#myModalLabel.modal-title
|
|
||||||
Envoyer une copie de cette démarche à un autre administrateur
|
|
||||||
|
|
||||||
.modal-body
|
|
||||||
%p
|
|
||||||
Cette fonctionnalité vous permet de d'envoyer une copie de votre démarche à un autre administrateur.
|
|
||||||
|
|
||||||
%div{ style:'margin-top:20px' }
|
|
||||||
= text_field_tag :email_admin, '', { class: 'form-control',
|
|
||||||
type: 'email',
|
|
||||||
placeholder: 'Email administrateur cible',
|
|
||||||
style: 'width: 300px; margin-left:auto; margin-right:auto' }
|
|
||||||
|
|
||||||
#not_found_admin.center.text-danger{ style:'display: none; margin-top: 10px;' }
|
|
||||||
Cet administrateur n'existe pas.
|
|
||||||
|
|
||||||
.modal-footer
|
|
||||||
= submit_tag "Envoyer", class: 'btn btn-success'
|
|
||||||
= button_tag 'Annuler', class: %w(btn btn btn-default), id: 'cancel', data: { dismiss: 'modal' }
|
|
|
@ -1,17 +0,0 @@
|
||||||
#onglets
|
|
||||||
%ul.nav.nav-tabs
|
|
||||||
%li{ class: @draft_class }
|
|
||||||
%a{ :href => "#{url_for :admin_procedures_draft}" }
|
|
||||||
%h5.text-primary
|
|
||||||
En test
|
|
||||||
|
|
||||||
%li{ class: @active_class }
|
|
||||||
%a{ :href => "#{url_for :admin_procedures}" }
|
|
||||||
%h5.text-success
|
|
||||||
Actives
|
|
||||||
|
|
||||||
%li{ class: @archived_class }
|
|
||||||
%a{ :href => "#{url_for :admin_procedures_archived}" }
|
|
||||||
%h5{ style: 'color: black;' }
|
|
||||||
Closes
|
|
||||||
%br
|
|
|
@ -1,13 +0,0 @@
|
||||||
#publish-buttons
|
|
||||||
= button_tag "Annuler", class: %w(btn btn-default), data: { dismiss: :modal }
|
|
||||||
|
|
||||||
- procedure.validate(:publication)
|
|
||||||
- errors = procedure.errors
|
|
||||||
-# Ignore the :taken error if the path can be claimed
|
|
||||||
- if errors.details[:path]&.pluck(:error)&.include?(:taken) && procedure.path_available?(administrateur, procedure.path)
|
|
||||||
- errors.delete(:path)
|
|
||||||
|
|
||||||
- options = { class: %w(btn btn-success), id: 'publish' }
|
|
||||||
- if errors.details[:path].present?
|
|
||||||
- options[:disabled] = :disabled
|
|
||||||
= submit_tag procedure_modal_text(@procedure, :submit), options
|
|
|
@ -1,11 +0,0 @@
|
||||||
#publish-path-message
|
|
||||||
- procedure.validate(:publication)
|
|
||||||
- errors = procedure.errors
|
|
||||||
-# Ignore the :taken error if the path can be claimed, and instead display the :taken_can_be_claimed error message.
|
|
||||||
- if errors.details[:path]&.pluck(:error)&.include?(:taken) && procedure.path_available?(administrateur, procedure.path)
|
|
||||||
.alert.alert-warning
|
|
||||||
= errors.full_message('Le lien public', errors.generate_message(:path, :taken_can_be_claimed))
|
|
||||||
- elsif errors.messages[:path].present?
|
|
||||||
-# Display the actual errors for :path
|
|
||||||
.alert.alert-danger
|
|
||||||
= errors.full_message('Le lien public', errors.messages[:path].first)
|
|
|
@ -1,14 +0,0 @@
|
||||||
#admins-index
|
|
||||||
.default-data-block.default_visible
|
|
||||||
.row.show-block#new_dossiers
|
|
||||||
.header
|
|
||||||
.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
|
|
||||||
.carret-right
|
|
||||||
.carret-down
|
|
||||||
Démarches
|
|
||||||
%a{ href: new_from_existing_admin_procedures_path }
|
|
||||||
#new-procedure.col-lg-2.col-md-2.col-sm-2.col-xs-2.action
|
|
||||||
Nouvelle
|
|
||||||
|
|
||||||
.body
|
|
||||||
= smart_listing_render :procedures
|
|
|
@ -1 +0,0 @@
|
||||||
<%= smart_listing_update :procedures %>
|
|
|
@ -1,4 +0,0 @@
|
||||||
= render_to_element("#publish-path-message", partial: 'publish_path_message', outer: true,
|
|
||||||
locals: { procedure: @procedure, administrateur: current_administrateur })
|
|
||||||
= render_to_element("#publish-buttons", partial: 'publish_buttons', outer: true,
|
|
||||||
locals: { procedure: @procedure, administrateur: current_administrateur })
|
|
|
@ -1,128 +0,0 @@
|
||||||
= render partial: 'admin/closed_mail_template_attestation_inconsistency_alert'
|
|
||||||
.row.white-back
|
|
||||||
= render 'modal_publish', procedure: @procedure, administrateur: @current_administrateur
|
|
||||||
= render 'modal_transfer'
|
|
||||||
|
|
||||||
#procedure_show
|
|
||||||
- if @procedure.brouillon?
|
|
||||||
- if @procedure.missing_steps.present?
|
|
||||||
- missing_elements = []
|
|
||||||
- if @procedure.missing_instructeurs?
|
|
||||||
- missing_elements << 'des instructeurs'
|
|
||||||
- if @procedure.service.nil?
|
|
||||||
- missing_elements << 'un service'
|
|
||||||
- message = "Affectez #{missing_elements.join(' et ')} à votre démarche."
|
|
||||||
%button.action_button.btn.btn-success#disabled-publish-procedure{ style: 'float: right; margin-top: 10px;', disabled: true, title: message }
|
|
||||||
%i.fa.fa-eraser
|
|
||||||
Publier
|
|
||||||
- else
|
|
||||||
%button.btn.btn-success#publish-procedure{ data: { target: '#publish-modal', toggle: :modal }, type: 'button', style: 'float: right; margin-top: 10px;' }
|
|
||||||
%i.fa.fa-eraser
|
|
||||||
Publier
|
|
||||||
|
|
||||||
%button.btn.btn-default#transfer-procedure{ data: { target: '#transfer-modal', toggle: :modal }, type: 'button', style: 'float: right; margin-top: 10px; margin-right: 10px;' }
|
|
||||||
%i.fa.fa-exchange
|
|
||||||
Envoyer une copie
|
|
||||||
|
|
||||||
- if @procedure.close? || @procedure.depubliee?
|
|
||||||
%button.btn.btn-default#reopen-procedure{ data: { target: '#publish-modal', toggle: :modal }, type: 'button', style: 'float: right; margin-top: 10px; margin-right: 10px;' }
|
|
||||||
%i.fa.fa-rocket
|
|
||||||
Réactiver
|
|
||||||
|
|
||||||
- elsif @procedure.publiee?
|
|
||||||
= form_tag admin_procedure_archive_path(procedure_id: @procedure.id), method: :put, style: 'float: right; margin-top: 10px;' do
|
|
||||||
%button#archive-procedure.btn.btn-small.btn-default.text-info{ type: :button }
|
|
||||||
%i.fa.fa-eraser
|
|
||||||
Archiver
|
|
||||||
#confirm
|
|
||||||
%button#valid.btn.btn-small.btn-success{ type: :submit }
|
|
||||||
%i.fa.fa-check
|
|
||||||
Valider
|
|
||||||
%button#cancel.btn.btn-small.btn-danger{ type: :button }
|
|
||||||
%i.fa.fa-remove
|
|
||||||
Annuler
|
|
||||||
|
|
||||||
.lien-demarche
|
|
||||||
%h3
|
|
||||||
- if @procedure.brouillon?
|
|
||||||
Test et publication
|
|
||||||
- else
|
|
||||||
Publication
|
|
||||||
%div{ style: 'margin-top: 30px;' }
|
|
||||||
- if @procedure.close?
|
|
||||||
Cette démarche est <strong>close</strong> et n’est donc plus accessible par le public.
|
|
||||||
- elsif @procedure.publiee?
|
|
||||||
Cette démarche est <strong>publiée</strong>, certains éléments ne peuvent plus être modifiés.
|
|
||||||
Pour y accéder vous pouvez utiliser le lien :
|
|
||||||
= link_to @procedure_lien, sanitize_url(@procedure_lien), target: :blank, rel: :noopener
|
|
||||||
%br
|
|
||||||
%br
|
|
||||||
Attention, diffusez toujours le <strong>lien complet</strong> affiché ci-dessus, et non pas un lien générique vers #{APPLICATION_NAME}. Ne dites pas non plus aux usagers de se rendre sur le site générique #{APPLICATION_NAME}, donnez-leur toujours le lien complet.
|
|
||||||
- elsif @procedure.brouillon?
|
|
||||||
- if @procedure.missing_steps.empty?
|
|
||||||
%p
|
|
||||||
Cette démarche est actuellement <strong>en test</strong>,
|
|
||||||
pour y accéder vous pouvez utiliser le lien :
|
|
||||||
= link_to @procedure_lien, sanitize_url(@procedure_lien), target: :blank, rel: :noopener
|
|
||||||
%p
|
|
||||||
Toute personne ayant la connaissance de ce lien pourra ainsi remplir des dossiers de test sur votre démarche.
|
|
||||||
%br
|
|
||||||
%h4 Protection des Données personnelles
|
|
||||||
%p
|
|
||||||
À ce moment du processus de création, vous devez informer votre Délégué à la Protection des Données personnelles (DPD).
|
|
||||||
(
|
|
||||||
%a{ href:'https://www.cnil.fr/fr/protection-des-donnees-les-bons-reflexes', target:'_blank' }
|
|
||||||
https://www.cnil.fr/fr/protection-des-donnees-les-bons-reflexes
|
|
||||||
)
|
|
||||||
Si votre démarche propose de collecter des données personnelles, vous devez informer votre DPD. Chaque organisme en a un.
|
|
||||||
%p
|
|
||||||
Ce dernier pourra vous aider dans la finalisation de votre démarche, et vous inviter à vous interroger sur les données collectées, et sur la pertinence de ses dernières.
|
|
||||||
N'oubliez pas : toutes les démarches qui contiennent des données personnelles doivent être consignées dans un registre des traitements :
|
|
||||||
%a{ href:'https://www.cnil.fr/fr/RGDP-le-registre-des-activites-de-traitement', target:'_blank' }
|
|
||||||
https://www.cnil.fr/fr/RGDP-le-registre-des-activites-de-traitement
|
|
||||||
%p
|
|
||||||
Comment faire :
|
|
||||||
vous pouvez soit lui communiquer par email le lien vers la démarche en test, ou bien le nommer « administrateur ». Dans tous les cas, ne publiez votre démarche qu’après avoir eu son avis.
|
|
||||||
|
|
||||||
%br
|
|
||||||
%h4 Ce que vous pouvez faire lorsque vous êtes en test
|
|
||||||
%p
|
|
||||||
Profitez de la phase de test pour tester la saisie de dossiers, ainsi que toutes les fonctionnalités associées (instruction, emails automatiques, attestations, etc.).
|
|
||||||
%p
|
|
||||||
Vous pouvez effectuer toutes les modifications que vous souhaitez sur votre démarche pendant cette phase de test.
|
|
||||||
%p
|
|
||||||
Les dossiers qui seront remplis pendant la phase de test seront automatiquement supprimés lors de la modification ou la publication de votre démarche.
|
|
||||||
%br
|
|
||||||
|
|
||||||
%h4 Ce qui se passe lorsque vous passez en publication
|
|
||||||
%p
|
|
||||||
Une fois que vous êtes prêt à publier définitivement votre démarche, cliquez sur le bouton "Publier" pour choisir le lien définitif de votre démarche, les modifications sur la démarches ne seront alors plus possibles.
|
|
||||||
|
|
||||||
%br
|
|
||||||
%h4 Prenez quelques minutes pour savoir comment établir une bonne relation avec les usagers de votre démarche:
|
|
||||||
%p.center
|
|
||||||
%br
|
|
||||||
%iframe{ :src =>"https://player.vimeo.com/video/334463514?color=0069CC",:width =>"640",:height =>"360",:frameborder => "0" }
|
|
||||||
- else
|
|
||||||
.alert.alert-info
|
|
||||||
Pour pouvoir tester cette démarche, vous devez d’abord lui affecter
|
|
||||||
- if @procedure.missing_instructeurs?
|
|
||||||
= link_to("des instructeurs", admin_procedure_groupe_instructeur_path(@procedure, @procedure.defaut_groupe_instructeur))
|
|
||||||
- if @procedure.missing_instructeurs? && @procedure.service.nil?
|
|
||||||
et
|
|
||||||
- if @procedure.service.nil?
|
|
||||||
= link_to("un service", admin_services_path(procedure_id: @procedure))
|
|
||||||
\.
|
|
||||||
- else
|
|
||||||
- if @procedure.missing_steps.include?(:service)
|
|
||||||
%p.alert.alert-danger
|
|
||||||
Vous devez renseigner les coordonnées de votre Service administratif avant de pouvoir publier votre démarche.
|
|
||||||
= link_to 'Cliquez ici.', (@current_administrateur.services.present? ? url_for(admin_services_path(procedure_id: @procedure.id)) : url_for(new_admin_service_path(procedure_id: @procedure.id)))
|
|
||||||
|
|
||||||
- if @procedure.missing_steps.include?(:instructeurs)
|
|
||||||
%p.alert.alert-danger
|
|
||||||
Vous devez affecter des instructeurs avant de pouvoir publier votre démarche.
|
|
||||||
= link_to 'Cliquez ici.', admin_procedure_groupe_instructeur_path(@procedure, @procedure.defaut_groupe_instructeur)
|
|
||||||
|
|
||||||
%p.alert.alert-info
|
|
||||||
Cette démarche n’a pas encore de lien, et n’est pas accessible par le public.
|
|
|
@ -1,10 +0,0 @@
|
||||||
<%- if response.status == 404 %>
|
|
||||||
$('#not_found_admin').slideDown(100);
|
|
||||||
<%- else %>
|
|
||||||
<%= render_flash %>
|
|
||||||
|
|
||||||
$('#not_found_admin').slideUp(100);
|
|
||||||
$("#email_admin").val('');
|
|
||||||
|
|
||||||
$('[role=dialog]').modal('hide');
|
|
||||||
<%- end %>
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
- content_for(:root_class, 'scroll-margins-for-sticky-footer')
|
||||||
- if params[:id] == 'closed_mail'
|
- if params[:id] == 'closed_mail'
|
||||||
= render partial: 'admin/closed_mail_template_attestation_inconsistency_alert'
|
= render partial: 'admin/closed_mail_template_attestation_inconsistency_alert'
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
= form_tag admin_procedure_transfer_path(procedure_id: @procedure.id), method: :post, class: 'form' do
|
||||||
|
.card
|
||||||
|
%h2.card-title
|
||||||
|
Envoyer une copie de cette démarche à un autre administrateur
|
||||||
|
%p.mb-4
|
||||||
|
Cette fonctionnalité vous permet de d'envoyer une copie de votre démarche à un autre administrateur.
|
||||||
|
|
||||||
|
%div
|
||||||
|
= text_field_tag :email_admin, '', { class: 'form-control',
|
||||||
|
type: 'email',
|
||||||
|
placeholder: 'Email administrateur cible' }
|
||||||
|
|
||||||
|
= submit_tag "Envoyer à l'administrateur", class: 'button primary'
|
|
@ -63,11 +63,3 @@
|
||||||
%span.icon.refuse
|
%span.icon.refuse
|
||||||
.dropdown-description
|
.dropdown-description
|
||||||
%h4 Supprimer
|
%h4 Supprimer
|
||||||
|
|
||||||
- if procedure.close?
|
|
||||||
%li
|
|
||||||
= link_to admin_procedure_publication_path(procedure) do
|
|
||||||
%span.icon.unarchive
|
|
||||||
.dropdown-description
|
|
||||||
%h4 Réactiver
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
.card.mb-4
|
||||||
|
%h2.card-title Publiez votre démarche
|
||||||
|
= form_tag admin_procedure_publish_path(procedure_id: procedure.id), method: :put, class: 'form' do
|
||||||
|
%p.mb-4 Publiez votre démarche, et partagez la à vos usagers. Aucune modification ne sera possible.
|
||||||
|
%p Personnalisez le lien public de la démarche pour en faciliter l’accès (<strong>obligatoire pour publier votre démarche</strong>) :
|
||||||
|
%p.empty-text
|
||||||
|
= commencer_url(path: '')
|
||||||
|
= text_field_tag(:path, procedure.path,
|
||||||
|
id: 'procedure_path',
|
||||||
|
label: 'Adresse de diffusion',
|
||||||
|
placeholder: 'chemin-de-la-démarche',
|
||||||
|
required: true,
|
||||||
|
class: 'form',
|
||||||
|
pattern: '^[a-z0-9_-]{3,50}$',
|
||||||
|
title: "De 3 à 50 caractères; minuscules, chiffres et tiret seulement",
|
||||||
|
data: { debounce: true, url: admin_procedure_publish_validate_path(procedure)},
|
||||||
|
autocomplete: 'off',
|
||||||
|
style: 'width: 300px; display: inline;')
|
||||||
|
.text-info.mb-4
|
||||||
|
Attention, diffusez toujours le <strong>lien complet</strong> affiché ci-dessus, et non pas un lien générique vers #{APPLICATION_NAME}. Ne dites pas non plus aux usagers de se rendre sur le site générique #{APPLICATION_NAME}, donnez-leur toujours le lien complet.
|
||||||
|
%h2.card-title Diffusion de la démarche
|
||||||
|
%p Où les utilisateurs trouveront-ils le lien de la démarche ? Typiquement, il s’agit d’une page de votre site web.
|
||||||
|
%p.center
|
||||||
|
= text_field_tag(:lien_site_web, procedure.lien_site_web,
|
||||||
|
required: true,
|
||||||
|
class: 'form-control',
|
||||||
|
autocomplete: 'off',
|
||||||
|
placeholder: 'https://exemple.gouv.fr/ma_demarche')
|
||||||
|
|
||||||
|
- procedure.validate(:publication)
|
||||||
|
- errors = procedure.errors
|
||||||
|
-# Ignore the :taken error if the path can be claimed
|
||||||
|
- if errors.details[:path]&.pluck(:error)&.include?(:taken) && @procedure.path_available?(administrateur, procedure.path)
|
||||||
|
- errors.delete(:path)
|
||||||
|
|
||||||
|
- options = { class: "button primary", id: 'publish' }
|
||||||
|
- if errors.details[:path].present?
|
||||||
|
- options[:disabled] = :disabled
|
||||||
|
.flex.justify-end
|
||||||
|
= submit_tag procedure_publish_text(@procedure, :submit), options
|
|
@ -0,0 +1,90 @@
|
||||||
|
|
||||||
|
= render partial: 'new_administrateur/breadcrumbs',
|
||||||
|
locals: { steps: [link_to('Démarches', admin_procedures_path),
|
||||||
|
link_to(@procedure.libelle, admin_procedure_path(@procedure)),
|
||||||
|
'Publication'] }
|
||||||
|
.container
|
||||||
|
.lien-demarche
|
||||||
|
%h1
|
||||||
|
- if @procedure.brouillon?
|
||||||
|
Test et publication
|
||||||
|
- else
|
||||||
|
Publication
|
||||||
|
%div{ style: 'margin-top: 30px;' }
|
||||||
|
- if @procedure.close? || @procedure.depubliee?
|
||||||
|
%p.mb-4 Cette démarche est <strong>close</strong> et n’est donc plus accessible par le public. Vous pouvez la réactiver :
|
||||||
|
= render partial: 'publication_form', locals: { procedure: @procedure, administrateur: @current_administrateur }
|
||||||
|
- elsif @procedure.publiee?
|
||||||
|
%p Cette démarche est <strong>publiée</strong>, certains éléments ne peuvent plus être modifiés.
|
||||||
|
Pour y accéder vous pouvez utiliser le lien :
|
||||||
|
= link_to @procedure_lien, sanitize_url(@procedure_lien), target: :blank, rel: :noopener, class: "mb-4"
|
||||||
|
|
||||||
|
%p.mb-4 Attention, diffusez toujours le <strong>lien complet</strong> affiché ci-dessus, et non pas un lien générique vers #{APPLICATION_NAME}. Ne dites pas non plus aux usagers de se rendre sur le site générique #{APPLICATION_NAME}, donnez-leur toujours le lien complet.
|
||||||
|
|
||||||
|
= render partial: 'procedure_transfert'
|
||||||
|
- elsif @procedure.brouillon?
|
||||||
|
- if @procedure.missing_steps.empty?
|
||||||
|
%p
|
||||||
|
Cette démarche est actuellement <strong>en test</strong>,
|
||||||
|
pour y accéder vous pouvez utiliser le lien :
|
||||||
|
= link_to @procedure_lien, sanitize_url(@procedure_lien), target: :blank, rel: :noopener
|
||||||
|
%p.mb-4
|
||||||
|
Toute personne ayant la connaissance de ce lien pourra ainsi remplir des dossiers de test sur votre démarche.
|
||||||
|
|
||||||
|
.card.mb-4
|
||||||
|
%h2.card-title Ce que vous pouvez faire lorsque vous êtes en test
|
||||||
|
%p
|
||||||
|
Profitez de la phase de test pour tester la saisie de dossiers, ainsi que toutes les fonctionnalités associées (instruction, emails automatiques, attestations, etc.).
|
||||||
|
%p
|
||||||
|
Vous pouvez effectuer toutes les modifications que vous souhaitez sur votre démarche pendant cette phase de test.
|
||||||
|
%p.mb-4.bold
|
||||||
|
Les dossiers qui seront remplis pendant la phase de test seront automatiquement supprimés lors de la modification ou la publication de votre démarche.
|
||||||
|
%p.center
|
||||||
|
%iframe{ :src =>"https://player.vimeo.com/video/334463514?color=0069CC",:width =>"640",:height =>"360",:frameborder => "0" }
|
||||||
|
|
||||||
|
|
||||||
|
.card
|
||||||
|
%h2.card-title Prêt à publier ?
|
||||||
|
%p
|
||||||
|
À ce moment du processus de création, vous devez informer votre Délégué à la Protection des Données personnelles (DPD).
|
||||||
|
%p
|
||||||
|
(
|
||||||
|
%a{ href:'https://www.cnil.fr/fr/protection-des-donnees-les-bons-reflexes', target:'_blank' }
|
||||||
|
https://www.cnil.fr/fr/protection-des-donnees-les-bons-reflexes
|
||||||
|
)
|
||||||
|
%p
|
||||||
|
Si votre démarche propose de collecter des données personnelles, vous devez informer votre DPD. Chaque organisme en a un.
|
||||||
|
%p
|
||||||
|
Ce dernier pourra vous aider dans la finalisation de votre démarche, et vous inviter à vous interroger sur les données collectées, et sur la pertinence de ces dernières.
|
||||||
|
N'oubliez pas : toutes les démarches qui contiennent des données personnelles doivent être consignées dans un registre des traitements :
|
||||||
|
%a{ href:'https://www.cnil.fr/fr/RGDP-le-registre-des-activites-de-traitement', target:'_blank' }
|
||||||
|
https://www.cnil.fr/fr/RGDP-le-registre-des-activites-de-traitement
|
||||||
|
%p.mb-4
|
||||||
|
Comment faire :
|
||||||
|
vous pouvez soit lui communiquer par email le lien vers la démarche en test, ou bien le nommer « administrateur ». Dans tous les cas, ne publiez votre démarche qu’après avoir eu son avis.
|
||||||
|
|
||||||
|
= render partial: 'publication_form', locals: { procedure: @procedure, administrateur: @current_administrateur }
|
||||||
|
|
||||||
|
- else
|
||||||
|
.alert.alert-info
|
||||||
|
Pour pouvoir tester cette démarche, vous devez d’abord lui affecter
|
||||||
|
- if @procedure.missing_instructeurs?
|
||||||
|
= link_to("des instructeurs", admin_procedure_groupe_instructeur_path(@procedure, @procedure.defaut_groupe_instructeur))
|
||||||
|
- if @procedure.missing_instructeurs? && @procedure.service.nil?
|
||||||
|
et
|
||||||
|
- if @procedure.service.nil?
|
||||||
|
= link_to("un service", admin_services_path(procedure_id: @procedure))
|
||||||
|
\.
|
||||||
|
- else
|
||||||
|
- if @procedure.missing_steps.include?(:service)
|
||||||
|
%p.alert.alert-danger
|
||||||
|
Vous devez renseigner les coordonnées de votre Service administratif avant de pouvoir publier votre démarche.
|
||||||
|
= link_to 'Cliquez ici.', (@current_administrateur.services.present? ? url_for(admin_services_path(procedure_id: @procedure.id)) : url_for(new_admin_service_path(procedure_id: @procedure.id)))
|
||||||
|
|
||||||
|
- if @procedure.missing_steps.include?(:instructeurs)
|
||||||
|
%p.alert.alert-danger
|
||||||
|
Vous devez affecter des instructeurs avant de pouvoir publier votre démarche.
|
||||||
|
= link_to 'Cliquez ici.', admin_procedure_groupe_instructeur_path(@procedure, @procedure.defaut_groupe_instructeur)
|
||||||
|
|
||||||
|
%p.alert.alert-info
|
||||||
|
Cette démarche n’a pas encore de lien, et n’est pas accessible par le public.
|
|
@ -1,9 +1,9 @@
|
||||||
= render partial: 'new_administrateur/breadcrumbs',
|
= render partial: 'new_administrateur/breadcrumbs',
|
||||||
locals: { steps: [link_to('Démarches', admin_procedures_path),
|
locals: { steps: [link_to('Démarches', admin_procedures_path),
|
||||||
"#{@procedure.libelle} (crée le #{@procedure.created_at.strftime('%d/%m/%Y')})", "#{@procedure.locked? ? "Publiée" : "Brouillon" }"] }
|
"#{@procedure.libelle} (crée le #{@procedure.created_at.strftime('%d/%m/%Y')})", "#{@procedure.close? ? "Close" : @procedure.locked? ? "Publiée" : "Brouillon"}"] }
|
||||||
|
|
||||||
.container.procedure-admin-container
|
.container.procedure-admin-container
|
||||||
= link_to apercu_admin_procedure_path(@procedure), class: 'button' do
|
= link_to apercu_admin_procedure_path(@procedure), class: 'button', id: "preview-procedure" do
|
||||||
%span.icon.preview
|
%span.icon.preview
|
||||||
Prévisualiser
|
Prévisualiser
|
||||||
|
|
||||||
|
@ -17,11 +17,14 @@
|
||||||
%span.icon.reply
|
%span.icon.reply
|
||||||
Envoyer une copie
|
Envoyer une copie
|
||||||
|
|
||||||
- if !@procedure.publiee?
|
- if !@procedure.publiee? && !@procedure.close? && !@procedure.depubliee?
|
||||||
= link_to 'Publier', admin_procedure_publication_path(@procedure), class: 'button primary', id: 'publish-procedure-link', data: { disable_with: "Publication..." }
|
= link_to 'Publier', admin_procedure_publication_path(@procedure), class: 'button primary', id: 'publish-procedure-link', data: { disable_with: "Publication..." }
|
||||||
|
|
||||||
|
- if @procedure.close? || @procedure.depubliee?
|
||||||
|
= link_to 'Réactiver', admin_procedure_publication_path(@procedure), class: 'button primary', id: 'publish-procedure-link', data: { disable_with: "Publication..." }
|
||||||
|
|
||||||
- if @procedure.locked? && !@procedure.close?
|
- if @procedure.locked? && !@procedure.close?
|
||||||
= link_to admin_procedure_archive_path(procedure_id: @procedure.id), method: :put, class: 'button', data: { confirm: "Voulez-vous vraiment clore la démarche ? \nLes dossiers en cours pourront être instruits, mais aucun nouveau dossier ne pourra plus être déposé.", disable_with: "Archivage..."} do
|
= link_to admin_procedure_archive_path(procedure_id: @procedure.id), method: :put, class: 'button', id: "close-procedure-link", data: { confirm: "Voulez-vous vraiment clore la démarche ? \nLes dossiers en cours pourront être instruits, mais aucun nouveau dossier ne pourra plus être déposé.", disable_with: "Archivage..."} do
|
||||||
%span.icon.archive
|
%span.icon.archive
|
||||||
Clore
|
Clore
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,6 @@ Rails.application.routes.draw do
|
||||||
patch 'activate' => '/administrateurs/activate#create'
|
patch 'activate' => '/administrateurs/activate#create'
|
||||||
get 'procedures/archived' => 'procedures#archived'
|
get 'procedures/archived' => 'procedures#archived'
|
||||||
get 'procedures/draft' => 'procedures#draft'
|
get 'procedures/draft' => 'procedures#draft'
|
||||||
get 'procedures/:id/publication' => 'procedures#show', as: :procedure_publication
|
|
||||||
|
|
||||||
resources :procedures, only: [:destroy] do
|
resources :procedures, only: [:destroy] do
|
||||||
collection do
|
collection do
|
||||||
|
@ -191,8 +190,6 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
put 'archive' => 'procedures#archive', as: :archive
|
put 'archive' => 'procedures#archive', as: :archive
|
||||||
get 'publish_validate' => 'procedures#publish_validate', as: :publish_validate
|
get 'publish_validate' => 'procedures#publish_validate', as: :publish_validate
|
||||||
put 'publish' => 'procedures#publish', as: :publish
|
|
||||||
post 'transfer' => 'procedures#transfer', as: :transfer
|
|
||||||
put 'clone' => 'procedures#clone', as: :clone
|
put 'clone' => 'procedures#clone', as: :clone
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -371,6 +368,10 @@ Rails.application.routes.draw do
|
||||||
patch 'update_jeton'
|
patch 'update_jeton'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
get 'publication' => 'procedures#publication', as: :publication
|
||||||
|
put 'publish' => 'procedures#publish', as: :publish
|
||||||
|
post 'transfer' => 'procedures#transfer', as: :transfer
|
||||||
|
|
||||||
resources :mail_templates, only: [:edit, :update]
|
resources :mail_templates, only: [:edit, :update]
|
||||||
|
|
||||||
resources :groupe_instructeurs, only: [:index, :show, :create, :update, :destroy] do
|
resources :groupe_instructeurs, only: [:index, :show, :create, :update, :destroy] do
|
||||||
|
|
|
@ -35,48 +35,12 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
sign_in(admin.user)
|
sign_in(admin.user)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'GET #index' do
|
|
||||||
subject { get :index }
|
|
||||||
|
|
||||||
it { expect(response.status).to eq(200) }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'GET #archived' do
|
|
||||||
subject { get :archived }
|
|
||||||
|
|
||||||
it { expect(response.status).to eq(200) }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'GET #archived with sorting and pagination' do
|
|
||||||
subject {
|
|
||||||
get :archived, params: {
|
|
||||||
'procedures_smart_listing[page]': 1,
|
|
||||||
'procedures_smart_listing[per_page]': 10,
|
|
||||||
'procedures_smart_listing[sort][libelle]': 'asc'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
it { expect(subject.status).to eq(200) }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'GET #published' do
|
describe 'GET #published' do
|
||||||
subject { get :published }
|
subject { get :published }
|
||||||
|
|
||||||
it { expect(response.status).to eq(200) }
|
it { expect(response.status).to eq(200) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'GET #draft with sorting and pagination' do
|
|
||||||
subject {
|
|
||||||
get :draft, params: {
|
|
||||||
'procedures_smart_listing[page]': 1,
|
|
||||||
'procedures_smart_listing[per_page]': 10,
|
|
||||||
'procedures_smart_listing[sort][published_at]': 'asc'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
it { expect(subject.status).to eq(200) }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'DELETE #destroy' do
|
describe 'DELETE #destroy' do
|
||||||
let(:procedure_draft) { create(:procedure, administrateurs: [admin]) }
|
let(:procedure_draft) { create(:procedure, administrateurs: [admin]) }
|
||||||
let(:procedure_published) { create(:procedure, :published, administrateurs: [admin]) }
|
let(:procedure_published) { create(:procedure, :published, administrateurs: [admin]) }
|
||||||
|
@ -142,118 +106,6 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'PUT #publish' do
|
|
||||||
let(:procedure) { create(:procedure, administrateur: admin, lien_site_web: lien_site_web) }
|
|
||||||
let(:procedure2) { create(:procedure, :published, administrateur: admin, lien_site_web: lien_site_web) }
|
|
||||||
let(:procedure3) { create(:procedure, :published, lien_site_web: lien_site_web) }
|
|
||||||
let(:lien_site_web) { 'http://some.administration/' }
|
|
||||||
|
|
||||||
context 'when admin is the owner of the procedure' do
|
|
||||||
before do
|
|
||||||
put :publish, params: { procedure_id: procedure.id, path: path, lien_site_web: lien_site_web }, format: 'js'
|
|
||||||
procedure.reload
|
|
||||||
procedure2.reload
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'procedure path does not exist' do
|
|
||||||
let(:path) { 'new_path' }
|
|
||||||
let(:lien_site_web) { 'http://mon-site.gouv.fr' }
|
|
||||||
|
|
||||||
it 'publish the given procedure' do
|
|
||||||
expect(procedure.publiee?).to be_truthy
|
|
||||||
expect(procedure.path).to eq(path)
|
|
||||||
expect(procedure.lien_site_web).to eq(lien_site_web)
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'redirects to the procedures page' do
|
|
||||||
expect(response.status).to eq 200
|
|
||||||
expect(response.body).to include(admin_procedures_path)
|
|
||||||
expect(flash[:notice]).to have_content 'Démarche publiée'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'procedure path exists and is owned by current administrator' do
|
|
||||||
let(:path) { procedure2.path }
|
|
||||||
let(:lien_site_web) { 'http://mon-site.gouv.fr' }
|
|
||||||
|
|
||||||
it 'publish the given procedure' do
|
|
||||||
expect(procedure.publiee?).to be_truthy
|
|
||||||
expect(procedure.path).to eq(path)
|
|
||||||
expect(procedure.lien_site_web).to eq(lien_site_web)
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'depubliee previous procedure' do
|
|
||||||
expect(procedure2.depubliee?).to be_truthy
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'redirects to the procedures page' do
|
|
||||||
expect(response.status).to eq 200
|
|
||||||
expect(response.body).to include(admin_procedures_path)
|
|
||||||
expect(flash[:notice]).to have_content 'Démarche publiée'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'procedure path exists and is not owned by current administrator' do
|
|
||||||
let(:path) { procedure3.path }
|
|
||||||
let(:lien_site_web) { 'http://mon-site.gouv.fr' }
|
|
||||||
|
|
||||||
it 'does not publish the given procedure' do
|
|
||||||
expect(procedure.publiee?).to be_falsey
|
|
||||||
expect(procedure.path).not_to match(path)
|
|
||||||
expect(procedure.lien_site_web).to match(lien_site_web)
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'previous procedure remains published' do
|
|
||||||
expect(procedure2.publiee?).to be_truthy
|
|
||||||
expect(procedure2.close?).to be_falsey
|
|
||||||
expect(procedure2.path).to match(/fake_path/)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'procedure path is invalid' do
|
|
||||||
let(:path) { 'Invalid Procedure Path' }
|
|
||||||
let(:lien_site_web) { 'http://mon-site.gouv.fr' }
|
|
||||||
|
|
||||||
it 'does not publish the given procedure' do
|
|
||||||
expect(procedure.publiee?).to be_falsey
|
|
||||||
expect(procedure.path).not_to match(path)
|
|
||||||
expect(procedure.lien_site_web).to match(lien_site_web)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when admin is not the owner of the procedure' do
|
|
||||||
let(:admin_2) { create(:administrateur) }
|
|
||||||
|
|
||||||
before do
|
|
||||||
sign_out(admin.user)
|
|
||||||
sign_in(admin_2.user)
|
|
||||||
|
|
||||||
put :publish, params: { procedure_id: procedure.id, path: 'fake_path' }, format: 'js'
|
|
||||||
procedure.reload
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'fails' do
|
|
||||||
expect(response).to have_http_status(404)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when the admin does not provide a lien_site_web' do
|
|
||||||
before do
|
|
||||||
put :publish, params: { procedure_id: procedure.id, path: path, lien_site_web: lien_site_web }, format: 'js'
|
|
||||||
procedure.reload
|
|
||||||
end
|
|
||||||
context 'procedure path is valid but lien_site_web is missing' do
|
|
||||||
let(:path) { 'new_path2' }
|
|
||||||
let(:lien_site_web) { nil }
|
|
||||||
|
|
||||||
it 'does not publish the given procedure' do
|
|
||||||
expect(procedure.publiee?).to be_falsey
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'PUT #archive' do
|
describe 'PUT #archive' do
|
||||||
let(:procedure) { create(:procedure, :published, administrateur: admin, lien_site_web: lien_site_web) }
|
let(:procedure) { create(:procedure, :published, administrateur: admin, lien_site_web: lien_site_web) }
|
||||||
|
|
||||||
|
@ -268,21 +120,6 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
it { expect(response).to redirect_to :admin_procedures }
|
it { expect(response).to redirect_to :admin_procedures }
|
||||||
it { expect(flash[:notice]).to have_content 'Démarche close' }
|
it { expect(flash[:notice]).to have_content 'Démarche close' }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when owner want to re-enable procedure' do
|
|
||||||
before do
|
|
||||||
put :publish, params: { procedure_id: procedure.id, path: 'fake_path', lien_site_web: lien_site_web }
|
|
||||||
procedure.reload
|
|
||||||
end
|
|
||||||
|
|
||||||
it { expect(procedure.publiee?).to be_truthy }
|
|
||||||
|
|
||||||
it 'redirects to the procedures page' do
|
|
||||||
expect(response.status).to eq 200
|
|
||||||
expect(response.body).to include(admin_procedures_path)
|
|
||||||
expect(flash[:notice]).to have_content 'Démarche publiée'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when admin is not the owner of the procedure' do
|
context 'when admin is not the owner of the procedure' do
|
||||||
|
@ -391,53 +228,6 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'POST #transfer' do
|
|
||||||
let!(:procedure) { create :procedure, :with_service, administrateur: admin }
|
|
||||||
|
|
||||||
subject do
|
|
||||||
post :transfer, params: { email_admin: email_admin, procedure_id: procedure.id }, format: 'js'
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when admin is unknow' do
|
|
||||||
let(:email_admin) { 'plop' }
|
|
||||||
|
|
||||||
it { expect(subject.status).to eq 404 }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when admin is known' do
|
|
||||||
let!(:new_admin) { create :administrateur, email: 'new_admin@admin.com' }
|
|
||||||
|
|
||||||
context "and its email address is correct" do
|
|
||||||
let(:email_admin) { 'new_admin@admin.com' }
|
|
||||||
|
|
||||||
it { expect(subject.status).to eq 200 }
|
|
||||||
it { expect { subject }.to change(new_admin.procedures, :count).by(1) }
|
|
||||||
|
|
||||||
it "should create a new service" do
|
|
||||||
subject
|
|
||||||
expect(new_admin.procedures.last.service_id).not_to eq(procedure.service_id)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when admin is know but its email was not downcased' do
|
|
||||||
let(:email_admin) { "NEW_admin@adMIN.com" }
|
|
||||||
|
|
||||||
it { expect(subject.status).to eq 200 }
|
|
||||||
it { expect { subject }.to change(Procedure, :count).by(1) }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "correctly assigns the new admin" do
|
|
||||||
let(:email_admin) { 'new_admin@admin.com' }
|
|
||||||
|
|
||||||
before do
|
|
||||||
subject
|
|
||||||
end
|
|
||||||
|
|
||||||
it { expect(Procedure.last.administrateurs).to eq [new_admin] }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "DELETE #delete_deliberation" do
|
describe "DELETE #delete_deliberation" do
|
||||||
context "with a demarche the admin owns" do
|
context "with a demarche the admin owns" do
|
||||||
let(:procedure) { create(:procedure, :with_deliberation, administrateur: admin) }
|
let(:procedure) { create(:procedure, :with_deliberation, administrateur: admin) }
|
||||||
|
|
|
@ -340,4 +340,152 @@ describe NewAdministrateur::ProceduresController, type: :controller do
|
||||||
expect(procedure.reload.api_entreprise_token).to eq(valid_token)
|
expect(procedure.reload.api_entreprise_token).to eq(valid_token)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'PUT #publish' do
|
||||||
|
let(:procedure) { create(:procedure, administrateur: admin, lien_site_web: lien_site_web) }
|
||||||
|
let(:procedure2) { create(:procedure, :published, administrateur: admin, lien_site_web: lien_site_web) }
|
||||||
|
let(:procedure3) { create(:procedure, :published, lien_site_web: lien_site_web) }
|
||||||
|
let(:lien_site_web) { 'http://some.administration/' }
|
||||||
|
|
||||||
|
context 'when admin is the owner of the procedure' do
|
||||||
|
context 'procedure path does not exist' do
|
||||||
|
let(:path) { 'new_path' }
|
||||||
|
let(:lien_site_web) { 'http://mon-site.gouv.fr' }
|
||||||
|
|
||||||
|
before do
|
||||||
|
put :publish, params: { procedure_id: procedure.id, path: path, lien_site_web: lien_site_web }
|
||||||
|
procedure.reload
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'publish the given procedure' do
|
||||||
|
expect(procedure.publiee?).to be_truthy
|
||||||
|
expect(procedure.path).to eq(path)
|
||||||
|
expect(procedure.lien_site_web).to eq(lien_site_web)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'redirects to the procedure page' do
|
||||||
|
expect(response.status).to eq 302
|
||||||
|
expect(response.body).to include(admin_procedure_path(procedure.id))
|
||||||
|
expect(flash[:notice]).to have_content 'Démarche publiée'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'procedure path exists and is owned by current administrator' do
|
||||||
|
before do
|
||||||
|
put :publish, params: { procedure_id: procedure.id, path: path, lien_site_web: lien_site_web }
|
||||||
|
procedure.reload
|
||||||
|
procedure2.reload
|
||||||
|
end
|
||||||
|
|
||||||
|
let(:path) { procedure2.path }
|
||||||
|
let(:lien_site_web) { 'http://mon-site.gouv.fr' }
|
||||||
|
|
||||||
|
it 'publish the given procedure' do
|
||||||
|
expect(procedure.publiee?).to be_truthy
|
||||||
|
expect(procedure.path).to eq(path)
|
||||||
|
expect(procedure.lien_site_web).to eq(lien_site_web)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'depubliee previous procedure' do
|
||||||
|
expect(procedure2.depubliee?).to be_truthy
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'redirects to the procedures page' do
|
||||||
|
expect(response.status).to eq 302
|
||||||
|
expect(response.body).to include(admin_procedure_path(procedure.id))
|
||||||
|
expect(flash[:notice]).to have_content 'Démarche publiée'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'procedure path exists and is not owned by current administrator' do
|
||||||
|
let(:path) { procedure3.path }
|
||||||
|
let(:lien_site_web) { 'http://mon-site.gouv.fr' }
|
||||||
|
it { expect { put :publish, params: { procedure_id: procedure.id, path: path, lien_site_web: lien_site_web } }.to raise_error(ActiveRecord::RecordInvalid) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'procedure path is invalid' do
|
||||||
|
let(:lien_site_web) { 'http://mon-site.gouv.fr' }
|
||||||
|
let(:path) { 'Invalid Procedure Path' }
|
||||||
|
it { expect { put :publish, params: { procedure_id: procedure.id, path: path, lien_site_web: lien_site_web } }.to raise_error(ActiveRecord::RecordInvalid) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when admin is not the owner of the procedure' do
|
||||||
|
let(:admin_2) { create(:administrateur) }
|
||||||
|
before do
|
||||||
|
sign_out(admin.user)
|
||||||
|
sign_in(admin_2.user)
|
||||||
|
|
||||||
|
put :publish, params: { procedure_id: procedure.id, path: 'fake_path' }
|
||||||
|
procedure.reload
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'fails' do
|
||||||
|
expect(response).to have_http_status(404)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when the admin does not provide a lien_site_web' do
|
||||||
|
context 'procedure path is valid but lien_site_web is missing' do
|
||||||
|
let(:path) { 'new_path2' }
|
||||||
|
let(:lien_site_web) { nil }
|
||||||
|
it { expect { put :publish, params: { procedure_id: procedure.id, path: path, lien_site_web: lien_site_web } }.to raise_error(ActiveRecord::RecordInvalid) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'POST #transfer' do
|
||||||
|
let!(:procedure) { create :procedure, :with_service, administrateur: admin }
|
||||||
|
|
||||||
|
before do
|
||||||
|
post :transfer, params: { email_admin: email_admin, procedure_id: procedure.id }
|
||||||
|
procedure.reload
|
||||||
|
end
|
||||||
|
|
||||||
|
subject do
|
||||||
|
post :transfer, params: { email_admin: email_admin, procedure_id: procedure.id }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when admin is unknow' do
|
||||||
|
let(:email_admin) { 'plop' }
|
||||||
|
|
||||||
|
it { expect(subject.status).to eq 302 }
|
||||||
|
it { expect(response.body).to include(admin_procedure_publication_path(procedure.id)) }
|
||||||
|
it { expect(flash[:alert]).to be_present }
|
||||||
|
it { expect(flash[:alert]).to eq("Envoi vers #{email_admin} impossible : cet administrateur n'existe pas") }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when admin is known' do
|
||||||
|
let!(:new_admin) { create :administrateur, email: 'new_admin@admin.com' }
|
||||||
|
|
||||||
|
context "and its email address is correct" do
|
||||||
|
let(:email_admin) { 'new_admin@admin.com' }
|
||||||
|
|
||||||
|
it { expect(subject.status).to eq 302 }
|
||||||
|
it { expect { subject }.to change(new_admin.procedures, :count).by(1) }
|
||||||
|
|
||||||
|
it "should create a new service" do
|
||||||
|
subject
|
||||||
|
expect(new_admin.procedures.last.service_id).not_to eq(procedure.service_id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when admin is know but its email was not downcased' do
|
||||||
|
let(:email_admin) { "NEW_admin@adMIN.com" }
|
||||||
|
|
||||||
|
it { expect(subject.status).to eq 302 }
|
||||||
|
it { expect { subject }.to change(Procedure, :count).by(1) }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "correctly assigns the new admin" do
|
||||||
|
let(:email_admin) { 'new_admin@admin.com' }
|
||||||
|
|
||||||
|
before do
|
||||||
|
subject
|
||||||
|
end
|
||||||
|
|
||||||
|
it { expect(Procedure.last.administrateurs).to eq [new_admin] }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,26 +20,21 @@ feature 'As an administrateur I wanna clone a procedure', js: true do
|
||||||
expect(page.find_by_id('procedures')['data-item-count']).to eq('1')
|
expect(page.find_by_id('procedures')['data-item-count']).to eq('1')
|
||||||
page.all('.procedures-actions-btn').first.click
|
page.all('.procedures-actions-btn').first.click
|
||||||
page.all('.clone-btn').first.click
|
page.all('.clone-btn').first.click
|
||||||
visit admin_procedures_draft_path
|
visit admin_procedures_path(statut: "brouillons")
|
||||||
expect(page.find_by_id('procedures')['data-item-count']).to eq('1')
|
expect(page.find_by_id('procedures')['data-item-count']).to eq('1')
|
||||||
click_on Procedure.last.libelle
|
click_on Procedure.last.libelle
|
||||||
expect(page).to have_current_path(admin_procedure_path(Procedure.last))
|
expect(page).to have_current_path(admin_procedure_path(Procedure.last))
|
||||||
|
|
||||||
find('#publish-procedure-link').click
|
find('#publish-procedure-link').click
|
||||||
find('#publish-procedure').click
|
expect(find_field('procedure_path').value).to eq 'libelle-de-la-procedure'
|
||||||
|
fill_in 'lien_site_web', with: 'http://some.website'
|
||||||
within '#publish-modal' do
|
click_on 'publish'
|
||||||
expect(find_field('procedure_path').value).to eq 'libelle-de-la-procedure'
|
|
||||||
expect(page).to have_text('ancienne sera dépubliée')
|
|
||||||
fill_in 'lien_site_web', with: 'http://some.website'
|
|
||||||
click_on 'publish'
|
|
||||||
end
|
|
||||||
|
|
||||||
page.refresh
|
page.refresh
|
||||||
|
|
||||||
visit admin_procedures_archived_path
|
visit admin_procedures_path(statut: "archivees")
|
||||||
expect(page.find_by_id('procedures')['data-item-count']).to eq('1')
|
expect(page.find_by_id('procedures')['data-item-count']).to eq('1')
|
||||||
visit admin_procedures_draft_path
|
visit admin_procedures_path(statut: "brouillons")
|
||||||
expect(page.find_by_id('procedures')['data-item-count']).to eq('0')
|
expect(page.find_by_id('procedures')['data-item-count']).to eq('0')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -77,13 +77,11 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
|
||||||
expect(page).to have_selector('#champ-1-libelle')
|
expect(page).to have_selector('#champ-1-libelle')
|
||||||
|
|
||||||
click_on Procedure.last.libelle
|
click_on Procedure.last.libelle
|
||||||
find('#publish-procedure-link').click
|
|
||||||
|
|
||||||
preview_window = window_opened_by { click_on 'onglet-preview' }
|
find('#preview-procedure').click
|
||||||
within_window(preview_window) do
|
|
||||||
expect(page).to have_current_path(apercu_admin_procedure_path(Procedure.last))
|
expect(page).to have_current_path(apercu_admin_procedure_path(Procedure.last))
|
||||||
expect(page).to have_field('libelle de champ')
|
expect(page).to have_field('libelle de champ')
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'After adding champ and file, make publication' do
|
scenario 'After adding champ and file, make publication' do
|
||||||
|
@ -102,17 +100,12 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
|
||||||
# (Capybara runs the app on an arbitrary host/port.)
|
# (Capybara runs the app on an arbitrary host/port.)
|
||||||
expect(page).to have_link(nil, href: /#{commencer_test_path(Procedure.last.path)}/)
|
expect(page).to have_link(nil, href: /#{commencer_test_path(Procedure.last.path)}/)
|
||||||
|
|
||||||
expect(page).to have_selector('#publish-procedure', visible: true)
|
expect(page).to have_selector('#procedure_path', visible: true)
|
||||||
find('#publish-procedure').click
|
expect(find_field('procedure_path').value).to eq 'libelle-de-la-procedure'
|
||||||
|
fill_in 'lien_site_web', with: 'http://some.website'
|
||||||
within '#publish-modal' do
|
click_on 'publish'
|
||||||
expect(find_field('procedure_path').value).to eq 'libelle-de-la-procedure'
|
|
||||||
fill_in 'lien_site_web', with: 'http://some.website'
|
|
||||||
click_on 'publish'
|
|
||||||
end
|
|
||||||
|
|
||||||
expect(page).to have_text('Démarche publiée')
|
expect(page).to have_text('Démarche publiée')
|
||||||
expect(page).to have_selector('.procedure-lien')
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,21 +20,15 @@ feature 'Publication de démarches', js: true do
|
||||||
|
|
||||||
context 'lorsqu’une démarche est en test' do
|
context 'lorsqu’une démarche est en test' do
|
||||||
scenario 'un administrateur peut la publier' do
|
scenario 'un administrateur peut la publier' do
|
||||||
visit admin_procedures_draft_path
|
visit admin_procedures_path(statut: "brouillons")
|
||||||
click_on procedure.libelle
|
click_on procedure.libelle
|
||||||
find('#publish-procedure-link').click
|
find('#publish-procedure-link').click
|
||||||
within "#procedure_show" do
|
expect(find_field('procedure_path').value).to eq procedure.path
|
||||||
click_on "Publier"
|
fill_in 'lien_site_web', with: 'http://some.website'
|
||||||
end
|
click_on 'Publier'
|
||||||
|
|
||||||
within '#publish-modal' do
|
|
||||||
expect(find_field('procedure_path').value).to eq procedure.path
|
|
||||||
fill_in 'lien_site_web', with: 'http://some.website'
|
|
||||||
click_on 'publish'
|
|
||||||
end
|
|
||||||
|
|
||||||
expect(page).to have_text('Démarche publiée')
|
expect(page).to have_text('Démarche publiée')
|
||||||
expect(page).to have_selector('.procedure-lien')
|
expect(page).to have_selector('#preview-procedure')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -50,21 +44,16 @@ feature 'Publication de démarches', js: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'un administrateur peut la publier' do
|
scenario 'un administrateur peut la publier' do
|
||||||
visit admin_procedures_archived_path
|
visit admin_procedures_path(statut: "archivees")
|
||||||
click_on procedure.libelle
|
click_on procedure.libelle
|
||||||
find('#publish-procedure-link').click
|
find('#publish-procedure-link').click
|
||||||
within "#procedure_show" do
|
|
||||||
click_on "Réactiver"
|
|
||||||
end
|
|
||||||
|
|
||||||
within '#publish-modal' do
|
expect(find_field('procedure_path').value).to eq procedure.path
|
||||||
expect(find_field('procedure_path').value).to eq procedure.path
|
fill_in 'lien_site_web', with: 'http://some.website'
|
||||||
fill_in 'lien_site_web', with: 'http://some.website'
|
click_on 'publish'
|
||||||
click_on 'publish'
|
|
||||||
end
|
|
||||||
|
|
||||||
expect(page).to have_text('Démarche publiée')
|
expect(page).to have_text('Démarche publiée')
|
||||||
expect(page).to have_selector('.procedure-lien')
|
expect(page).to have_selector('#preview-procedure')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -80,21 +69,16 @@ feature 'Publication de démarches', js: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'un administrateur peut la publier' do
|
scenario 'un administrateur peut la publier' do
|
||||||
visit admin_procedures_archived_path
|
visit admin_procedures_path(statut: "archivees")
|
||||||
click_on procedure.libelle
|
click_on procedure.libelle
|
||||||
find('#publish-procedure-link').click
|
find('#publish-procedure-link').click
|
||||||
within "#procedure_show" do
|
|
||||||
click_on "Réactiver"
|
|
||||||
end
|
|
||||||
|
|
||||||
within '#publish-modal' do
|
expect(find_field('procedure_path').value).to eq procedure.path
|
||||||
expect(find_field('procedure_path').value).to eq procedure.path
|
fill_in 'lien_site_web', with: 'http://some.website'
|
||||||
fill_in 'lien_site_web', with: 'http://some.website'
|
click_on 'Publier'
|
||||||
click_on 'publish'
|
|
||||||
end
|
|
||||||
|
|
||||||
expect(page).to have_text('Démarche publiée')
|
expect(page).to have_text('Démarche publiée')
|
||||||
expect(page).to have_selector('.procedure-lien')
|
expect(page).to have_selector('#preview-procedure')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,7 +25,7 @@ feature 'Administrateurs can edit procedures', js: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'the administrator can edit the libelle' do
|
scenario 'the administrator can edit the libelle' do
|
||||||
visit admin_procedures_draft_path
|
visit admin_procedures_path(statut: "brouillons")
|
||||||
click_on procedure.libelle
|
click_on procedure.libelle
|
||||||
find('#presentation').click
|
find('#presentation').click
|
||||||
|
|
||||||
|
|
|
@ -174,11 +174,8 @@ feature 'The routing', js: true do
|
||||||
def publish_procedure(procedure)
|
def publish_procedure(procedure)
|
||||||
click_on procedure.libelle
|
click_on procedure.libelle
|
||||||
find('#publish-procedure-link').click
|
find('#publish-procedure-link').click
|
||||||
find('#publish-procedure').click
|
fill_in 'lien_site_web', with: 'http://some.website'
|
||||||
within '#publish-modal' do
|
click_on 'Publier'
|
||||||
fill_in 'lien_site_web', with: 'http://some.website'
|
|
||||||
click_on 'Publier'
|
|
||||||
end
|
|
||||||
|
|
||||||
expect(page).to have_text('Démarche publiée')
|
expect(page).to have_text('Démarche publiée')
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,77 +0,0 @@
|
||||||
describe 'admin/procedures/show.html.haml', type: :view do
|
|
||||||
let(:closed_at) { nil }
|
|
||||||
let(:procedure) { create(:procedure, :with_service, closed_at: closed_at) }
|
|
||||||
|
|
||||||
before do
|
|
||||||
assign(:procedure, procedure)
|
|
||||||
assign(:procedure_lien, commencer_url(path: procedure.path))
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'procedure is draft' do
|
|
||||||
context 'when procedure does not have a instructeur affected' do
|
|
||||||
before do
|
|
||||||
render
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'publish button is not visible' do
|
|
||||||
it { expect(rendered).not_to have_css('button#publish-procedure') }
|
|
||||||
it { expect(rendered).not_to have_css('button#archive-procedure') }
|
|
||||||
it { expect(rendered).not_to have_css('button#reopen-procedure') }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when procedure have a instructeur affected' do
|
|
||||||
before do
|
|
||||||
create(:instructeur).assign_to_procedure(procedure)
|
|
||||||
render
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'publish button is visible' do
|
|
||||||
it { expect(rendered).to have_css('button#publish-procedure') }
|
|
||||||
it { expect(rendered).not_to have_css('button#archive-procedure') }
|
|
||||||
it { expect(rendered).not_to have_css('button#reopen-procedure') }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'procedure path is not customized' do
|
|
||||||
it { expect(rendered).to have_content('Cette démarche est actuellement en test') }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'procedure is published' do
|
|
||||||
before do
|
|
||||||
procedure.publish!
|
|
||||||
procedure.reload
|
|
||||||
render
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'archive button is visible', js: true do
|
|
||||||
it { expect(rendered).not_to have_css('button#publish-procedure') }
|
|
||||||
it { expect(rendered).to have_css('button#archive-procedure') }
|
|
||||||
it { expect(rendered).not_to have_css('button#reopen-procedure') }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'procedure link is present' do
|
|
||||||
it { expect(rendered).to have_content(commencer_url(path: procedure.path)) }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'procedure is closed' do
|
|
||||||
before do
|
|
||||||
procedure.publish!
|
|
||||||
procedure.close!
|
|
||||||
procedure.reload
|
|
||||||
render
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'Re-enable button is visible' do
|
|
||||||
it { expect(rendered).not_to have_css('button#publish-procedure') }
|
|
||||||
it { expect(rendered).not_to have_css('button#archive-procedure') }
|
|
||||||
it { expect(rendered).to have_css('button#reopen-procedure') }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'procedure link is present' do
|
|
||||||
it { expect(rendered).to have_content('Cette démarche est close et n’est donc plus accessible par le public.') }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
describe 'new_administrateur/procedures/show.html.haml', type: :view do
|
||||||
|
let(:closed_at) { nil }
|
||||||
|
let(:procedure) { create(:procedure, :with_service, closed_at: closed_at) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
assign(:procedure, procedure)
|
||||||
|
assign(:procedure_lien, commencer_url(path: procedure.path))
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'procedure is draft' do
|
||||||
|
context 'when procedure have a instructeur affected' do
|
||||||
|
before do
|
||||||
|
create(:instructeur).assign_to_procedure(procedure)
|
||||||
|
render
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'publish button is visible' do
|
||||||
|
it { expect(rendered).to have_css('#publish-procedure-link') }
|
||||||
|
it { expect(rendered).not_to have_css('#close-procedure-link') }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'procedure path is not customized' do
|
||||||
|
it { expect(rendered).to have_content('Brouillon') }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'procedure is published' do
|
||||||
|
before do
|
||||||
|
procedure.publish!
|
||||||
|
procedure.reload
|
||||||
|
render
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'archive button is visible', js: true do
|
||||||
|
it { expect(rendered).not_to have_css('#publish-procedure-link') }
|
||||||
|
it { expect(rendered).to have_css('#close-procedure-link') }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'procedure is closed' do
|
||||||
|
before do
|
||||||
|
procedure.publish!
|
||||||
|
procedure.close!
|
||||||
|
procedure.reload
|
||||||
|
render
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'Re-enable button is visible' do
|
||||||
|
it { expect(rendered).not_to have_css('#close-procedure-link') }
|
||||||
|
it { expect(rendered).to have_css('#publish-procedure-link') }
|
||||||
|
it { expect(rendered).to have_content('Réactiver') }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue