commit
5468a1bad5
22 changed files with 289 additions and 26 deletions
26
Gemfile.lock
26
Gemfile.lock
|
@ -94,10 +94,10 @@ GEM
|
|||
momentjs-rails (~> 2.8)
|
||||
sassc-rails (~> 2.1)
|
||||
selectize-rails (~> 0.6)
|
||||
aes_key_wrap (1.0.1)
|
||||
aes_key_wrap (1.1.0)
|
||||
after_party (1.11.2)
|
||||
anchored (1.1.0)
|
||||
ast (2.4.0)
|
||||
ast (2.4.1)
|
||||
attr_required (1.0.1)
|
||||
autoprefixer-rails (9.7.6)
|
||||
execjs
|
||||
|
@ -342,7 +342,7 @@ GEM
|
|||
rails-dom-testing (>= 1, < 3)
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
json-jwt (1.11.0)
|
||||
json-jwt (1.13.0)
|
||||
activesupport (>= 4.2)
|
||||
aes_key_wrap
|
||||
bindata
|
||||
|
@ -399,7 +399,7 @@ GEM
|
|||
minitest (5.14.1)
|
||||
momentjs-rails (2.20.1)
|
||||
railties (>= 3.1)
|
||||
multi_json (1.14.1)
|
||||
multi_json (1.15.0)
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.1.1)
|
||||
mustermann (1.1.1)
|
||||
|
@ -407,7 +407,7 @@ GEM
|
|||
nenv (0.3.0)
|
||||
netrc (0.11.0)
|
||||
nio4r (2.5.2)
|
||||
nokogiri (1.10.9)
|
||||
nokogiri (1.10.10)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
notiffany (0.1.3)
|
||||
nenv (~> 0.1)
|
||||
|
@ -442,9 +442,9 @@ GEM
|
|||
validate_url
|
||||
webfinger (>= 1.0.1)
|
||||
orm_adapter (0.5.0)
|
||||
parallel (1.19.1)
|
||||
parser (2.7.1.0)
|
||||
ast (~> 2.4.0)
|
||||
parallel (1.19.2)
|
||||
parser (2.7.1.4)
|
||||
ast (~> 2.4.1)
|
||||
pdf-core (0.7.0)
|
||||
pg (1.2.3)
|
||||
phonelib (0.6.43)
|
||||
|
@ -475,22 +475,22 @@ GEM
|
|||
byebug (~> 11.0)
|
||||
pry (~> 0.13.0)
|
||||
public_suffix (4.0.4)
|
||||
puma (4.3.3)
|
||||
puma (4.3.5)
|
||||
nio4r (~> 2.0)
|
||||
pundit (2.1.0)
|
||||
activesupport (>= 3.0.0)
|
||||
raabro (1.1.6)
|
||||
rack (2.0.9)
|
||||
rack (2.2.3)
|
||||
rack-attack (6.2.2)
|
||||
rack (>= 1.0, < 3)
|
||||
rack-mini-profiler (2.0.1)
|
||||
rack (>= 1.2.0)
|
||||
rack-oauth2 (1.12.0)
|
||||
rack-oauth2 (1.15.0)
|
||||
activesupport
|
||||
attr_required
|
||||
httpclient
|
||||
json-jwt (>= 1.11.0)
|
||||
rack (< 2.1)
|
||||
rack (>= 2.1.0)
|
||||
rack-protection (2.0.8.1)
|
||||
rack
|
||||
rack-proxy (0.6.5)
|
||||
|
@ -733,7 +733,7 @@ GEM
|
|||
nokogiri (~> 1.8)
|
||||
xray-rails (0.3.2)
|
||||
rails (>= 3.1.0)
|
||||
zeitwerk (2.3.1)
|
||||
zeitwerk (2.4.0)
|
||||
zip_tricks (5.0.0)
|
||||
zipline (1.1.1)
|
||||
rails (>= 3.2.1, < 6.1)
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
background-color: rgba(0, 0, 0, 0.08);
|
||||
vertical-align: top;
|
||||
|
||||
&.baseline {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
&.warning {
|
||||
background-color: $orange;
|
||||
color: #FFFFFF;
|
||||
|
|
|
@ -317,3 +317,4 @@
|
|||
.link {
|
||||
color: $blue;
|
||||
}
|
||||
|
||||
|
|
55
app/assets/stylesheets/new_design/card_admin.scss
Normal file
55
app/assets/stylesheets/new_design/card_admin.scss
Normal file
|
@ -0,0 +1,55 @@
|
|||
@import "colors";
|
||||
@import "constants";
|
||||
|
||||
.card-admin {
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
width: 236px;
|
||||
height: 200px;
|
||||
border-radius: 4px;
|
||||
border: solid 1px $border-grey;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-bottom: 20px;
|
||||
|
||||
.card-admin-status-accept {
|
||||
color: #50AA75;
|
||||
}
|
||||
|
||||
.card-admin-status-todo {
|
||||
color: #246AC5;
|
||||
}
|
||||
|
||||
.card-admin-title {
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
margin-bottom: $default-spacer;
|
||||
}
|
||||
|
||||
.card-admin-subtitle {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.card-admin-action {
|
||||
margin-top: auto;
|
||||
}
|
||||
|
||||
.card-admin-action-btn {
|
||||
width: 90px;
|
||||
height: 36px;
|
||||
border-radius: 30px;
|
||||
border: solid 1px #BBBBBB;
|
||||
background: #FFFFFF;
|
||||
cursor: pointer;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 600px) {
|
||||
.card-admin {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
}
|
|
@ -58,6 +58,10 @@ sup {
|
|||
font-size: 0.83em;
|
||||
}
|
||||
|
||||
small {
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
.container {
|
||||
@include horizontal-padding($default-padding);
|
||||
max-width: $page-width + 2 * $default-padding;
|
||||
|
|
6
app/assets/stylesheets/new_design/procedure_grid.scss
Normal file
6
app/assets/stylesheets/new_design/procedure_grid.scss
Normal file
|
@ -0,0 +1,6 @@
|
|||
|
||||
.procedure-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
}
|
|
@ -54,6 +54,22 @@ class InvitesController < ApplicationController
|
|||
redirect_to dossiers_path
|
||||
end
|
||||
|
||||
def destroy
|
||||
invite = Invite.find(params[:id])
|
||||
dossier = invite.dossier
|
||||
if dossier.user == current_user
|
||||
invite.destroy!
|
||||
flash.notice = "L'autorisation de #{invite.email} vient d'être révoquée."
|
||||
else
|
||||
flash.alert = "Vous ne pouvez pas révoquer cette autorisation"
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_back(fallback_location: helpers.url_for_dossier(dossier)) }
|
||||
format.js { @dossier = dossier }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def store_user_location!
|
||||
|
|
|
@ -12,6 +12,10 @@ module NewAdministrateur
|
|||
@procedure ||= Procedure.new(for_individual: true)
|
||||
end
|
||||
|
||||
def show
|
||||
@procedure = current_administrateur.procedures.find(params[:id])
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
%h4 Personnes invitées à participer à ce dossier
|
||||
%ul
|
||||
- dossier.invites.each do |invite|
|
||||
%li= invite.email
|
||||
%li
|
||||
= invite.email
|
||||
%small= link_to("Révoquer l'autorisation", invite_path(invite), data: { confirm: "Souhaitez-vous supprimer l'autorisation ?" }, method: :delete, remote: true)
|
||||
%p Ces personnes peuvent modifier ce dossier.
|
||||
- if dossier.brouillon?
|
||||
%p Une fois le dossier complet, vous devez le déposer vous-même.
|
||||
|
|
2
app/views/invites/_redraw.js.erb
Normal file
2
app/views/invites/_redraw.js.erb
Normal file
|
@ -0,0 +1,2 @@
|
|||
<%= render_to_element('#invites-form', partial: 'invites/form', locals: { dossier: @dossier }, outer: true) %>
|
||||
<%= render_flash %>
|
|
@ -1,2 +1 @@
|
|||
<%= render_to_element('#invites-form', partial: 'invites/form', locals: { dossier: @dossier }, outer: true) %>
|
||||
<%= render_flash %>
|
||||
<%= render 'redraw' %>
|
||||
|
|
1
app/views/invites/destroy.js.erb
Normal file
1
app/views/invites/destroy.js.erb
Normal file
|
@ -0,0 +1 @@
|
|||
<%= render 'redraw' %>
|
|
@ -1,7 +1,7 @@
|
|||
= render partial: 'new_administrateur/breadcrumbs',
|
||||
locals: { steps: [link_to('Démarches', admin_procedures_path),
|
||||
link_to(@procedure.libelle, admin_procedure_path(@procedure)),
|
||||
link_to('MonAvis', admin_procedures_path)] }
|
||||
'MonAvis'] }
|
||||
|
||||
.container
|
||||
%h1.page-title
|
||||
|
|
136
app/views/new_administrateur/procedures/show.html.haml
Normal file
136
app/views/new_administrateur/procedures/show.html.haml
Normal file
|
@ -0,0 +1,136 @@
|
|||
= render partial: 'new_administrateur/breadcrumbs',
|
||||
locals: { steps: [link_to('Démarches', admin_procedures_path),
|
||||
"#{@procedure.libelle} (crée le #{@procedure.created_at.strftime('%d/%m/%Y')})"] }
|
||||
|
||||
.container{ style: "text-align:right; margin-bottom: 20px" }
|
||||
= button_to 'Publier la démarche', admin_procedure_publication_path(@procedure), method: :get, class: 'button primary',id: 'publish-procedure-link', disabled: @procedure.publiee? ? true : false
|
||||
|
||||
.container
|
||||
%h2.explication-libelle{ style: "font-weight: bold; font-size: 20px; margin-bottom: 20px;" } Indispensable avant publication
|
||||
.procedure-grid
|
||||
.card-admin
|
||||
%div
|
||||
%span.icon.accept
|
||||
%p.card-admin-status-accept Validé
|
||||
%div
|
||||
%p.card-admin-title Présentation
|
||||
%p.card-admin-subtitle Logo, nom, description
|
||||
.card-admin-action
|
||||
= button_to 'Modifier', edit_admin_procedure_path(@procedure), method: :get, class: 'card-admin-action-btn', id: "presentation"
|
||||
|
||||
- if !@procedure.locked?
|
||||
.card-admin
|
||||
%div
|
||||
%span.icon.clock
|
||||
%p.card-admin-status-todo À faire
|
||||
%div
|
||||
%p.card-admin-title Formulaire
|
||||
%p.card-admin-subtitle Champs à remplir par les usagers
|
||||
.card-admin-action
|
||||
= button_to 'Modifier', champs_admin_procedure_path(@procedure), method: :get, class: 'card-admin-action-btn'
|
||||
|
||||
.card-admin
|
||||
- if @procedure.service_id.present?
|
||||
%div
|
||||
%span.icon.accept
|
||||
%p.card-admin-status-accept Validé
|
||||
- else
|
||||
%div
|
||||
%span.icon.clock
|
||||
%p.card-admin-status-todo À faire
|
||||
%div
|
||||
%p.card-admin-title Service
|
||||
%p.card-admin-subtitle Choix du service de la démarche
|
||||
.card-admin-action
|
||||
= button_to 'Modifier', new_admin_service_path, params: { procedure_id: @procedure.id }, method: :get, class: 'card-admin-action-btn'
|
||||
|
||||
.card-admin
|
||||
%div
|
||||
%span.icon.accept
|
||||
%p.card-admin-status-accept Validé
|
||||
%div
|
||||
%p.card-admin-title
|
||||
Administrateurs
|
||||
%span.badge.baseline
|
||||
= @procedure.administrateurs.count
|
||||
%p.card-admin-subtitle Gestion de la démarche
|
||||
.card-admin-action
|
||||
= button_to 'Modifier', admin_procedure_administrateurs_path(@procedure), method: :get, class: 'card-admin-action-btn', id: "administrateurs"
|
||||
|
||||
.card-admin
|
||||
- if @procedure.instructeurs.count > 1
|
||||
%div
|
||||
%span.icon.accept
|
||||
%p.card-admin-status-accept Validé
|
||||
- else
|
||||
%div
|
||||
%span.icon.clock
|
||||
%p.card-admin-status-todo À faire
|
||||
%div
|
||||
%p.card-admin-title
|
||||
= feature_enabled?(:administrateur_routage) ? "Groupe Instructeurs" : "Instructeurs"
|
||||
%span.badge.baseline
|
||||
= @procedure.instructeurs.count
|
||||
%p.card-admin-subtitle Suivi des dossiers
|
||||
.card-admin-action
|
||||
- if feature_enabled?(:administrateur_routage)
|
||||
= button_to 'Modifier', admin_procedure_groupe_instructeurs_path(@procedure), method: :get, class: 'card-admin-action-btn', id: "groupe-instructeurs"
|
||||
- else
|
||||
= button_to 'Modifier', admin_procedure_groupe_instructeur_path(@procedure, @procedure.defaut_groupe_instructeur), method: :get, class: 'card-admin-action-btn', id: "instructeurs"
|
||||
|
||||
%h2.explication-libelle{ style: "font-weight: bold; font-size: 20px; margin-bottom: 20px;" } Pour aller plus loin
|
||||
.procedure-grid
|
||||
.card-admin
|
||||
- if @procedure.attestation_template.present?
|
||||
%div
|
||||
%span.icon.accept
|
||||
%p.card-admin-status-accept Activée
|
||||
- else
|
||||
%div
|
||||
%span.icon.clock
|
||||
%p.card-admin-status-todo À activer
|
||||
%div
|
||||
%p.card-admin-title Attestation
|
||||
%p.card-admin-subtitle Délivrance automatique pour les dossiers acceptés
|
||||
.card-admin-action
|
||||
= button_to 'Modifier', edit_admin_procedure_attestation_template_path(@procedure), method: :get, class: 'card-admin-action-btn'
|
||||
|
||||
.card-admin
|
||||
%div
|
||||
%span.icon.clock
|
||||
%p.card-admin-status-todo À configurer
|
||||
%div
|
||||
%p.card-admin-title Configuration des emails
|
||||
%p.card-admin-subtitle Notifications automatiques
|
||||
.card-admin-action
|
||||
= button_to 'Modifier', admin_procedure_mail_templates_path(@procedure), method: :get, class: 'card-admin-action-btn'
|
||||
|
||||
.card-admin
|
||||
- if @procedure.api_entreprise_token.present?
|
||||
%div
|
||||
%span.icon.accept
|
||||
%p.card-admin-status-accept Validé
|
||||
- else
|
||||
%div
|
||||
%span.icon.clock
|
||||
%p.card-admin-status-todo À configurer
|
||||
%div
|
||||
%p.card-admin-title Jeton
|
||||
%p.card-admin-subtitle Configurer le jeton API entreprise
|
||||
.card-admin-action
|
||||
= button_to 'Modifier', jeton_admin_procedure_path(@procedure), method: :get, class: 'card-admin-action-btn'
|
||||
|
||||
.card-admin
|
||||
- if @procedure.monavis_embed.present?
|
||||
%div
|
||||
%span.icon.accept
|
||||
%p.card-admin-status-accept Validé
|
||||
- else
|
||||
%div
|
||||
%span.icon.clock
|
||||
%p.card-admin-status-todo À configurer
|
||||
%div
|
||||
%p.card-admin-title MonAvis
|
||||
%p.card-admin-subtitle Avis des usagers sur votre démarche
|
||||
.card-admin-action
|
||||
= button_to 'Modifier', monavis_admin_procedure_path(@procedure), method: :get, class: 'card-admin-action-btn'
|
|
@ -176,8 +176,9 @@ Rails.application.routes.draw do
|
|||
patch 'activate' => '/administrateurs/activate#create'
|
||||
get 'procedures/archived' => 'procedures#archived'
|
||||
get 'procedures/draft' => 'procedures#draft'
|
||||
get 'procedures/:id/publication' => 'procedures#show', as: :procedure_publication
|
||||
|
||||
resources :procedures, only: [:index, :show, :destroy] do
|
||||
resources :procedures, only: [:index, :destroy] do
|
||||
collection do
|
||||
get 'new_from_existing' => 'procedures#new_from_existing', as: :new_from_existing
|
||||
end
|
||||
|
@ -215,7 +216,7 @@ Rails.application.routes.draw do
|
|||
resources :instructeurs, only: [:index, :create, :destroy]
|
||||
end
|
||||
|
||||
resources :invites, only: [:show] do
|
||||
resources :invites, only: [:show, :destroy] do
|
||||
collection do
|
||||
post 'dossier/:dossier_id', to: 'invites#create', as: :dossier
|
||||
end
|
||||
|
@ -370,7 +371,7 @@ Rails.application.routes.draw do
|
|||
#
|
||||
|
||||
namespace :admin, module: 'new_administrateur' do
|
||||
resources :procedures, except: [:index, :show, :destroy] do
|
||||
resources :procedures, except: [:index, :destroy] do
|
||||
member do
|
||||
get 'apercu'
|
||||
get 'champs'
|
||||
|
|
|
@ -249,4 +249,30 @@ describe InvitesController, type: :controller do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#DELETE destroy' do
|
||||
let!(:invite) { create :invite, email: email, dossier: dossier }
|
||||
let(:signed_in_profile) { dossier.user }
|
||||
|
||||
before do
|
||||
sign_in signed_in_profile
|
||||
end
|
||||
|
||||
subject { delete :destroy, params: { id: invite.id } }
|
||||
|
||||
context 'when user is signed in' do
|
||||
it "destroy invites" do
|
||||
expect { subject }.to change { Invite.count }.from(1).to(0)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier does not belong to user' do
|
||||
let(:another_user) { create(:user) }
|
||||
|
||||
it 'does not destroy invite' do
|
||||
sign_in another_user
|
||||
expect { subject }.not_to change { Invite.count }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,6 +24,7 @@ feature 'As an administrateur I wanna clone a procedure', js: true do
|
|||
click_on Procedure.last.libelle
|
||||
expect(page).to have_current_path(admin_procedure_path(Procedure.last))
|
||||
|
||||
find('#publish-procedure-link').click
|
||||
find('#publish-procedure').click
|
||||
|
||||
within '#publish-modal' do
|
||||
|
|
|
@ -77,6 +77,7 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
|
|||
expect(page).to have_selector('#champ-1-libelle')
|
||||
|
||||
click_on Procedure.last.libelle
|
||||
find('#publish-procedure-link').click
|
||||
|
||||
preview_window = window_opened_by { click_on 'onglet-preview' }
|
||||
within_window(preview_window) do
|
||||
|
@ -95,7 +96,7 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
|
|||
|
||||
click_on Procedure.last.libelle
|
||||
expect(page).to have_current_path(admin_procedure_path(Procedure.last))
|
||||
|
||||
find('#publish-procedure-link').click
|
||||
expect(page).to have_content('en test')
|
||||
# Only check the path even though the link is the complete URL
|
||||
# (Capybara runs the app on an arbitrary host/port.)
|
||||
|
|
|
@ -3,7 +3,7 @@ feature 'procedure locked' do
|
|||
|
||||
before do
|
||||
login_as administrateur.user, scope: :user
|
||||
visit admin_procedure_path(procedure)
|
||||
visit admin_procedure_publication_path(procedure)
|
||||
end
|
||||
|
||||
context 'when procedure is not published' do
|
||||
|
|
|
@ -22,6 +22,7 @@ feature 'Publication de démarches', js: true do
|
|||
scenario 'un administrateur peut la publier' do
|
||||
visit admin_procedures_draft_path
|
||||
click_on procedure.libelle
|
||||
find('#publish-procedure-link').click
|
||||
within "#procedure_show" do
|
||||
click_on "Publier"
|
||||
end
|
||||
|
@ -51,6 +52,7 @@ feature 'Publication de démarches', js: true do
|
|||
scenario 'un administrateur peut la publier' do
|
||||
visit admin_procedures_archived_path
|
||||
click_on procedure.libelle
|
||||
find('#publish-procedure-link').click
|
||||
within "#procedure_show" do
|
||||
click_on "Réactiver"
|
||||
end
|
||||
|
@ -80,6 +82,7 @@ feature 'Publication de démarches', js: true do
|
|||
scenario 'un administrateur peut la publier' do
|
||||
visit admin_procedures_archived_path
|
||||
click_on procedure.libelle
|
||||
find('#publish-procedure-link').click
|
||||
within "#procedure_show" do
|
||||
click_on "Réactiver"
|
||||
end
|
||||
|
|
|
@ -27,7 +27,7 @@ feature 'Administrateurs can edit procedures', js: true do
|
|||
scenario 'the administrator can edit the libelle' do
|
||||
visit admin_procedures_draft_path
|
||||
click_on procedure.libelle
|
||||
click_on 'Description'
|
||||
find('#presentation').click
|
||||
|
||||
expect(page).to have_field('procedure_libelle', with: procedure.libelle)
|
||||
|
||||
|
@ -46,7 +46,7 @@ feature 'Administrateurs can edit procedures', js: true do
|
|||
scenario 'the administrator can edit the libellé, but can‘t change the path' do
|
||||
visit root_path
|
||||
click_on procedure.libelle
|
||||
click_on 'Description'
|
||||
find('#presentation').click
|
||||
|
||||
expect(page).to have_field('procedure_libelle', with: procedure.libelle)
|
||||
expect(page).not_to have_field('procedure_path')
|
||||
|
@ -62,7 +62,7 @@ feature 'Administrateurs can edit procedures', js: true do
|
|||
scenario 'the administrator can add another administrator' do
|
||||
another_administrateur = create(:administrateur)
|
||||
visit admin_procedure_path(procedure)
|
||||
click_on 'Administrateurs'
|
||||
find('#administrateurs').click
|
||||
|
||||
fill_in('administrateur_email', with: another_administrateur.email)
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ feature 'The routing', js: true do
|
|||
login_as administrateur.user, scope: :user
|
||||
|
||||
visit admin_procedure_path(procedure.id)
|
||||
click_on "Groupe d'instructeurs"
|
||||
find('#groupe-instructeurs').click
|
||||
|
||||
# rename routing criteria to spécialité
|
||||
fill_in 'Libellé du routage', with: 'spécialité'
|
||||
|
@ -173,6 +173,7 @@ feature 'The routing', js: true do
|
|||
|
||||
def publish_procedure(procedure)
|
||||
click_on procedure.libelle
|
||||
find('#publish-procedure-link').click
|
||||
find('#publish-procedure').click
|
||||
within '#publish-modal' do
|
||||
fill_in 'lien_site_web', with: 'http://some.website'
|
||||
|
|
Loading…
Reference in a new issue