Merge branch 'dev'
This commit is contained in:
commit
f0c3a47b1b
81 changed files with 327 additions and 225 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -16,7 +16,6 @@ public/uploads
|
|||
public/downloads
|
||||
doc/*.svg
|
||||
uploads/*
|
||||
.DS_Store
|
||||
.byebug_history
|
||||
.env
|
||||
Procfile.dev
|
||||
|
|
2
Gemfile
2
Gemfile
|
@ -112,6 +112,8 @@ gem 'aasm'
|
|||
|
||||
gem 'webpacker', '>= 4.0.x'
|
||||
|
||||
gem 'after_party'
|
||||
|
||||
# Cron jobs
|
||||
gem 'delayed_job_active_record'
|
||||
gem "daemons"
|
||||
|
|
|
@ -88,6 +88,7 @@ GEM
|
|||
sass-rails (~> 5.0)
|
||||
selectize-rails (~> 0.6)
|
||||
aes_key_wrap (1.0.1)
|
||||
after_party (1.10.0)
|
||||
apipie-rails (0.5.10)
|
||||
rails (>= 4.1)
|
||||
arel (9.0.0)
|
||||
|
@ -806,6 +807,7 @@ DEPENDENCIES
|
|||
active_link_to
|
||||
active_model_serializers
|
||||
administrate
|
||||
after_party
|
||||
apipie-rails
|
||||
bootstrap-sass (~> 3.3.5)
|
||||
bootstrap-wysihtml5-rails (~> 0.3.3.8)
|
||||
|
|
|
@ -91,6 +91,10 @@ Pour exécuter les tests de l'application, plusieurs possibilités :
|
|||
bin/rake spec SPEC=file_path/file_name_spec.rb
|
||||
bin/rspec file_path/file_name_spec.rb
|
||||
|
||||
## Ajout de taches à exécuter au déploiement
|
||||
|
||||
rails generate after_party:task task_name
|
||||
|
||||
## Debug
|
||||
|
||||
Une fois `overmind` lancé, et un breakpoint `byebug` inséré dans le code, il faut se connecter au process `server` dans un nouveau terminal afin d'intéragir avec byebug :
|
||||
|
|
|
@ -8,6 +8,11 @@
|
|||
.alert-danger {
|
||||
background-color: $medium-red;
|
||||
color: #FFFFFF;
|
||||
|
||||
a {
|
||||
color: #FFFFFF;
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
.alert-success {
|
||||
|
|
|
@ -144,4 +144,3 @@ $big-number-card-padding: 2 * $segmented-control-item-border-radius;
|
|||
text-align: center;
|
||||
color: $blue;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class Admin::GestionnairesController < AdminController
|
|||
end
|
||||
|
||||
if procedure_id.present?
|
||||
redirect_to admin_procedure_accompagnateurs_path(procedure_id: procedure_id)
|
||||
redirect_to admin_procedure_instructeurs_path(procedure_id: procedure_id)
|
||||
else
|
||||
redirect_to admin_gestionnaires_path
|
||||
end
|
||||
|
@ -54,7 +54,7 @@ class Admin::GestionnairesController < AdminController
|
|||
else
|
||||
User.create(email: email, password: password, confirmed_at: DateTime.now)
|
||||
end
|
||||
flash.notice = 'Accompagnateur ajouté'
|
||||
flash.notice = 'Instructeur ajouté'
|
||||
else
|
||||
flash.alert = @gestionnaire.errors.full_messages
|
||||
end
|
||||
|
@ -62,10 +62,10 @@ class Admin::GestionnairesController < AdminController
|
|||
|
||||
def assign_gestionnaire!
|
||||
if current_administrateur.gestionnaires.include? @gestionnaire
|
||||
flash.alert = 'Accompagnateur déjà ajouté'
|
||||
flash.alert = 'Instructeur déjà ajouté'
|
||||
else
|
||||
@gestionnaire.administrateurs.push current_administrateur
|
||||
flash.notice = 'Accompagnateur ajouté'
|
||||
flash.notice = 'Instructeur ajouté'
|
||||
# TODO Mailer no assign_to
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Admin::AccompagnateursController < AdminController
|
||||
class Admin::InstructeursController < AdminController
|
||||
include SmartListing::Helper::ControllerExtensions
|
||||
helper SmartListing::Helper
|
||||
|
||||
|
@ -10,42 +10,42 @@ class Admin::AccompagnateursController < AdminController
|
|||
def show
|
||||
assign_scope = @procedure.gestionnaires
|
||||
|
||||
@accompagnateurs_assign = smart_listing_create :accompagnateurs_assign,
|
||||
@instructeurs_assign = smart_listing_create :instructeurs_assign,
|
||||
assign_scope,
|
||||
partial: "admin/accompagnateurs/list_assign",
|
||||
partial: "admin/instructeurs/list_assign",
|
||||
array: true
|
||||
|
||||
not_assign_scope = current_administrateur.gestionnaires.where.not(id: assign_scope.ids)
|
||||
not_assign_scope = not_assign_scope.where("email LIKE ?", "%#{params[:filter]}%") if params[:filter]
|
||||
|
||||
@accompagnateurs_not_assign = smart_listing_create :accompagnateurs_not_assign,
|
||||
@instructeurs_not_assign = smart_listing_create :instructeurs_not_assign,
|
||||
not_assign_scope,
|
||||
partial: "admin/accompagnateurs/list_not_assign",
|
||||
partial: "admin/instructeurs/list_not_assign",
|
||||
array: true
|
||||
|
||||
@gestionnaire ||= Gestionnaire.new
|
||||
end
|
||||
|
||||
def update
|
||||
gestionnaire = Gestionnaire.find(params[:accompagnateur_id])
|
||||
gestionnaire = Gestionnaire.find(params[:instructeur_id])
|
||||
procedure = Procedure.find(params[:procedure_id])
|
||||
to = params[:to]
|
||||
|
||||
case to
|
||||
when ASSIGN
|
||||
if gestionnaire.assign_to_procedure(procedure)
|
||||
flash.notice = "L'accompagnateur a bien été affecté"
|
||||
flash.notice = "L'instructeur a bien été affecté"
|
||||
else
|
||||
flash.alert = "L'accompagnateur a déjà été affecté"
|
||||
flash.alert = "L'instructeur a déjà été affecté"
|
||||
end
|
||||
when NOT_ASSIGN
|
||||
if gestionnaire.remove_from_procedure(procedure)
|
||||
flash.notice = "L'accompagnateur a bien été désaffecté"
|
||||
flash.notice = "L'instructeur a bien été désaffecté"
|
||||
else
|
||||
flash.alert = "L'accompagnateur a déjà été désaffecté"
|
||||
flash.alert = "L'instructeur a déjà été désaffecté"
|
||||
end
|
||||
end
|
||||
|
||||
redirect_to admin_procedure_accompagnateurs_path, procedure_id: params[:procedure_id]
|
||||
redirect_to admin_procedure_instructeurs_path, procedure_id: params[:procedure_id]
|
||||
end
|
||||
end
|
|
@ -5,7 +5,7 @@ class Gestionnaires::ActivateController < ApplicationController
|
|||
@gestionnaire = Gestionnaire.with_reset_password_token(params[:token])
|
||||
|
||||
if !@gestionnaire
|
||||
flash.alert = "Le lien de validation du compte accompagnateur a expiré, #{view_context.contact_link('contactez-nous', tags: 'lien expiré')} pour obtenir un nouveau lien."
|
||||
flash.alert = "Le lien de validation du compte instructeur a expiré, #{view_context.contact_link('contactez-nous', tags: 'lien expiré')} pour obtenir un nouveau lien."
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module Manager
|
|||
def reinvite
|
||||
gestionnaire = Gestionnaire.find(params[:id])
|
||||
gestionnaire.invite!
|
||||
flash[:notice] = "Gestionnaire réinvité."
|
||||
flash[:notice] = "Instructeur réinvité."
|
||||
redirect_to manager_gestionnaire_path(gestionnaire)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -31,13 +31,13 @@ module NewGestionnaire
|
|||
end
|
||||
|
||||
def personnes_impliquees
|
||||
@following_accompagnateurs_emails = dossier.followers_gestionnaires.pluck(:email)
|
||||
@following_instructeurs_emails = dossier.followers_gestionnaires.pluck(:email)
|
||||
@avis_emails = dossier.avis.includes(:gestionnaire).map(&:email_to_display)
|
||||
@invites_emails = dossier.invites.map(&:email)
|
||||
@potential_recipients = procedure.gestionnaires.reject { |g| g == current_gestionnaire }
|
||||
end
|
||||
|
||||
def envoyer_a_accompagnateur
|
||||
def envoyer_a_instructeur
|
||||
recipient = Gestionnaire.find(params[:recipient])
|
||||
GestionnaireMailer.send_dossier(current_gestionnaire, dossier, recipient).deliver_later
|
||||
flash.notice = "Dossier envoyé"
|
||||
|
|
|
@ -189,7 +189,7 @@ module NewUser
|
|||
end
|
||||
|
||||
def dossier_with_champs
|
||||
Dossier.with_ordered_champs.find(params[:id])
|
||||
Dossier.with_champs.find(params[:id])
|
||||
end
|
||||
|
||||
def ensure_ownership!
|
||||
|
|
|
@ -42,14 +42,14 @@ class RootController < ApplicationController
|
|||
end
|
||||
|
||||
type_champ_values = {
|
||||
TypeDeChamp.type_champs.fetch(:date) => '2016-07-26',
|
||||
TypeDeChamp.type_champs.fetch(:datetime) => '26/07/2016 07:35',
|
||||
TypeDeChamp.type_champs.fetch(:textarea) => 'Une description de mon projet'
|
||||
TypeDeChamp.type_champs.fetch(:date) => '2016-07-26',
|
||||
TypeDeChamp.type_champs.fetch(:datetime) => '26/07/2016 07:35',
|
||||
TypeDeChamp.type_champs.fetch(:textarea) => 'Une description de mon projet'
|
||||
}
|
||||
|
||||
type_champ_values.each do |(type_champ, value)|
|
||||
all_champs
|
||||
.select { |champ| champ.type_champ == type_champ.to_s }
|
||||
.select { |champ| champ.type_champ == type_champ }
|
||||
.each { |champ| champ.value = value }
|
||||
end
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ class StatsController < ApplicationController
|
|||
|
||||
def index
|
||||
procedures = Procedure.publiees_ou_archivees
|
||||
dossiers = Dossier.where.not(:state => Dossier.states.fetch(:brouillon))
|
||||
dossiers = Dossier.state_not_brouillon
|
||||
|
||||
@procedures_numbers = procedures_numbers(procedures)
|
||||
@dossiers_numbers = dossiers_numbers(dossiers)
|
||||
|
@ -198,7 +198,7 @@ class StatsController < ApplicationController
|
|||
count_per_administrateur = procedures.group(:administrateur_id).count.values
|
||||
{
|
||||
'Une procédure' => count_per_administrateur.select { |count| count == 1 }.count,
|
||||
'Entre deux et cinq procédures' => count_per_administrateur.select { |count| 2 <= count && count <= 5 }.count,
|
||||
'Entre deux et cinq procédures' => count_per_administrateur.select { |count| count.in?(2..5) }.count,
|
||||
'Plus de cinq procédures' => count_per_administrateur.select { |count| 5 < count }.count
|
||||
}
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ class SupportController < ApplicationController
|
|||
redirect_to root_path
|
||||
else
|
||||
setup_context
|
||||
flash.now.alert = "Une erreur est survenue. Vous pouvez nous contactez à #{CONTACT_EMAIL}."
|
||||
flash.now.alert = "Une erreur est survenue. Vous pouvez nous contactez à #{view_context.mail_to(CONTACT_EMAIL)}."
|
||||
|
||||
render :index
|
||||
end
|
||||
|
@ -26,8 +26,7 @@ class SupportController < ApplicationController
|
|||
|
||||
def setup_context
|
||||
@dossier_id = dossier&.id
|
||||
@type = params[:type]
|
||||
@tags = params[:tags]
|
||||
@tags = tags
|
||||
@options = Helpscout::FormAdapter::OPTIONS
|
||||
end
|
||||
|
||||
|
@ -53,6 +52,9 @@ class SupportController < ApplicationController
|
|||
|
||||
def tags
|
||||
[params[:tags], params[:type]].flatten.compact
|
||||
.map { |tag| tag.split(',') }
|
||||
.flatten
|
||||
.reject(&:blank?).uniq
|
||||
end
|
||||
|
||||
def browser_name
|
||||
|
@ -62,7 +64,7 @@ class SupportController < ApplicationController
|
|||
end
|
||||
|
||||
def direct_message?
|
||||
user_signed_in? && params[:type] == Helpscout::FormAdapter::TYPE_INSTRUCTION && dossier.present?
|
||||
user_signed_in? && params[:type] == Helpscout::FormAdapter::TYPE_INSTRUCTION && dossier.present? && !dossier.brouillon?
|
||||
end
|
||||
|
||||
def dossier
|
||||
|
|
|
@ -59,7 +59,7 @@ class Users::CarteController < UsersController
|
|||
|
||||
def self.route_authorization
|
||||
{
|
||||
states: [:brouillon, :en_construction],
|
||||
states: [Dossier.states.fetch(:brouillon), Dossier.states.fetch(:en_construction)],
|
||||
api_carto: true
|
||||
}
|
||||
end
|
||||
|
|
|
@ -149,7 +149,7 @@ class Users::DossiersController < UsersController
|
|||
|
||||
def self.route_authorization
|
||||
{
|
||||
states: [:brouillon]
|
||||
states: [Dossier.states.fetch(:brouillon)]
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -18,7 +18,13 @@ class Users::RecapitulatifController < UsersController
|
|||
|
||||
def self.route_authorization
|
||||
{
|
||||
states: [:en_construction, :en_instruction, :sans_suite, :accepte, :refuse]
|
||||
states: [
|
||||
Dossier.states.fetch(:en_construction),
|
||||
Dossier.states.fetch(:en_instruction),
|
||||
Dossier.states.fetch(:sans_suite),
|
||||
Dossier.states.fetch(:accepte),
|
||||
Dossier.states.fetch(:refuse)
|
||||
]
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ class DossierFacades
|
|||
end
|
||||
|
||||
def champs
|
||||
@dossier.ordered_champs
|
||||
@dossier.champs
|
||||
end
|
||||
|
||||
def etablissement
|
||||
|
@ -42,7 +42,7 @@ class DossierFacades
|
|||
end
|
||||
|
||||
def champs_private
|
||||
@dossier.ordered_champs_private
|
||||
@dossier.champs_private
|
||||
end
|
||||
|
||||
def individual
|
||||
|
|
|
@ -55,8 +55,11 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def contact_link(title, options = {})
|
||||
tags, type, dossier_id = options.values_at(:tags, :type, :dossier_id)
|
||||
options.except!(:tags, :type, :dossier_id)
|
||||
|
||||
if Flipflop.support_form?
|
||||
params = { tags: options[:tags], type: options[:type] }.compact
|
||||
params = { tags: tags, type: type, dossier_id: dossier_id }.compact
|
||||
link_to title, contact_url(params), options
|
||||
else
|
||||
mail_to CONTACT_EMAIL, title,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module TypeDeChampHelper
|
||||
TOGGLES = {
|
||||
TypeDeChamp.type_champs.fetch(:piece_justificative) => :champ_pj?,
|
||||
TypeDeChamp.type_champs.fetch(:siret) => :champ_siret?,
|
||||
TypeDeChamp.type_champs.fetch(:piece_justificative) => :champ_pj?,
|
||||
TypeDeChamp.type_champs.fetch(:siret) => :champ_siret?,
|
||||
TypeDeChamp.type_champs.fetch(:linked_drop_down_list) => :champ_linked_dropdown?
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ class GestionnaireMailer < ApplicationMailer
|
|||
def invite_gestionnaire(gestionnaire, reset_password_token)
|
||||
@reset_password_token = reset_password_token
|
||||
@gestionnaire = gestionnaire
|
||||
subject = "Activez votre compte accompagnateur"
|
||||
subject = "Activez votre compte instructeur"
|
||||
|
||||
mail(to: gestionnaire.email,
|
||||
subject: subject,
|
||||
|
@ -13,7 +13,7 @@ class GestionnaireMailer < ApplicationMailer
|
|||
|
||||
def user_to_gestionnaire(email)
|
||||
@email = email
|
||||
subject = "Vous avez été nommé accompagnateur"
|
||||
subject = "Vous avez été nommé instructeur"
|
||||
|
||||
mail(to: @email, subject: subject)
|
||||
end
|
||||
|
|
|
@ -18,8 +18,8 @@ class Dossier < ApplicationRecord
|
|||
has_one :attestation
|
||||
|
||||
has_many :pieces_justificatives, dependent: :destroy
|
||||
has_many :champs, -> { public_only }, dependent: :destroy
|
||||
has_many :champs_private, -> { private_only }, class_name: 'Champ', dependent: :destroy
|
||||
has_many :champs, -> { public_only.ordered }, dependent: :destroy
|
||||
has_many :champs_private, -> { private_only.ordered }, class_name: 'Champ', dependent: :destroy
|
||||
has_many :quartier_prioritaires, dependent: :destroy
|
||||
has_many :cadastres, dependent: :destroy
|
||||
has_many :commentaires, dependent: :destroy
|
||||
|
@ -27,6 +27,7 @@ class Dossier < ApplicationRecord
|
|||
has_many :invites_user, class_name: 'InviteUser', dependent: :destroy
|
||||
has_many :invites_gestionnaires, class_name: 'InviteGestionnaire', dependent: :destroy
|
||||
has_many :follows
|
||||
has_many :followers_gestionnaires, through: :follows, source: :gestionnaire
|
||||
has_many :avis, dependent: :destroy
|
||||
|
||||
belongs_to :procedure
|
||||
|
@ -55,11 +56,11 @@ class Dossier < ApplicationRecord
|
|||
scope :en_construction, -> { not_archived.state_en_construction }
|
||||
scope :en_instruction, -> { not_archived.state_en_instruction }
|
||||
scope :termine, -> { not_archived.state_termine }
|
||||
scope :downloadable_sorted, -> { state_not_brouillon.includes(:etablissement, :champs, :champs_private).order(en_construction_at: 'asc') }
|
||||
scope :downloadable_sorted, -> { state_not_brouillon.includes(:etablissement, :champs, :champs_private, :user, :individual, :followers_gestionnaires).order(en_construction_at: 'asc') }
|
||||
scope :en_cours, -> { not_archived.state_en_construction_ou_instruction }
|
||||
scope :without_followers, -> { left_outer_joins(:follows).where(follows: { id: nil }) }
|
||||
scope :followed_by, -> (gestionnaire) { joins(:follows).where(follows: { gestionnaire: gestionnaire }) }
|
||||
scope :with_ordered_champs, -> { includes(champs: :type_de_champ).order('types_de_champ.order_place') }
|
||||
scope :with_champs, -> { includes(champs: :type_de_champ) }
|
||||
|
||||
accepts_nested_attributes_for :individual
|
||||
|
||||
|
@ -120,14 +121,6 @@ class Dossier < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def ordered_champs
|
||||
champs.ordered
|
||||
end
|
||||
|
||||
def ordered_champs_private
|
||||
champs_private.ordered
|
||||
end
|
||||
|
||||
def ordered_pieces_justificatives
|
||||
champs.joins(', types_de_piece_justificative').where("pieces_justificatives.type_de_piece_justificative_id = types_de_piece_justificative.id AND types_de_piece_justificative.procedure_id = #{procedure.id}").order('order_place ASC')
|
||||
end
|
||||
|
@ -159,10 +152,6 @@ class Dossier < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def followers_gestionnaires
|
||||
follows.includes(:gestionnaire).map(&:gestionnaire)
|
||||
end
|
||||
|
||||
def reset!
|
||||
etablissement.destroy
|
||||
|
||||
|
@ -340,8 +329,8 @@ class Dossier < ApplicationRecord
|
|||
def sorted_values
|
||||
serialized_dossier = DossierTableExportSerializer.new(self)
|
||||
values = serialized_dossier.attributes.values
|
||||
values += ordered_champs.map(&:for_export)
|
||||
values += ordered_champs_private.map(&:for_export)
|
||||
values += champs.map(&:for_export)
|
||||
values += champs_private.map(&:for_export)
|
||||
values += export_etablissement_data.values
|
||||
values
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ class DossierSerializer < ActiveModel::Serializer
|
|||
:received_at,
|
||||
:processed_at,
|
||||
:motivation,
|
||||
:accompagnateurs,
|
||||
:instructeurs,
|
||||
:invites
|
||||
|
||||
has_one :individual
|
||||
|
@ -71,7 +71,7 @@ class DossierSerializer < ActiveModel::Serializer
|
|||
object.en_instruction_at
|
||||
end
|
||||
|
||||
def accompagnateurs
|
||||
def instructeurs
|
||||
object.followers_gestionnaires.pluck(:email)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ class DossierTableExportSerializer < ActiveModel::Serializer
|
|||
:processed_at,
|
||||
:motivation
|
||||
|
||||
attribute :emails_accompagnateurs
|
||||
attribute :emails_instructeurs
|
||||
|
||||
attributes :individual_gender,
|
||||
:individual_prenom,
|
||||
|
@ -62,7 +62,7 @@ class DossierTableExportSerializer < ActiveModel::Serializer
|
|||
object.individual&.gender
|
||||
end
|
||||
|
||||
def emails_accompagnateurs
|
||||
def emails_instructeurs
|
||||
object.followers_gestionnaires.pluck(:email).join(' ')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ class UserRoutesAuthorizationService
|
|||
def self.authorized_route?(controller, dossier)
|
||||
auth = controller.route_authorization
|
||||
|
||||
auth[:states].include?(dossier.state.to_sym) &&
|
||||
auth[:states].include?(dossier.state) &&
|
||||
(auth[:api_carto].nil? ? true : auth[:api_carto] == dossier.procedure.use_api_carto)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
<%= smart_listing_update :accompagnateurs_not_assign %>
|
||||
|
||||
<%= smart_listing_update :accompagnateurs_assign %>
|
|
@ -19,4 +19,4 @@
|
|||
|
||||
- else
|
||||
%h4.center
|
||||
Aucun accompagnateur
|
||||
Aucun instructeur
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
%h1 Accompagnateurs disponibles
|
||||
%h1 Instructeurs disponibles
|
||||
|
||||
%p
|
||||
Cette page vous permet de gérer la liste des accompagnateurs disponibles pour être affectés à une procédure.
|
||||
Cette page vous permet de gérer la liste des instructeurs disponibles pour être affectés à une procédure.
|
||||
|
||||
%p{ style: 'font-style: italic' }
|
||||
N.B. : cette page ne concerne que la liste des personnes disponibles. Si vous souhaitez affecter ou enlever un accompagnateur d'une procédure particulière,
|
||||
N.B. : cette page ne concerne que la liste des personnes disponibles. Si vous souhaitez affecter ou enlever un instructeur d'une procédure particulière,
|
||||
utilisez plutôt la
|
||||
= link_to "page de la procédure", admin_procedures_path
|
||||
concernée.
|
||||
|
@ -16,7 +16,7 @@
|
|||
.col-xs-1
|
||||
|
||||
.col-xs-6
|
||||
%h3 Ajouter un accompagnateur
|
||||
%h3 Ajouter un instructeur
|
||||
#procedure_new.section.section-label
|
||||
= form_for @gestionnaire, url: { controller: 'admin/gestionnaires', action: :create } do |f|
|
||||
.row
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
%th Enlever
|
||||
%th#email{ style: 'text-align: right;' } Email
|
||||
|
||||
- @accompagnateurs_assign.each do |accompagnateur|
|
||||
- @instructeurs_assign.each do |instructeur|
|
||||
%tr
|
||||
%td.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1.center
|
||||
= link_to "#{admin_procedure_accompagnateurs_path(procedure_id: @procedure.id, accompagnateur_id: accompagnateur.id, to: Admin::AccompagnateursController::NOT_ASSIGN)}", class: "btn btn-primary", 'data-method' => 'put' do
|
||||
= link_to "#{admin_procedure_instructeurs_path(procedure_id: @procedure.id, instructeur_id: instructeur.id, to: Admin::InstructeursController::NOT_ASSIGN)}", class: "btn btn-primary", 'data-method' => 'put' do
|
||||
.fa.fa-arrow-left
|
||||
%td{ style: 'padding-top: 11px; font-size: 15px; text-align: right;' }= accompagnateur.email
|
||||
%td{ style: 'padding-top: 11px; font-size: 15px; text-align: right;' }= instructeur.email
|
||||
|
||||
= smart_listing.paginate
|
||||
= smart_listing.pagination_per_page_links
|
|
@ -1,4 +1,4 @@
|
|||
= smart_listing_controls_for(:accompagnateurs_not_assign, { class: "form-inline text-right" }) do
|
||||
= smart_listing_controls_for(:instructeurs_not_assign, { class: "form-inline text-right" }) do
|
||||
.form-group.filter.input-append
|
||||
= text_field_tag :filter, '', class: "search form-control",
|
||||
placeholder: "Recherche...", autocomplete: :off
|
||||
|
@ -12,11 +12,11 @@
|
|||
%th#email Email
|
||||
%th Ajouter
|
||||
|
||||
- @accompagnateurs_not_assign.each do |accompagnateur|
|
||||
- @instructeurs_not_assign.each do |instructeur|
|
||||
%tr
|
||||
%td.col-xs-11{ style: 'padding-top: 11px; font-size: 15px;' }= accompagnateur.email
|
||||
%td.col-xs-11{ style: 'padding-top: 11px; font-size: 15px;' }= instructeur.email
|
||||
%td.center
|
||||
= link_to "#{admin_procedure_accompagnateurs_path(procedure_id: @procedure.id, accompagnateur_id: accompagnateur.id, to: Admin::AccompagnateursController::ASSIGN)}", class: "btn btn-success gestionnaire-affectation", 'data-method' => 'put' do
|
||||
= link_to "#{admin_procedure_instructeurs_path(procedure_id: @procedure.id, instructeur_id: instructeur.id, to: Admin::InstructeursController::ASSIGN)}", class: "btn btn-success gestionnaire-affectation", 'data-method' => 'put' do
|
||||
.fa.fa-arrow-right
|
||||
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
.row.white-back
|
||||
#accompagnateur_form
|
||||
#instructeur_form
|
||||
.row
|
||||
.col-xs-6
|
||||
%h3.text-info Disponibles
|
||||
= smart_listing_render :accompagnateurs_not_assign
|
||||
= smart_listing_render :instructeurs_not_assign
|
||||
|
||||
%br
|
||||
%h3
|
||||
= t('dynamics.admin.procedure.onglet_accompagnateurs.add.title')
|
||||
= t('dynamics.admin.procedure.onglet_instructeurs.add.title')
|
||||
#procedure_new.section.section-label
|
||||
= form_for @gestionnaire, url: { controller: 'admin/gestionnaires', action: :create } do |f|
|
||||
.row
|
||||
|
@ -20,4 +20,4 @@
|
|||
= f.submit 'Valider', class: 'btn btn-info', style: 'float: left;', id: 'add-gestionnaire-email'
|
||||
.col-xs-6
|
||||
%h3.text-success Affectés
|
||||
= smart_listing_render :accompagnateurs_assign
|
||||
= smart_listing_render :instructeurs_assign
|
3
app/views/admin/instructeurs/show.js.erb
Normal file
3
app/views/admin/instructeurs/show.js.erb
Normal file
|
@ -0,0 +1,3 @@
|
|||
<%= smart_listing_update :instructeurs_not_assign %>
|
||||
|
||||
<%= smart_listing_update :instructeurs_assign %>
|
|
@ -8,7 +8,7 @@
|
|||
- if @procedure.gestionnaires.empty? || @procedure.service.nil?
|
||||
- missing_elements = []
|
||||
- if @procedure.gestionnaires.empty?
|
||||
- missing_elements << 'des accompagnateurs'
|
||||
- missing_elements << 'des instructeurs'
|
||||
- if @procedure.service.nil?
|
||||
- missing_elements << 'un service'
|
||||
- message = "Affectez #{missing_elements.join(' et ')} à votre procédure."
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
- content_for(:title, 'Activation de votre compte accompagnateur')
|
||||
- content_for(:title, 'Activation de votre compte instructeur')
|
||||
|
||||
%p
|
||||
Bonjour,
|
||||
|
||||
%p
|
||||
Vous venez d'être nommé accompagnateur sur demarches-simplifiees.fr.
|
||||
Vous venez d'être nommé instructeur sur demarches-simplifiees.fr.
|
||||
|
||||
%p
|
||||
Votre compte a été créé pour l'adresse email #{@gestionnaire.email}. Pour l’activer, je vous invite à cliquer sur le lien suivant :
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Bienvenue sur demarches-simplifiees.fr,
|
||||
\
|
||||
Vous venez d'être nommé accompagnateur sur demarches-simplifiees.fr.
|
||||
Votre compte (#{@email}) vous donnera désormais aussi accès à l’espace accompagnateur.
|
||||
Vous venez d'être nommé instructeur sur demarches-simplifiees.fr.
|
||||
Votre compte (#{@email}) vous donnera désormais aussi accès à l’espace instructeur.
|
||||
\
|
||||
Bonne journée,
|
||||
\
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
%br
|
||||
= image_tag(image_url(LOGO_NAME))
|
||||
%br
|
||||
%h2#gestionnaire_login Accompagnateur
|
||||
%h2#gestionnaire_login Instructeur
|
||||
|
||||
%br
|
||||
%br
|
||||
|
|
|
@ -9,4 +9,7 @@
|
|||
\-
|
||||
= link_to 'CGU / Mentions légales', CGU_URL
|
||||
\-
|
||||
= contact_link 'Contact'
|
||||
- if @facade.present? && @facade.respond_to?(:dossier)
|
||||
= contact_link 'Contact', dossier_id: @facade.dossier&.id
|
||||
- else
|
||||
= contact_link 'Contact'
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
%li
|
||||
= link_to gestionnaire_procedures_path, class: "menu-item menu-link" do
|
||||
= image_tag "icons/switch-profile.svg"
|
||||
Passer en accompagnateur
|
||||
Passer en instructeur
|
||||
- if administrateur_signed_in? && nav_bar_profile != :administrateur
|
||||
%li
|
||||
= link_to admin_procedures_path, class: "menu-item menu-link" do
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
= link_to(gestionnaire_procedures_path) do
|
||||
%i.fa.fa-user
|
||||
|
||||
Accompagnateur
|
||||
Instructeur
|
||||
|
||||
- if administrateur_signed_in?
|
||||
%li
|
||||
|
|
|
@ -1 +1 @@
|
|||
= render partial: 'layouts/left_panels/left_panel_admin_procedurescontroller_navbar', locals: { active: 'Accompagnateurs' }
|
||||
= render partial: 'layouts/left_panels/left_panel_admin_procedurescontroller_navbar', locals: { active: 'Instructeurs' }
|
|
@ -18,9 +18,9 @@
|
|||
.procedure-list-element
|
||||
Services
|
||||
|
||||
%a#onglet-accompagnateurs{ href: url_for(admin_procedure_accompagnateurs_path(@procedure)) }
|
||||
.procedure-list-element{ class: ('active' if active == 'Accompagnateurs') }
|
||||
= t('dynamics.admin.procedure.onglets.accompagnateurs')
|
||||
%a#onglet-instructeurs{ href: url_for(admin_procedure_instructeurs_path(@procedure)) }
|
||||
.procedure-list-element{ class: ('active' if active == 'Instructeurs') }
|
||||
Instructeurs
|
||||
|
||||
%a#onglet-description{ href: url_for(edit_admin_procedure_path(@procedure)) }
|
||||
.procedure-list-element{ class: ('active' if active == 'Description') }
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
= link_to(admin_gestionnaires_path) do
|
||||
%i.fa.fa-user
|
||||
|
||||
= t('dynamics.admin.menu.accompagnateurs')
|
||||
= t('dynamics.admin.menu.instructeurs')
|
||||
%li.divider{ role: :separator }
|
||||
%li
|
||||
= link_to(admin_profile_path, id: :profile) do
|
||||
|
|
|
@ -3,4 +3,3 @@
|
|||
= render partial: 'header', locals: { avis: @avis, dossier: @dossier }
|
||||
|
||||
= render partial: 'shared/dossiers/show', locals: { dossier: @dossier, demande_seen_at: nil }
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
.tab-title= "Envoyer ce dossier à un autre accompagnateur"
|
||||
.tab-title= "Envoyer ce dossier à un autre instructeur"
|
||||
|
||||
- if potential_recipients.empty?
|
||||
%p.tab-paragraph
|
||||
Vous êtes le seul accompagnateur assigné sur cette procédure
|
||||
Vous êtes le seul instructeur assigné sur cette procédure
|
||||
- else
|
||||
= form_for dossier, url: envoyer_a_accompagnateur_gestionnaire_dossier_path(dossier.procedure, dossier), method: :post, html: { class: 'form' } do |f|
|
||||
= form_for dossier, url: envoyer_a_instructeur_gestionnaire_dossier_path(dossier.procedure, dossier), method: :post, html: { class: 'form' } do |f|
|
||||
.flex.justify-start.align-baseline
|
||||
= select_tag(:recipient, options_from_collection_for_select(potential_recipients, :id, :email))
|
||||
= f.submit "Envoyer", class: "button large send gap-left"
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
= render partial: "header", locals: { dossier: @dossier }
|
||||
|
||||
#dossier-annotations-privees.container
|
||||
- if @dossier.ordered_champs_private.present?
|
||||
- if @dossier.champs_private.present?
|
||||
%section
|
||||
= form_for @dossier, url: annotations_gestionnaire_dossier_path(@dossier.procedure, @dossier), html: { class: 'form' } do |f|
|
||||
= f.fields_for :champs_private, f.object.ordered_champs_private do |champ_form|
|
||||
= f.fields_for :champs_private, f.object.champs_private do |champ_form|
|
||||
- champ = champ_form.object
|
||||
= render partial: "shared/dossiers/editable_champs/editable_champ",
|
||||
locals: { champ: champ, form: champ_form, seen_at: @annotations_privees_seen_at }
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
.personnes-impliquees.container
|
||||
= render partial: 'new_gestionnaire/dossiers/envoyer_dossier_block', locals: { dossier: @dossier, potential_recipients: @potential_recipients }
|
||||
|
||||
= render partial: 'new_gestionnaire/dossiers/personnes_impliquees_block', locals: { emails_collection: @following_accompagnateurs_emails, title: "Accompagnateurs qui suivent le dossier", blank: "Aucun accompagnateur ne suit ce dossier" }
|
||||
= render partial: 'new_gestionnaire/dossiers/personnes_impliquees_block', locals: { emails_collection: @following_instructeurs_emails, title: "Instructeurs qui suivent le dossier", blank: "Aucun instructeur ne suit ce dossier" }
|
||||
|
||||
= render partial: 'new_gestionnaire/dossiers/personnes_impliquees_block', locals: { emails_collection: @avis_emails, title: "Personnes à qui un avis a été demandé", blank: "Aucun avis n'a été demandé" }
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
%h2 Formulaire
|
||||
|
||||
- champs = @dossier.ordered_champs.decorate
|
||||
- champs = @dossier.champs.decorate
|
||||
- if champs.any?
|
||||
= render partial: "shared/dossiers/champs", locals: { champs: champs, dossier: @dossier, demande_seen_at: nil }
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
|||
|
||||
%h2 Annotations privées
|
||||
|
||||
- if @dossier.ordered_champs_private.present?
|
||||
- if @dossier.champs_private.present?
|
||||
%table
|
||||
- @dossier.champs_private.each do |champ|
|
||||
%tr
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
%p.confidentiel.flex
|
||||
%span.icon.lock
|
||||
%span
|
||||
Cet avis est confidentiel et n'est pas affiché aux autres experts consultés mais est visible par tous les accompagnateurs
|
||||
Cet avis est confidentiel et n'est pas affiché aux autres experts consultés mais est visible par tous les instructeurs
|
||||
.send-wrapper
|
||||
= f.submit 'Demander un avis', class: 'button send'
|
||||
- else
|
||||
|
@ -18,6 +18,6 @@
|
|||
= f.label :confidentiel, 'Cet avis est'
|
||||
= f.select :confidentiel, [['partagé avec les autres experts', false], ['confidentiel', true]], {}, onchange: "javascript:DS.toggleCondidentielExplanation(event);"
|
||||
.confidentiel-explanation
|
||||
Il ne sera pas affiché aux autres experts consultés mais sera visible par les accompagnateurs
|
||||
Il ne sera pas affiché aux autres experts consultés mais sera visible par les instructeurs
|
||||
.send-wrapper
|
||||
= f.submit 'Demander un avis', class: 'button send'
|
||||
|
|
|
@ -36,4 +36,4 @@
|
|||
–
|
||||
= link_to "Mentions légales", MENTIONS_LEGALES_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer"
|
||||
–
|
||||
= contact_link "Contact technique", class: "footer-link"
|
||||
= contact_link "Contact technique", class: "footer-link", dossier_id: dossier.id
|
||||
|
|
|
@ -124,7 +124,7 @@
|
|||
partenaires
|
||||
%li.number
|
||||
.number-value
|
||||
= number_with_delimiter(Dossier.where.not(:state => Dossier.states.fetch(:brouillon)).count, :locale => :fr)
|
||||
= number_with_delimiter(Dossier.state_not_brouillon.count, :locale => :fr)
|
||||
.number-label<
|
||||
dossiers
|
||||
%br<>
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
partenaires
|
||||
%li.number
|
||||
.number-value
|
||||
= number_with_delimiter(Dossier.where.not(:state => Dossier.states.fetch(:brouillon)).count, :locale => :fr)
|
||||
= number_with_delimiter(Dossier.state_not_brouillon.count, :locale => :fr)
|
||||
.number-label<
|
||||
dossiers
|
||||
%br<>
|
||||
|
@ -72,7 +72,7 @@
|
|||
%div
|
||||
= contact_link "Contactez-nous",
|
||||
tags: 'landing',
|
||||
class: "cta-panel-button white",
|
||||
class: "cta-panel-button-white",
|
||||
target: "_blank",
|
||||
rel: "noopener noreferrer"
|
||||
|
||||
|
|
|
@ -3,4 +3,3 @@
|
|||
- champ_attributes = etablissement.champ.private? ? 'champs_private_attributes' : 'champs_attributes'
|
||||
= fields_for "dossier[#{champ_attributes}][#{position}][etablissement_attributes]", etablissement do |form|
|
||||
= form.hidden_field :_destroy
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
= render partial: "shared/dossiers/identite_individual", locals: { individual: dossier.individual }
|
||||
|
||||
.tab-title Formulaire
|
||||
- champs = dossier.ordered_champs.includes(:type_de_champ).decorate
|
||||
- champs = dossier.champs.includes(:type_de_champ).decorate
|
||||
- if champs.any?
|
||||
.card
|
||||
= render partial: "shared/dossiers/champs", locals: { champs: champs, demande_seen_at: demande_seen_at }
|
||||
|
|
|
@ -14,13 +14,13 @@
|
|||
= label_tag :email do
|
||||
Email
|
||||
%span.mandatory *
|
||||
= text_field_tag :email, '', required: true
|
||||
= text_field_tag :email, params[:email], required: true
|
||||
|
||||
.contact-champ
|
||||
= label_tag :type do
|
||||
Votre problème
|
||||
%span.mandatory *
|
||||
= select_tag :type, options_for_select(@options, @type)
|
||||
= select_tag :type, options_for_select(@options, params[:type])
|
||||
|
||||
.contact-champ
|
||||
= label_tag :dossier_id, 'Numéro du dossier concerné'
|
||||
|
@ -30,19 +30,19 @@
|
|||
= label_tag :subject do
|
||||
Sujet
|
||||
%span.mandatory *
|
||||
= text_field_tag :subject, '', required: true
|
||||
= text_field_tag :subject, params[:subject], required: true
|
||||
|
||||
.contact-champ
|
||||
= label_tag :text do
|
||||
Message
|
||||
%span.mandatory *
|
||||
= text_area_tag :text, '', rows: 6, required: true
|
||||
= text_area_tag :text, params[:text], rows: 6, required: true
|
||||
|
||||
.contact-champ
|
||||
= label_tag :text, 'Pièce jointe'
|
||||
= file_field_tag :file
|
||||
|
||||
= hidden_field_tag :tags, @tags
|
||||
= hidden_field_tag :tags, @tags&.join(',')
|
||||
|
||||
.send-wrapper
|
||||
= button_tag 'Envoyer le message', type: :submit, class: 'button send primary'
|
||||
|
|
|
@ -110,6 +110,16 @@ namespace :yarn do
|
|||
end
|
||||
end
|
||||
|
||||
namespace :rails do
|
||||
desc "Run deploy tasks."
|
||||
task :after_party do
|
||||
queue %{
|
||||
echo "-----> Running deploy tasks"
|
||||
#{echo_cmd %[bundle exec rake after_party:run]}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
desc "Deploys the current version to the server."
|
||||
task :deploy => :environment do
|
||||
queue 'export PATH=$PATH:/usr/local/rbenv/bin:/usr/local/rbenv/shims'
|
||||
|
@ -122,6 +132,7 @@ task :deploy => :environment do
|
|||
invoke :'bundle:install'
|
||||
invoke :'yarn:install'
|
||||
invoke :'rails:db_migrate'
|
||||
invoke :'rails:after_party'
|
||||
invoke :'rails:assets_precompile:force'
|
||||
|
||||
to :launch do
|
||||
|
|
3
config/initializers/after_party.rb
Normal file
3
config/initializers/after_party.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
AfterParty.setup do |config|
|
||||
require "after_party/active_record.rb"
|
||||
end
|
|
@ -19,11 +19,11 @@ fr:
|
|||
nouvelle_procedure: 'Nouvelle procédure'
|
||||
menu:
|
||||
title: Mes procédures
|
||||
accompagnateurs: Accompagnateurs
|
||||
instructeurs: Instructeurs
|
||||
procedures: Procédures
|
||||
procedure:
|
||||
onglets:
|
||||
accompagnateurs: Accompagnateurs
|
||||
onglet_accompagnateurs:
|
||||
instructeurs: Instructeurs
|
||||
onglet_instructeurs:
|
||||
add:
|
||||
title: 'Ajouter un accompagnateur'
|
||||
title: 'Ajouter un instructeur'
|
||||
|
|
|
@ -223,7 +223,7 @@ Rails.application.routes.draw do
|
|||
post 'transfer' => 'procedures#transfer', as: :transfer
|
||||
put 'clone' => 'procedures#clone', as: :clone
|
||||
|
||||
resource :accompagnateurs, only: [:show, :update]
|
||||
resource :instructeurs, only: [:show, :update]
|
||||
|
||||
resource :attestation_template, only: [:edit, :update, :create]
|
||||
|
||||
|
@ -234,8 +234,8 @@ Rails.application.routes.draw do
|
|||
patch 'attestation_template/preview' => 'attestation_templates#preview'
|
||||
end
|
||||
|
||||
namespace :accompagnateurs do
|
||||
get 'show' # delete after fixed tests admin/accompagnateurs/show_spec without this line
|
||||
namespace :instructeurs do
|
||||
get 'show' # delete after fixed tests admin/instructeurs/show_spec without this line
|
||||
end
|
||||
|
||||
resources :gestionnaires, only: [:index, :create, :destroy]
|
||||
|
@ -319,7 +319,7 @@ Rails.application.routes.draw do
|
|||
post 'passer-en-instruction' => 'dossiers#passer_en_instruction'
|
||||
post 'repasser-en-construction' => 'dossiers#repasser_en_construction'
|
||||
post 'terminer'
|
||||
post 'envoyer-a-accompagnateur' => 'dossiers#envoyer_a_accompagnateur'
|
||||
post 'envoyer-a-instructeur' => 'dossiers#envoyer_a_instructeur'
|
||||
scope :carte do
|
||||
get 'position'
|
||||
end
|
||||
|
|
7
db/migrate/20180718133126_create_task_records.rb
Normal file
7
db/migrate/20180718133126_create_task_records.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
class CreateTaskRecords < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :task_records, id: false do |t|
|
||||
t.string :version, null: false
|
||||
end
|
||||
end
|
||||
end
|
|
@ -548,6 +548,10 @@ ActiveRecord::Schema.define(version: 2018_08_27_111451) do
|
|||
t.index ["administrateur_id"], name: "index_services_on_administrateur_id"
|
||||
end
|
||||
|
||||
create_table "task_records", id: false, force: :cascade do |t|
|
||||
t.string "version", null: false
|
||||
end
|
||||
|
||||
create_table "types_de_champ", id: :serial, force: :cascade do |t|
|
||||
t.string "libelle"
|
||||
t.string "type_champ"
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
"received_at": null,
|
||||
"processed_at": null,
|
||||
"motivation": null,
|
||||
"accompagnateurs": [
|
||||
"instructeurs": [
|
||||
"gestionnaire@apientreprise.fr"
|
||||
],
|
||||
"invites": [
|
||||
|
|
|
@ -46,7 +46,7 @@ describe Admin::GestionnairesController, type: :controller do
|
|||
let(:procedure_id) { procedure.id }
|
||||
|
||||
it { expect(response.status).to eq(302) }
|
||||
it { expect(response).to redirect_to admin_procedure_accompagnateurs_path(procedure_id: procedure_id) }
|
||||
it { expect(response).to redirect_to admin_procedure_instructeurs_path(procedure_id: procedure_id) }
|
||||
end
|
||||
|
||||
describe 'Gestionnaire attributs in database' do
|
||||
|
@ -148,7 +148,7 @@ describe Admin::GestionnairesController, type: :controller do
|
|||
end
|
||||
|
||||
context 'Email notification' do
|
||||
it 'Notification email is sent when accompagnateur is create' do
|
||||
it 'Notification email is sent when instructeur is create' do
|
||||
expect_any_instance_of(Gestionnaire).to receive(:invite!)
|
||||
subject
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Admin::AccompagnateursController, type: :controller do
|
||||
describe Admin::InstructeursController, type: :controller do
|
||||
let(:admin) { create(:administrateur) }
|
||||
let(:procedure) { create :procedure, administrateur: admin }
|
||||
let(:gestionnaire) { create :gestionnaire, administrateurs: [admin] }
|
||||
|
@ -15,9 +15,9 @@ describe Admin::AccompagnateursController, type: :controller do
|
|||
end
|
||||
|
||||
describe 'PUT #update' do
|
||||
subject { put :update, params: { accompagnateur_id: gestionnaire.id, procedure_id: procedure.id, to: 'assign' } }
|
||||
subject { put :update, params: { instructeur_id: gestionnaire.id, procedure_id: procedure.id, to: 'assign' } }
|
||||
|
||||
it { expect(subject).to redirect_to admin_procedure_accompagnateurs_path(procedure_id: procedure.id) }
|
||||
it { expect(subject).to redirect_to admin_procedure_instructeurs_path(procedure_id: procedure.id) }
|
||||
|
||||
context 'when assignement is valid' do
|
||||
before do
|
|
@ -137,7 +137,7 @@ describe API::V1::DossiersController do
|
|||
let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, procedure: procedure, motivation: "Motivation") } }
|
||||
let(:dossier_id) { dossier.id }
|
||||
let(:body) { JSON.parse(retour.body, symbolize_names: true) }
|
||||
let(:field_list) { [:id, :created_at, :updated_at, :archived, :individual, :entreprise, :etablissement, :cerfa, :types_de_piece_justificative, :pieces_justificatives, :champs, :champs_private, :commentaires, :state, :simplified_state, :initiated_at, :processed_at, :received_at, :motivation, :email, :accompagnateurs, :invites] }
|
||||
let(:field_list) { [:id, :created_at, :updated_at, :archived, :individual, :entreprise, :etablissement, :cerfa, :types_de_piece_justificative, :pieces_justificatives, :champs, :champs_private, :commentaires, :state, :simplified_state, :initiated_at, :processed_at, :received_at, :motivation, :email, :instructeurs, :invites] }
|
||||
subject { body[:dossier] }
|
||||
|
||||
it 'return REST code 200', :show_in_doc do
|
||||
|
|
|
@ -31,7 +31,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#envoyer_a_accompagnateur' do
|
||||
describe '#envoyer_a_instructeur' do
|
||||
let(:recipient) { create(:gestionnaire) }
|
||||
let(:gestionnaires) { [gestionnaire, recipient] }
|
||||
let(:mail) { double("mail") }
|
||||
|
@ -45,7 +45,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
|||
.and_return(mail)
|
||||
|
||||
post(
|
||||
:envoyer_a_accompagnateur,
|
||||
:envoyer_a_instructeur,
|
||||
params: {
|
||||
recipient: recipient,
|
||||
procedure_id: procedure.id,
|
||||
|
|
|
@ -170,7 +170,7 @@ describe StatsController, type: :controller do
|
|||
}
|
||||
end
|
||||
|
||||
let (:association) { Dossier.where.not(:state => Dossier.states.fetch(:brouillon)) }
|
||||
let (:association) { Dossier.state_not_brouillon }
|
||||
|
||||
subject { StatsController.new.send(:dossier_instruction_mean_time, association) }
|
||||
|
||||
|
@ -222,7 +222,7 @@ describe StatsController, type: :controller do
|
|||
}
|
||||
end
|
||||
|
||||
let (:association) { Dossier.where.not(:state => Dossier.states.fetch(:brouillon)) }
|
||||
let (:association) { Dossier.state_not_brouillon }
|
||||
|
||||
subject { StatsController.new.send(:dossier_filling_mean_time, association) }
|
||||
|
||||
|
|
|
@ -9,6 +9,13 @@ describe SupportController, type: :controller do
|
|||
end
|
||||
let(:user) { create(:user) }
|
||||
|
||||
it 'should not have email field' do
|
||||
get :index
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response.body).not_to have_content("Email *")
|
||||
end
|
||||
|
||||
describe "with dossier" do
|
||||
let(:user) { dossier.user }
|
||||
let(:dossier) { create(:dossier) }
|
||||
|
@ -19,16 +26,9 @@ describe SupportController, type: :controller do
|
|||
expect(response.status).to eq(200)
|
||||
expect(response.body).to include("#{dossier.id}")
|
||||
end
|
||||
|
||||
it 'should not have email field' do
|
||||
get :index
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response.body).not_to have_content("Email *")
|
||||
end
|
||||
end
|
||||
|
||||
describe "with dossier" do
|
||||
describe "with tag" do
|
||||
let(:tag) { 'yolo' }
|
||||
|
||||
it 'should fill tags' do
|
||||
|
@ -38,6 +38,71 @@ describe SupportController, type: :controller do
|
|||
expect(response.body).to include(tag)
|
||||
end
|
||||
end
|
||||
|
||||
describe "with multiple tags" do
|
||||
let(:tags) { ['yolo', 'toto'] }
|
||||
|
||||
it 'should fill tags' do
|
||||
get :index, params: { tags: tags }
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response.body).to include(tags.join(','))
|
||||
end
|
||||
end
|
||||
|
||||
describe "send form" do
|
||||
it 'should create conversation' do
|
||||
expect(subject).not_to receive(:create_commentaire)
|
||||
allow(subject).to receive(:create_conversation).and_return(true)
|
||||
|
||||
post :create, params: {
|
||||
subject: 'bonjour',
|
||||
text: 'un message'
|
||||
}
|
||||
|
||||
expect(flash[:notice]).to match('Votre message a été envoyé.')
|
||||
expect(response).to redirect_to root_path
|
||||
end
|
||||
|
||||
context "with dossier" do
|
||||
let(:user) { dossier.user }
|
||||
let(:dossier) { create(:dossier) }
|
||||
|
||||
it 'should create conversation' do
|
||||
expect(subject).not_to receive(:create_commentaire)
|
||||
allow(subject).to receive(:create_conversation).and_return(true)
|
||||
|
||||
post :create, params: {
|
||||
dossier_id: dossier.id,
|
||||
type: Helpscout::FormAdapter::TYPE_INSTRUCTION,
|
||||
subject: 'bonjour',
|
||||
text: 'un message'
|
||||
}
|
||||
|
||||
expect(flash[:notice]).to match('Votre message a été envoyé.')
|
||||
expect(response).to redirect_to root_path
|
||||
end
|
||||
|
||||
context "en_construction" do
|
||||
let(:dossier) { create(:dossier, :en_construction) }
|
||||
|
||||
it 'should create commentaire' do
|
||||
allow(subject).to receive(:create_commentaire).and_return(true)
|
||||
expect(subject).not_to receive(:create_conversation)
|
||||
|
||||
post :create, params: {
|
||||
dossier_id: dossier.id,
|
||||
type: Helpscout::FormAdapter::TYPE_INSTRUCTION,
|
||||
subject: 'bonjour',
|
||||
text: 'un message'
|
||||
}
|
||||
|
||||
expect(flash[:notice]).to match('Votre message a été envoyé sur la messagerie de votre dossier.')
|
||||
expect(response).to redirect_to users_dossier_recapitulatif_path(dossier)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'signed out' do
|
||||
|
|
|
@ -83,7 +83,7 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
|
|||
end
|
||||
end
|
||||
|
||||
scenario 'After adding champ and file, check impossibility to publish procedure, add accompagnateur and make publication' do
|
||||
scenario 'After adding champ and file, check impossibility to publish procedure, add instructeur and make publication' do
|
||||
fill_in 'procedure_types_de_champ_attributes_0_libelle', with: 'libelle de champ'
|
||||
click_on 'add_type_de_champ'
|
||||
click_on 'onglet-pieces'
|
||||
|
@ -97,8 +97,8 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
|
|||
expect(page).to have_selector('#disabled-publish-procedure')
|
||||
expect(page.find_by_id('disabled-publish-procedure')[:disabled]).to eq('true')
|
||||
|
||||
click_on 'onglet-accompagnateurs'
|
||||
expect(page).to have_current_path(admin_procedure_accompagnateurs_path(Procedure.first))
|
||||
click_on 'onglet-instructeurs'
|
||||
expect(page).to have_current_path(admin_procedure_instructeurs_path(Procedure.first))
|
||||
fill_in 'gestionnaire_email', with: 'gestionnaire@apientreprise.fr'
|
||||
click_on 'add-gestionnaire-email'
|
||||
page.first('.gestionnaire-affectation').click
|
||||
|
|
|
@ -13,7 +13,7 @@ RSpec.describe AvisMailer, type: :mailer do
|
|||
|
||||
context 'when the recipient is not already registered' do
|
||||
before do
|
||||
avis.email = 'accompagnateur@email.com'
|
||||
avis.email = 'instructeur@email.com'
|
||||
avis.gestionnaire = nil
|
||||
end
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ describe Dossier do
|
|||
it { expect(Dossier.without_followers.to_a).to eq([dossier2]) }
|
||||
end
|
||||
|
||||
describe 'with_ordered_champs' do
|
||||
describe 'with_champs' do
|
||||
let(:procedure) { create(:procedure) }
|
||||
let(:dossier) { Dossier.create(user: create(:user), procedure: procedure) }
|
||||
|
||||
|
@ -23,7 +23,7 @@ describe Dossier do
|
|||
end
|
||||
|
||||
it do
|
||||
expect(Dossier.with_ordered_champs.find(dossier.id).champs.map(&:libelle)).to match(%w(l1 l2 l3))
|
||||
expect(Dossier.with_champs.find(dossier.id).champs.map(&:libelle)).to match(%w(l1 l2 l3))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -343,7 +343,7 @@ describe Dossier do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#ordered_champs' do
|
||||
describe '#champs' do
|
||||
let(:procedure) { create(:procedure) }
|
||||
let(:dossier) { Dossier.create(user: create(:user), procedure: procedure) }
|
||||
|
||||
|
@ -353,10 +353,10 @@ describe Dossier do
|
|||
create(:type_de_champ, libelle: 'l2', order_place: 2, procedure: procedure)
|
||||
end
|
||||
|
||||
it { expect(dossier.ordered_champs.pluck(:libelle)).to match(%w(l1 l2 l3)) }
|
||||
it { expect(dossier.champs.pluck(:libelle)).to match(%w(l1 l2 l3)) }
|
||||
end
|
||||
|
||||
describe '#ordered_champs_private' do
|
||||
describe '#champs_private' do
|
||||
let(:procedure) { create :procedure }
|
||||
let(:dossier) { Dossier.create(user: create(:user), procedure: procedure) }
|
||||
|
||||
|
@ -366,7 +366,7 @@ describe Dossier do
|
|||
create :type_de_champ, :private, libelle: 'l2', order_place: 2, procedure: procedure
|
||||
end
|
||||
|
||||
it { expect(dossier.ordered_champs_private.pluck(:libelle)).to match(%w(l1 l2 l3)) }
|
||||
it { expect(dossier.champs_private.pluck(:libelle)).to match(%w(l1 l2 l3)) }
|
||||
end
|
||||
|
||||
describe '#total_follow' do
|
||||
|
|
|
@ -37,18 +37,18 @@ describe DossierTableExportSerializer do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#emails_accompagnateurs' do
|
||||
describe '#emails_instructeurs' do
|
||||
let(:gestionnaire){ create(:gestionnaire) }
|
||||
let(:gestionnaire2) { create :gestionnaire }
|
||||
let(:dossier) { create(:dossier) }
|
||||
|
||||
subject { DossierTableExportSerializer.new(dossier).emails_accompagnateurs }
|
||||
subject { DossierTableExportSerializer.new(dossier).emails_instructeurs }
|
||||
|
||||
context 'when there is no accompagnateurs' do
|
||||
context 'when there is no instructeurs' do
|
||||
it { is_expected.to eq('') }
|
||||
end
|
||||
|
||||
context 'when there one accompagnateur' do
|
||||
context 'when there one instructeur' do
|
||||
before { gestionnaire.followed_dossiers << dossier }
|
||||
|
||||
it { is_expected.to eq(gestionnaire.email) }
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'admin/accompagnateurs/show.html.haml', type: :view do
|
||||
let(:admin) { create(:administrateur) }
|
||||
let(:procedure) { create :procedure, administrateur: admin }
|
||||
|
||||
let(:assign_gestionnaires) { procedure.gestionnaires }
|
||||
let(:not_assign_gestionnaires) { admin.gestionnaires.where.not(id: assign_gestionnaires.ids) }
|
||||
|
||||
before do
|
||||
assign(:procedure, procedure)
|
||||
assign(:gestionnaire, Gestionnaire.new)
|
||||
|
||||
assign(:accompagnateurs_assign, (smart_listing_create :accompagnateurs_assign,
|
||||
assign_gestionnaires,
|
||||
partial: "admin/accompagnateurs/list_assign",
|
||||
array: true))
|
||||
|
||||
assign(:accompagnateurs_not_assign, (smart_listing_create :accompagnateurs_not_assign,
|
||||
not_assign_gestionnaires,
|
||||
partial: "admin/accompagnateurs/list_not_assign",
|
||||
array: true))
|
||||
end
|
||||
|
||||
context 'when admin have none accompagnateur ' do
|
||||
before do
|
||||
render
|
||||
end
|
||||
|
||||
it { expect(rendered).to have_content('Aucun de disponible') }
|
||||
|
||||
context 'when administrateur have none accompagnateur assign' do
|
||||
it { expect(rendered).to have_content('Aucun d\'affecté') }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when administrateur have two accompagnateur' do
|
||||
let!(:accompagnateur_1) { create :gestionnaire, email: 'plop@plop.com', administrateurs: [admin] }
|
||||
let!(:accompagnateur_2) { create :gestionnaire, email: 'plip@plop.com', administrateurs: [admin] }
|
||||
|
||||
before do
|
||||
not_assign_gestionnaires.reload
|
||||
assign_gestionnaires.reload
|
||||
|
||||
assign(:accompagnateurs_assign, (smart_listing_create :accompagnateurs_assign,
|
||||
assign_gestionnaires,
|
||||
partial: "admin/accompagnateurs/list_assign",
|
||||
array: true))
|
||||
|
||||
assign(:accompagnateurs_not_assign, (smart_listing_create :accompagnateurs_not_assign,
|
||||
not_assign_gestionnaires,
|
||||
partial: "admin/accompagnateurs/list_not_assign",
|
||||
array: true))
|
||||
|
||||
render
|
||||
end
|
||||
|
||||
it { expect(rendered).to have_content(accompagnateur_1.email) }
|
||||
it { expect(rendered).to have_content(accompagnateur_2.email) }
|
||||
end
|
||||
end
|
|
@ -16,10 +16,10 @@ describe 'admin/gestionnaires/index.html.haml', type: :view do
|
|||
before do
|
||||
render
|
||||
end
|
||||
it { expect(rendered).to have_content('Aucun accompagnateur') }
|
||||
it { expect(rendered).to have_content('Aucun instructeur') }
|
||||
end
|
||||
|
||||
context 'Ajout d\'un accompagnateur' do
|
||||
context 'Ajout d\'un instructeur' do
|
||||
before do
|
||||
create(:gestionnaire, administrateurs: [admin])
|
||||
admin.reload
|
||||
|
|
61
spec/views/admin/instructeurs/show.html.haml_spec.rb
Normal file
61
spec/views/admin/instructeurs/show.html.haml_spec.rb
Normal file
|
@ -0,0 +1,61 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'admin/instructeurs/show.html.haml', type: :view do
|
||||
let(:admin) { create(:administrateur) }
|
||||
let(:procedure) { create :procedure, administrateur: admin }
|
||||
|
||||
let(:assign_gestionnaires) { procedure.gestionnaires }
|
||||
let(:not_assign_gestionnaires) { admin.gestionnaires.where.not(id: assign_gestionnaires.ids) }
|
||||
|
||||
before do
|
||||
assign(:procedure, procedure)
|
||||
assign(:gestionnaire, Gestionnaire.new)
|
||||
|
||||
assign(:instructeurs_assign, (smart_listing_create :instructeurs_assign,
|
||||
assign_gestionnaires,
|
||||
partial: "admin/instructeurs/list_assign",
|
||||
array: true))
|
||||
|
||||
assign(:instructeurs_not_assign, (smart_listing_create :instructeurs_not_assign,
|
||||
not_assign_gestionnaires,
|
||||
partial: "admin/instructeurs/list_not_assign",
|
||||
array: true))
|
||||
end
|
||||
|
||||
context 'when admin have none instructeur ' do
|
||||
before do
|
||||
render
|
||||
end
|
||||
|
||||
it { expect(rendered).to have_content('Aucun de disponible') }
|
||||
|
||||
context 'when administrateur have none instructeur assign' do
|
||||
it { expect(rendered).to have_content('Aucun d\'affecté') }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when administrateur have two instructeur' do
|
||||
let!(:instructeur_1) { create :gestionnaire, email: 'plop@plop.com', administrateurs: [admin] }
|
||||
let!(:instructeur_2) { create :gestionnaire, email: 'plip@plop.com', administrateurs: [admin] }
|
||||
|
||||
before do
|
||||
not_assign_gestionnaires.reload
|
||||
assign_gestionnaires.reload
|
||||
|
||||
assign(:instructeurs_assign, (smart_listing_create :instructeurs_assign,
|
||||
assign_gestionnaires,
|
||||
partial: "admin/instructeurs/list_assign",
|
||||
array: true))
|
||||
|
||||
assign(:instructeurs_not_assign, (smart_listing_create :instructeurs_not_assign,
|
||||
not_assign_gestionnaires,
|
||||
partial: "admin/instructeurs/list_not_assign",
|
||||
array: true))
|
||||
|
||||
render
|
||||
end
|
||||
|
||||
it { expect(rendered).to have_content(instructeur_1.email) }
|
||||
it { expect(rendered).to have_content(instructeur_2.email) }
|
||||
end
|
||||
end
|
|
@ -22,6 +22,6 @@ describe 'new_gestionnaire/dossiers/envoyer_dossier_block.html.haml', type: :vie
|
|||
|
||||
it { is_expected.not_to have_css("select") }
|
||||
it { is_expected.not_to have_css(".button.send") }
|
||||
it { is_expected.to have_content("Vous êtes le seul accompagnateur assigné sur cette procédure") }
|
||||
it { is_expected.to have_content("Vous êtes le seul instructeur assigné sur cette procédure") }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue