diff --git a/app/controllers/admin/assigns_controller.rb b/app/controllers/admin/assigns_controller.rb index 3c5e07d2f..c295076af 100644 --- a/app/controllers/admin/assigns_controller.rb +++ b/app/controllers/admin/assigns_controller.rb @@ -8,14 +8,14 @@ class Admin::AssignsController < AdminController NOT_ASSIGN = 'not_assign' def show - assign_scope = @procedure.gestionnaires + assign_scope = @procedure.instructeurs @instructeurs_assign = smart_listing_create :instructeurs_assign, assign_scope, partial: "admin/assigns/list_assign", array: true - not_assign_scope = current_administrateur.gestionnaires.where.not(id: assign_scope.ids) + not_assign_scope = current_administrateur.instructeurs.where.not(id: assign_scope.ids) if params[:filter] not_assign_scope = not_assign_scope.where("email LIKE ?", "%#{params[:filter]}%") @@ -26,23 +26,23 @@ class Admin::AssignsController < AdminController partial: "admin/assigns/list_not_assign", array: true - @gestionnaire ||= Gestionnaire.new + @instructeur ||= Instructeur.new end def update - gestionnaire = Gestionnaire.find(params[:instructeur_id]) + instructeur = Instructeur.find(params[:instructeur_id]) procedure = Procedure.find(params[:procedure_id]) to = params[:to] case to when ASSIGN - if gestionnaire.assign_to_procedure(procedure) + if instructeur.assign_to_procedure(procedure) flash.notice = "L'instructeur a bien été affecté" else flash.alert = "L'instructeur a déjà été affecté" end when NOT_ASSIGN - if gestionnaire.remove_from_procedure(procedure) + if instructeur.remove_from_procedure(procedure) flash.notice = "L'instructeur a bien été désaffecté" else flash.alert = "L'instructeur a déjà été désaffecté" diff --git a/app/controllers/admin/instructeurs_controller.rb b/app/controllers/admin/instructeurs_controller.rb index db392b891..78f661a10 100644 --- a/app/controllers/admin/instructeurs_controller.rb +++ b/app/controllers/admin/instructeurs_controller.rb @@ -1,70 +1,70 @@ -class Admin::GestionnairesController < AdminController +class Admin::InstructeursController < AdminController include SmartListing::Helper::ControllerExtensions helper SmartListing::Helper def index - @gestionnaires = smart_listing_create :gestionnaires, - current_administrateur.gestionnaires, - partial: "admin/gestionnaires/list", + @instructeurs = smart_listing_create :instructeurs, + current_administrateur.instructeurs, + partial: "admin/instructeurs/list", array: true - @gestionnaire ||= Gestionnaire.new + @instructeur ||= Instructeur.new end def create - email = params[:gestionnaire][:email].downcase - @gestionnaire = Gestionnaire.find_by(email: email) + email = params[:instructeur][:email].downcase + @instructeur = Instructeur.find_by(email: email) procedure_id = params[:procedure_id] - if @gestionnaire.nil? - invite_gestionnaire(params[:gestionnaire][:email]) + if @instructeur.nil? + invite_instructeur(params[:instructeur][:email]) else - assign_gestionnaire! + assign_instructeur! end if procedure_id.present? redirect_to admin_procedure_assigns_path(procedure_id: procedure_id) else - redirect_to admin_gestionnaires_path + redirect_to admin_instructeurs_path end end def destroy - Gestionnaire.find(params[:id]).administrateurs.delete current_administrateur - redirect_to admin_gestionnaires_path + Instructeur.find(params[:id]).administrateurs.delete current_administrateur + redirect_to admin_instructeurs_path end private - def invite_gestionnaire(email) + def invite_instructeur(email) password = SecureRandom.hex - @gestionnaire = Gestionnaire.create( + @instructeur = Instructeur.create( email: email, password: password, password_confirmation: password, administrateurs: [current_administrateur] ) - if @gestionnaire.errors.messages.empty? - @gestionnaire.invite! + if @instructeur.errors.messages.empty? + @instructeur.invite! - if User.exists?(email: @gestionnaire.email) - GestionnaireMailer.user_to_gestionnaire(@gestionnaire.email).deliver_later + if User.exists?(email: @instructeur.email) + InstructeurMailer.user_to_instructeur(@instructeur.email).deliver_later else User.create(email: email, password: password, confirmed_at: Time.zone.now) end flash.notice = 'Instructeur ajouté' else - flash.alert = @gestionnaire.errors.full_messages + flash.alert = @instructeur.errors.full_messages end end - def assign_gestionnaire! - if current_administrateur.gestionnaires.include?(@gestionnaire) + def assign_instructeur! + if current_administrateur.instructeurs.include?(@instructeur) flash.alert = 'Instructeur déjà ajouté' else - @gestionnaire.administrateurs.push current_administrateur + @instructeur.administrateurs.push current_administrateur flash.notice = 'Instructeur ajouté' # TODO Mailer no assign_to end diff --git a/app/controllers/admin/procedures_controller.rb b/app/controllers/admin/procedures_controller.rb index ff3024464..8bfac1c06 100644 --- a/app/controllers/admin/procedures_controller.rb +++ b/app/controllers/admin/procedures_controller.rb @@ -76,9 +76,9 @@ class Admin::ProceduresController < AdminController render 'new' else flash.notice = 'Démarche enregistrée.' - gestionnaire = Gestionnaire.find_by(email: current_administrateur.email) - if gestionnaire - gestionnaire.assign_to_procedure(@procedure) + instructeur = Instructeur.find_by(email: current_administrateur.email) + if instructeur + instructeur.assign_to_procedure(@procedure) end redirect_to champs_procedure_path(@procedure) diff --git a/app/controllers/administrateurs/activate_controller.rb b/app/controllers/administrateurs/activate_controller.rb index adb517519..9d616b668 100644 --- a/app/controllers/administrateurs/activate_controller.rb +++ b/app/controllers/administrateurs/activate_controller.rb @@ -24,7 +24,7 @@ class Administrateurs::ActivateController < ApplicationController if administrateur && administrateur.errors.empty? sign_in(administrateur, scope: :administrateur) try_to_authenticate(User, administrateur.email, password) - try_to_authenticate(Gestionnaire, administrateur.email, password) + try_to_authenticate(Instructeur, administrateur.email, password) flash.notice = "Mot de passe enregistré" redirect_to admin_procedures_path else diff --git a/app/controllers/administrateurs/passwords_controller.rb b/app/controllers/administrateurs/passwords_controller.rb index a0942c343..4e8bd4106 100644 --- a/app/controllers/administrateurs/passwords_controller.rb +++ b/app/controllers/administrateurs/passwords_controller.rb @@ -1,6 +1,6 @@ class Administrateurs::PasswordsController < Devise::PasswordsController after_action :try_to_authenticate_user, only: [:update] - after_action :try_to_authenticate_gestionnaire, only: [:update] + after_action :try_to_authenticate_instructeur, only: [:update] # GET /resource/password/new # def new @@ -44,12 +44,12 @@ class Administrateurs::PasswordsController < Devise::PasswordsController end end - def try_to_authenticate_gestionnaire + def try_to_authenticate_instructeur if administrateur_signed_in? - gestionnaire = Gestionnaire.find_by(email: current_administrateur.email) + instructeur = Instructeur.find_by(email: current_administrateur.email) - if gestionnaire - sign_in gestionnaire + if instructeur + sign_in instructeur end end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 702cb9acb..b5c955cbb 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -47,7 +47,7 @@ class ApplicationController < ActionController::Base def pundit_user { administrateur: current_administrateur, - gestionnaire: current_gestionnaire, + instructeur: current_instructeur, user: current_user }.compact end @@ -55,8 +55,8 @@ class ApplicationController < ActionController::Base protected def authenticate_logged_user! - if gestionnaire_signed_in? - authenticate_gestionnaire! + if instructeur_signed_in? + authenticate_instructeur! elsif administrateur_signed_in? authenticate_administrateur! else @@ -64,8 +64,8 @@ class ApplicationController < ActionController::Base end end - def authenticate_gestionnaire! - if gestionnaire_signed_in? + def authenticate_instructeur! + if instructeur_signed_in? super else redirect_to new_user_session_path @@ -88,7 +88,7 @@ class ApplicationController < ActionController::Base def set_current_roles Current.administrateur = current_administrateur - Current.gestionnaire = current_gestionnaire + Current.instructeur = current_instructeur end def set_active_storage_host @@ -108,7 +108,7 @@ class ApplicationController < ActionController::Base def logged_users @logged_users ||= [ current_user, - current_gestionnaire, + current_instructeur, current_administrateur, current_administration ].compact @@ -162,14 +162,14 @@ class ApplicationController < ActionController::Base elsif api_request render json: { error: MAINTENANCE_MESSAGE }.to_json, status: :service_unavailable else - [:user, :gestionnaire, :administrateur].each { |role| sign_out(role) } + [:user, :instructeur, :administrateur].each { |role| sign_out(role) } flash[:alert] = MAINTENANCE_MESSAGE redirect_to root_path end end def redirect_if_untrusted - if gestionnaire_signed_in? && + if instructeur_signed_in? && sensitive_path && Flipflop.enable_email_login_token? && !IPService.ip_trusted?(request.headers['X-Forwarded-For']) && @@ -179,8 +179,8 @@ class ApplicationController < ActionController::Base # after the device is trusted store_location_for(:user, request.fullpath) - send_login_token_or_bufferize(current_gestionnaire) - redirect_to link_sent_path(email: current_gestionnaire.email) + send_login_token_or_bufferize(current_instructeur) + redirect_to link_sent_path(email: current_instructeur.email) end end @@ -238,7 +238,7 @@ class ApplicationController < ActionController::Base DS_CREATED_AT: current_administrateur&.created_at, DS_ACTIVE: current_administrateur&.active, DS_ID: current_administrateur&.id, - DS_GESTIONNAIRE_ID: current_gestionnaire&.id, + DS_GESTIONNAIRE_ID: current_instructeur&.id, DS_ROLES: logged_user_roles } } @@ -266,7 +266,7 @@ class ApplicationController < ActionController::Base def current_email current_user&.email || - current_gestionnaire&.email || + current_instructeur&.email || current_administrateur&.email end end diff --git a/app/controllers/concerns/create_avis_concern.rb b/app/controllers/concerns/create_avis_concern.rb index 7f9514509..6f583c552 100644 --- a/app/controllers/concerns/create_avis_concern.rb +++ b/app/controllers/concerns/create_avis_concern.rb @@ -17,7 +17,7 @@ module CreateAvisConcern { email: email, introduction: create_avis_params[:introduction], - claimant: current_gestionnaire, + claimant: current_instructeur, dossier: dossier, confidentiel: confidentiel } diff --git a/app/controllers/france_connect/particulier_controller.rb b/app/controllers/france_connect/particulier_controller.rb index 49f97f180..c841ae8bf 100644 --- a/app/controllers/france_connect/particulier_controller.rb +++ b/app/controllers/france_connect/particulier_controller.rb @@ -40,8 +40,8 @@ class FranceConnect::ParticulierController < ApplicationController sign_out :user end - if gestionnaire_signed_in? - sign_out :gestionnaire + if instructeur_signed_in? + sign_out :instructeur end if administrateur_signed_in? diff --git a/app/controllers/instructeurs/activate_controller.rb b/app/controllers/instructeurs/activate_controller.rb index e9c141ad6..332729828 100644 --- a/app/controllers/instructeurs/activate_controller.rb +++ b/app/controllers/instructeurs/activate_controller.rb @@ -1,11 +1,11 @@ -class Gestionnaires::ActivateController < ApplicationController +class Instructeurs::ActivateController < ApplicationController include TrustedDeviceConcern def new - @gestionnaire = Gestionnaire.with_reset_password_token(params[:token]) + @instructeur = Instructeur.with_reset_password_token(params[:token]) - if @gestionnaire - # the gestionnaire activates its account from an email + if @instructeur + # the instructeur activates its account from an email trust_device(Time.zone.now) else flash.alert = "Le lien de validation du compte instructeur a expiré, #{helpers.contact_link('contactez-nous', tags: 'lien expiré')} pour obtenir un nouveau lien." @@ -14,29 +14,29 @@ class Gestionnaires::ActivateController < ApplicationController end def create - password = create_gestionnaire_params[:password] - gestionnaire = Gestionnaire.reset_password_by_token({ + password = create_instructeur_params[:password] + instructeur = Instructeur.reset_password_by_token({ password: password, password_confirmation: password, - reset_password_token: create_gestionnaire_params[:reset_password_token] + reset_password_token: create_instructeur_params[:reset_password_token] }) - if gestionnaire && gestionnaire.errors.empty? - sign_in(gestionnaire, scope: :gestionnaire) - try_to_authenticate(User, gestionnaire.email, password) - try_to_authenticate(Administrateur, gestionnaire.email, password) + if instructeur && instructeur.errors.empty? + sign_in(instructeur, scope: :instructeur) + try_to_authenticate(User, instructeur.email, password) + try_to_authenticate(Administrateur, instructeur.email, password) flash.notice = "Mot de passe enregistré" - redirect_to gestionnaire_procedures_path + redirect_to instructeur_procedures_path else - flash.alert = gestionnaire.errors.full_messages - redirect_to gestionnaire_activate_path(token: create_gestionnaire_params[:reset_password_token]) + flash.alert = instructeur.errors.full_messages + redirect_to instructeur_activate_path(token: create_instructeur_params[:reset_password_token]) end end private - def create_gestionnaire_params - params.require(:gestionnaire).permit(:reset_password_token, :password) + def create_instructeur_params + params.require(:instructeur).permit(:reset_password_token, :password) end def try_to_authenticate(klass, email, password) diff --git a/app/controllers/instructeurs/avis_controller.rb b/app/controllers/instructeurs/avis_controller.rb index 167ea9fb2..5beda25c7 100644 --- a/app/controllers/instructeurs/avis_controller.rb +++ b/app/controllers/instructeurs/avis_controller.rb @@ -1,19 +1,19 @@ -module Gestionnaires - class AvisController < GestionnaireController +module Instructeurs + class AvisController < InstructeurController include CreateAvisConcern - before_action :authenticate_gestionnaire!, except: [:sign_up, :create_gestionnaire] + before_action :authenticate_instructeur!, except: [:sign_up, :create_instructeur] before_action :redirect_if_no_sign_up_needed, only: [:sign_up] - before_action :check_avis_exists_and_email_belongs_to_avis, only: [:sign_up, :create_gestionnaire] + before_action :check_avis_exists_and_email_belongs_to_avis, only: [:sign_up, :create_instructeur] before_action :set_avis_and_dossier, only: [:show, :instruction, :messagerie, :create_commentaire, :update] A_DONNER_STATUS = 'a-donner' DONNES_STATUS = 'donnes' def index - gestionnaire_avis = current_gestionnaire.avis.includes(dossier: [:procedure, :user]) - @avis_a_donner = gestionnaire_avis.without_answer - @avis_donnes = gestionnaire_avis.with_answer + instructeur_avis = current_instructeur.avis.includes(dossier: [:procedure, :user]) + @avis_a_donner = instructeur_avis.without_answer + @avis_donnes = instructeur_avis.with_answer @statut = params[:statut].presence || A_DONNER_STATUS @@ -37,7 +37,7 @@ module Gestionnaires def update if @avis.update(avis_params) flash.notice = 'Votre réponse est enregistrée.' - redirect_to instruction_gestionnaire_avis_path(@avis) + redirect_to instruction_instructeur_avis_path(@avis) else flash.now.alert = @avis.errors.full_messages @new_avis = Avis.new @@ -50,11 +50,11 @@ module Gestionnaires end def create_commentaire - @commentaire = CommentaireService.build(current_gestionnaire, avis.dossier, commentaire_params) + @commentaire = CommentaireService.build(current_instructeur, avis.dossier, commentaire_params) if @commentaire.save flash.notice = "Message envoyé" - redirect_to messagerie_gestionnaire_avis_path(avis) + redirect_to messagerie_instructeur_avis_path(avis) else flash.alert = @commentaire.errors.full_messages render :messagerie @@ -65,7 +65,7 @@ module Gestionnaires @new_avis = create_avis_from_params(avis.dossier, avis.confidentiel) if @new_avis.nil? - redirect_to instruction_gestionnaire_avis_path(avis) + redirect_to instruction_instructeur_avis_path(avis) else set_avis_and_dossier render :instruction @@ -79,26 +79,26 @@ module Gestionnaires render end - def create_gestionnaire + def create_instructeur email = params[:email] - password = params['gestionnaire']['password'] + password = params['instructeur']['password'] - gestionnaire = Gestionnaire.new(email: email, password: password) + instructeur = Instructeur.new(email: email, password: password) - if gestionnaire.save + if instructeur.save user = User.find_by(email: email) if user.blank? user = User.create(email: email, password: password, confirmed_at: Time.zone.now) end sign_in(user) - sign_in(gestionnaire, scope: :gestionnaire) + sign_in(instructeur, scope: :instructeur) - Avis.link_avis_to_gestionnaire(gestionnaire) - redirect_to url_for(gestionnaire_avis_index_path) + Avis.link_avis_to_instructeur(instructeur) + redirect_to url_for(instructeur_avis_index_path) else - flash[:alert] = gestionnaire.errors.full_messages - redirect_to url_for(sign_up_gestionnaire_avis_path(params[:id], email)) + flash[:alert] = instructeur.errors.full_messages + redirect_to url_for(sign_up_instructeur_avis_path(params[:id], email)) end end @@ -112,14 +112,14 @@ module Gestionnaires def redirect_if_no_sign_up_needed avis = Avis.find(params[:id]) - if current_gestionnaire.present? - # a gestionnaire is authenticated ... lets see if it can view the dossier + if current_instructeur.present? + # a instructeur is authenticated ... lets see if it can view the dossier - redirect_to gestionnaire_avis_url(avis) - elsif avis.gestionnaire&.email == params[:email] - # the avis gestionnaire has already signed up and it sould sign in + redirect_to instructeur_avis_url(avis) + elsif avis.instructeur&.email == params[:email] + # the avis instructeur has already signed up and it sould sign in - redirect_to new_gestionnaire_session_url + redirect_to new_instructeur_session_url end end @@ -130,7 +130,7 @@ module Gestionnaires end def avis - current_gestionnaire.avis.includes(dossier: [:avis, :commentaires]).find(params[:id]) + current_instructeur.avis.includes(dossier: [:avis, :commentaires]).find(params[:id]) end def avis_params diff --git a/app/controllers/instructeurs/dossiers_controller.rb b/app/controllers/instructeurs/dossiers_controller.rb index a830229a4..ea07397db 100644 --- a/app/controllers/instructeurs/dossiers_controller.rb +++ b/app/controllers/instructeurs/dossiers_controller.rb @@ -1,4 +1,4 @@ -module Gestionnaires +module Instructeurs class DossiersController < ProceduresController include ActionView::Helpers::NumberHelper include ActionView::Helpers::TextHelper @@ -22,72 +22,72 @@ module Gestionnaires end def show - @demande_seen_at = current_gestionnaire.follows.find_by(dossier: dossier)&.demande_seen_at + @demande_seen_at = current_instructeur.follows.find_by(dossier: dossier)&.demande_seen_at end def messagerie @commentaire = Commentaire.new - @messagerie_seen_at = current_gestionnaire.follows.find_by(dossier: dossier)&.messagerie_seen_at + @messagerie_seen_at = current_instructeur.follows.find_by(dossier: dossier)&.messagerie_seen_at end def annotations_privees - @annotations_privees_seen_at = current_gestionnaire.follows.find_by(dossier: dossier)&.annotations_privees_seen_at + @annotations_privees_seen_at = current_instructeur.follows.find_by(dossier: dossier)&.annotations_privees_seen_at end def avis - @avis_seen_at = current_gestionnaire.follows.find_by(dossier: dossier)&.avis_seen_at + @avis_seen_at = current_instructeur.follows.find_by(dossier: dossier)&.avis_seen_at @avis = Avis.new end def personnes_impliquees - @following_instructeurs_emails = dossier.followers_gestionnaires.pluck(:email) - previous_followers = dossier.previous_followers_gestionnaires - dossier.followers_gestionnaires + @following_instructeurs_emails = dossier.followers_instructeurs.pluck(:email) + previous_followers = dossier.previous_followers_instructeurs - dossier.followers_instructeurs @previous_following_instructeurs_emails = previous_followers.pluck(:email) - @avis_emails = dossier.avis.includes(:gestionnaire).map(&:email_to_display) + @avis_emails = dossier.avis.includes(:instructeur).map(&:email_to_display) @invites_emails = dossier.invites.map(&:email) - @potential_recipients = procedure.gestionnaires.reject { |g| g == current_gestionnaire } + @potential_recipients = procedure.instructeurs.reject { |g| g == current_instructeur } end def send_to_instructeurs - recipients = Gestionnaire.find(params[:recipients]) + recipients = Instructeur.find(params[:recipients]) recipients.each do |recipient| - GestionnaireMailer.send_dossier(current_gestionnaire, dossier, recipient).deliver_later + InstructeurMailer.send_dossier(current_instructeur, dossier, recipient).deliver_later end flash.notice = "Dossier envoyé" - redirect_to(personnes_impliquees_gestionnaire_dossier_path(procedure, dossier)) + redirect_to(personnes_impliquees_instructeur_dossier_path(procedure, dossier)) end def follow - current_gestionnaire.follow(dossier) + current_instructeur.follow(dossier) flash.notice = 'Dossier suivi' - redirect_back(fallback_location: gestionnaire_procedures_url) + redirect_back(fallback_location: instructeur_procedures_url) end def unfollow - current_gestionnaire.unfollow(dossier) + current_instructeur.unfollow(dossier) flash.notice = "Vous ne suivez plus le dossier nº #{dossier.id}" - redirect_back(fallback_location: gestionnaire_procedures_url) + redirect_back(fallback_location: instructeur_procedures_url) end def archive dossier.update(archived: true) - current_gestionnaire.unfollow(dossier) - redirect_back(fallback_location: gestionnaire_procedures_url) + current_instructeur.unfollow(dossier) + redirect_back(fallback_location: instructeur_procedures_url) end def unarchive dossier.update(archived: false) - redirect_back(fallback_location: gestionnaire_procedures_url) + redirect_back(fallback_location: instructeur_procedures_url) end def passer_en_instruction if dossier.en_instruction? flash.notice = 'Le dossier est déjà en instruction.' else - dossier.passer_en_instruction!(current_gestionnaire) + dossier.passer_en_instruction!(current_instructeur) flash.notice = 'Dossier passé en instruction.' end @@ -98,7 +98,7 @@ module Gestionnaires if dossier.en_construction? flash.notice = 'Le dossier est déjà en construction.' else - dossier.repasser_en_construction!(current_gestionnaire) + dossier.repasser_en_construction!(current_instructeur) flash.notice = 'Dossier repassé en construction.' end @@ -113,7 +113,7 @@ module Gestionnaires flash.notice = 'Il n’est pas possible de repasser un dossier accepté en instruction.' else flash.notice = "Le dossier #{dossier.id} a été repassé en instruction." - dossier.repasser_en_instruction!(current_gestionnaire) + dossier.repasser_en_instruction!(current_instructeur) end end @@ -129,13 +129,13 @@ module Gestionnaires else case params[:process_action] when "refuser" - dossier.refuser!(current_gestionnaire, motivation, justificatif) + dossier.refuser!(current_instructeur, motivation, justificatif) flash.notice = "Dossier considéré comme refusé." when "classer_sans_suite" - dossier.classer_sans_suite!(current_gestionnaire, motivation, justificatif) + dossier.classer_sans_suite!(current_instructeur, motivation, justificatif) flash.notice = "Dossier considéré comme sans suite." when "accepter" - dossier.accepter!(current_gestionnaire, motivation, justificatif) + dossier.accepter!(current_instructeur, motivation, justificatif) flash.notice = "Dossier traité avec succès." end end @@ -144,12 +144,12 @@ module Gestionnaires end def create_commentaire - @commentaire = CommentaireService.build(current_gestionnaire, dossier, commentaire_params) + @commentaire = CommentaireService.build(current_instructeur, dossier, commentaire_params) if @commentaire.save - current_gestionnaire.follow(dossier) + current_instructeur.follow(dossier) flash.notice = "Message envoyé" - redirect_to messagerie_gestionnaire_dossier_path(procedure, dossier) + redirect_to messagerie_instructeur_dossier_path(procedure, dossier) else flash.alert = @commentaire.errors.full_messages render :messagerie @@ -160,18 +160,18 @@ module Gestionnaires @avis = create_avis_from_params(dossier) if @avis.nil? - redirect_to avis_gestionnaire_dossier_path(procedure, dossier) + redirect_to avis_instructeur_dossier_path(procedure, dossier) else - @avis_seen_at = current_gestionnaire.follows.find_by(dossier: dossier)&.avis_seen_at + @avis_seen_at = current_instructeur.follows.find_by(dossier: dossier)&.avis_seen_at render :avis end end def update_annotations - dossier = current_gestionnaire.dossiers.includes(champs_private: :type_de_champ).find(params[:dossier_id]) + dossier = current_instructeur.dossiers.includes(champs_private: :type_de_champ).find(params[:dossier_id]) dossier.update(champs_private_params) - dossier.modifier_annotations!(current_gestionnaire) - redirect_to annotations_privees_gestionnaire_dossier_path(procedure, dossier) + dossier.modifier_annotations!(current_instructeur) + redirect_to annotations_privees_instructeur_dossier_path(procedure, dossier) end def print @@ -190,7 +190,7 @@ module Gestionnaires private def dossier - @dossier ||= current_gestionnaire.dossiers.find(params[:dossier_id]) + @dossier ||= current_instructeur.dossiers.find(params[:dossier_id]) end def commentaire_params @@ -205,19 +205,19 @@ module Gestionnaires end def mark_demande_as_read - current_gestionnaire.mark_tab_as_seen(dossier, :demande) + current_instructeur.mark_tab_as_seen(dossier, :demande) end def mark_messagerie_as_read - current_gestionnaire.mark_tab_as_seen(dossier, :messagerie) + current_instructeur.mark_tab_as_seen(dossier, :messagerie) end def mark_avis_as_read - current_gestionnaire.mark_tab_as_seen(dossier, :avis) + current_instructeur.mark_tab_as_seen(dossier, :avis) end def mark_annotations_privees_as_read - current_gestionnaire.mark_tab_as_seen(dossier, :annotations_privees) + current_instructeur.mark_tab_as_seen(dossier, :annotations_privees) end end end diff --git a/app/controllers/instructeurs/instructeur_controller.rb b/app/controllers/instructeurs/instructeur_controller.rb index c9026553d..ac563200d 100644 --- a/app/controllers/instructeurs/instructeur_controller.rb +++ b/app/controllers/instructeurs/instructeur_controller.rb @@ -1,9 +1,9 @@ -module Gestionnaires - class GestionnaireController < ApplicationController - before_action :authenticate_gestionnaire! +module Instructeurs + class InstructeurController < ApplicationController + before_action :authenticate_instructeur! def nav_bar_profile - :gestionnaire + :instructeur end end end diff --git a/app/controllers/instructeurs/passwords_controller.rb b/app/controllers/instructeurs/passwords_controller.rb index 44049eebc..1c189f1ea 100644 --- a/app/controllers/instructeurs/passwords_controller.rb +++ b/app/controllers/instructeurs/passwords_controller.rb @@ -1,4 +1,4 @@ -class Gestionnaires::PasswordsController < Devise::PasswordsController +class Instructeurs::PasswordsController < Devise::PasswordsController after_action :try_to_authenticate_user, only: [:update] after_action :try_to_authenticate_administrateur, only: [:update] @@ -34,8 +34,8 @@ class Gestionnaires::PasswordsController < Devise::PasswordsController # end def try_to_authenticate_user - if gestionnaire_signed_in? - user = User.find_by(email: current_gestionnaire.email) + if instructeur_signed_in? + user = User.find_by(email: current_instructeur.email) if user sign_in user @@ -44,8 +44,8 @@ class Gestionnaires::PasswordsController < Devise::PasswordsController end def try_to_authenticate_administrateur - if gestionnaire_signed_in? - administrateur = Administrateur.find_by(email: current_gestionnaire.email) + if instructeur_signed_in? + administrateur = Administrateur.find_by(email: current_instructeur.email) if administrateur sign_in administrateur diff --git a/app/controllers/instructeurs/procedures_controller.rb b/app/controllers/instructeurs/procedures_controller.rb index ac2c3cc19..71624ab2e 100644 --- a/app/controllers/instructeurs/procedures_controller.rb +++ b/app/controllers/instructeurs/procedures_controller.rb @@ -1,20 +1,20 @@ -module Gestionnaires - class ProceduresController < GestionnaireController +module Instructeurs + class ProceduresController < InstructeurController before_action :ensure_ownership!, except: [:index] before_action :redirect_to_avis_if_needed, only: [:index] ITEMS_PER_PAGE = 25 def index - @procedures = current_gestionnaire.visible_procedures.order(archived_at: :desc, published_at: :desc, created_at: :desc) + @procedures = current_instructeur.visible_procedures.order(archived_at: :desc, published_at: :desc, created_at: :desc) - dossiers = current_gestionnaire.dossiers + dossiers = current_instructeur.dossiers @dossiers_count_per_procedure = dossiers.all_state.group(:procedure_id).reorder(nil).count @dossiers_a_suivre_count_per_procedure = dossiers.without_followers.en_cours.group(:procedure_id).reorder(nil).count @dossiers_archived_count_per_procedure = dossiers.archived.group(:procedure_id).count @dossiers_termines_count_per_procedure = dossiers.termine.group(:procedure_id).reorder(nil).count - @followed_dossiers_count_per_procedure = current_gestionnaire + @followed_dossiers_count_per_procedure = current_instructeur .followed_dossiers .en_cours .where(procedure: @procedures) @@ -39,13 +39,13 @@ module Gestionnaires .without_followers .en_cours - @followed_dossiers = current_gestionnaire + @followed_dossiers = current_instructeur .followed_dossiers .includes(:user) .where(procedure: @procedure) .en_cours - @followed_dossiers_id = current_gestionnaire + @followed_dossiers_id = current_instructeur .followed_dossiers .where(procedure: @procedure) .pluck(:id) @@ -69,7 +69,7 @@ module Gestionnaires @archived_dossiers end - sorted_ids = procedure_presentation.sorted_ids(@dossiers, current_gestionnaire) + sorted_ids = procedure_presentation.sorted_ids(@dossiers, current_instructeur) if @current_filters.count > 0 filtered_ids = procedure_presentation.filtered_ids(@dossiers, statut) @@ -112,7 +112,7 @@ module Gestionnaires procedure_presentation.update(sort: Procedure.default_sort) end - redirect_back(fallback_location: gestionnaire_procedure_url(procedure)) + redirect_back(fallback_location: instructeur_procedure_url(procedure)) end def update_sort @@ -134,7 +134,7 @@ module Gestionnaires procedure_presentation.update(sort: sort) - redirect_back(fallback_location: gestionnaire_procedure_url(procedure)) + redirect_back(fallback_location: instructeur_procedure_url(procedure)) end def add_filter @@ -153,7 +153,7 @@ module Gestionnaires procedure_presentation.update(filters: filters) end - redirect_back(fallback_location: gestionnaire_procedure_url(procedure)) + redirect_back(fallback_location: instructeur_procedure_url(procedure)) end def remove_filter @@ -164,7 +164,7 @@ module Gestionnaires procedure_presentation.update(filters: filters) - redirect_back(fallback_location: gestionnaire_procedure_url(procedure)) + redirect_back(fallback_location: instructeur_procedure_url(procedure)) end def download_dossiers @@ -195,7 +195,7 @@ module Gestionnaires assign_to.update!(email_notifications_enabled: params[:assign_to][:email_notifications_enabled]) flash.notice = 'Vos notifications sont enregistrées.' - redirect_to gestionnaire_procedure_path(procedure) + redirect_to instructeur_procedure_path(procedure) end private @@ -209,7 +209,7 @@ module Gestionnaires end def assign_to - current_gestionnaire.assign_to.find_by(procedure: procedure) + current_instructeur.assign_to.find_by(procedure: procedure) end def statut @@ -221,15 +221,15 @@ module Gestionnaires end def ensure_ownership! - if !procedure.gestionnaires.include?(current_gestionnaire) + if !procedure.instructeurs.include?(current_instructeur) flash[:alert] = "Vous n'avez pas accès à cette démarche" redirect_to root_path end end def redirect_to_avis_if_needed - if current_gestionnaire.visible_procedures.count == 0 && current_gestionnaire.avis.count > 0 - redirect_to gestionnaire_avis_index_path + if current_instructeur.visible_procedures.count == 0 && current_instructeur.avis.count > 0 + redirect_to instructeur_avis_index_path end end @@ -238,7 +238,7 @@ module Gestionnaires end def get_procedure_presentation - procedure_presentation, errors = current_gestionnaire.procedure_presentation_and_errors_for_procedure_id(params[:procedure_id]) + procedure_presentation, errors = current_instructeur.procedure_presentation_and_errors_for_procedure_id(params[:procedure_id]) if errors.present? flash[:alert] = "Votre affichage a dû être réinitialisé en raison du problème suivant : " + errors.full_messages.join(', ') end diff --git a/app/controllers/instructeurs/recherche_controller.rb b/app/controllers/instructeurs/recherche_controller.rb index b3c921f66..8d14ce2f8 100644 --- a/app/controllers/instructeurs/recherche_controller.rb +++ b/app/controllers/instructeurs/recherche_controller.rb @@ -1,9 +1,9 @@ -module Gestionnaires - class RechercheController < GestionnaireController +module Instructeurs + class RechercheController < InstructeurController def index @search_terms = params[:q] - @dossiers = DossierSearchService.matching_dossiers_for_gestionnaire(@search_terms, current_gestionnaire) - @followed_dossiers_id = current_gestionnaire + @dossiers = DossierSearchService.matching_dossiers_for_instructeur(@search_terms, current_instructeur) + @followed_dossiers_id = current_instructeur .followed_dossiers .where(procedure_id: @dossiers.pluck(:procedure_id)) .pluck(:id) diff --git a/app/controllers/instructeurs/sessions_controller.rb b/app/controllers/instructeurs/sessions_controller.rb index d098d4058..d069201de 100644 --- a/app/controllers/instructeurs/sessions_controller.rb +++ b/app/controllers/instructeurs/sessions_controller.rb @@ -1,4 +1,4 @@ -class Gestionnaires::SessionsController < Sessions::SessionsController +class Instructeurs::SessionsController < Sessions::SessionsController def new redirect_to new_user_session_path end diff --git a/app/controllers/manager/instructeurs_controller.rb b/app/controllers/manager/instructeurs_controller.rb index 0b83d772e..44b85e5a3 100644 --- a/app/controllers/manager/instructeurs_controller.rb +++ b/app/controllers/manager/instructeurs_controller.rb @@ -1,20 +1,20 @@ module Manager - class GestionnairesController < Manager::ApplicationController + class InstructeursController < Manager::ApplicationController def reinvite - gestionnaire = Gestionnaire.find(params[:id]) - gestionnaire.invite! + instructeur = Instructeur.find(params[:id]) + instructeur.invite! flash[:notice] = "Instructeur réinvité." - redirect_to manager_gestionnaire_path(gestionnaire) + redirect_to manager_instructeur_path(instructeur) end def enable_feature - gestionnaire = Gestionnaire.find(params[:id]) + instructeur = Instructeur.find(params[:id]) params[:features].each do |key, enable| if enable - gestionnaire.enable_feature(key.to_sym) + instructeur.enable_feature(key.to_sym) else - gestionnaire.disable_feature(key.to_sym) + instructeur.disable_feature(key.to_sym) end end diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb index 0137dbfb2..78661a349 100644 --- a/app/controllers/root_controller.rb +++ b/app/controllers/root_controller.rb @@ -2,8 +2,8 @@ class RootController < ApplicationController def index if administrateur_signed_in? return redirect_to admin_procedures_path - elsif gestionnaire_signed_in? - return redirect_to gestionnaire_procedures_path + elsif instructeur_signed_in? + return redirect_to instructeur_procedures_path elsif user_signed_in? return redirect_to dossiers_path elsif administration_signed_in? diff --git a/app/controllers/sessions/sessions_controller.rb b/app/controllers/sessions/sessions_controller.rb index f555f49fc..4bff2a161 100644 --- a/app/controllers/sessions/sessions_controller.rb +++ b/app/controllers/sessions/sessions_controller.rb @@ -8,8 +8,8 @@ class Sessions::SessionsController < Devise::SessionsController sign_out :user end - if gestionnaire_signed_in? - sign_out :gestionnaire + if instructeur_signed_in? + sign_out :instructeur end if administrateur_signed_in? diff --git a/app/controllers/users/passwords_controller.rb b/app/controllers/users/passwords_controller.rb index 8e2bba685..fb74a5eaa 100644 --- a/app/controllers/users/passwords_controller.rb +++ b/app/controllers/users/passwords_controller.rb @@ -1,5 +1,5 @@ class Users::PasswordsController < Devise::PasswordsController - after_action :try_to_authenticate_gestionnaire, only: [:update] + after_action :try_to_authenticate_instructeur, only: [:update] after_action :try_to_authenticate_administrateur, only: [:update] # GET /resource/password/new @@ -14,10 +14,10 @@ class Users::PasswordsController < Devise::PasswordsController if Administrateur.find_by(email: email) @devise_mapping = Devise.mappings[:administrateur] params[:administrateur] = params[:user] - # uncomment to check password complexity for Gestionnaire - # elsif Gestionnaire.find_by(email: email) - # @devise_mapping = Devise.mappings[:gestionnaire] - # params[:gestionnaire] = params[:user] + # uncomment to check password complexity for Instructeur + # elsif Instructeur.find_by(email: email) + # @devise_mapping = Devise.mappings[:instructeur] + # params[:instructeur] = params[:user] end super end @@ -44,12 +44,12 @@ class Users::PasswordsController < Devise::PasswordsController # super(resource_name) # end - def try_to_authenticate_gestionnaire + def try_to_authenticate_instructeur if user_signed_in? - gestionnaire = Gestionnaire.find_by(email: current_user.email) + instructeur = Instructeur.find_by(email: current_user.email) - if gestionnaire - sign_in gestionnaire + if instructeur + sign_in instructeur end end end diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index cb11a5045..df6e89b1a 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -17,7 +17,7 @@ class Users::SessionsController < Sessions::SessionsController remember_me = params[:user][:remember_me] == '1' if resource_locked?(try_to_authenticate(User, remember_me)) || - resource_locked?(try_to_authenticate(Gestionnaire, remember_me)) || + resource_locked?(try_to_authenticate(Instructeur, remember_me)) || resource_locked?(try_to_authenticate(Administrateur, remember_me)) flash.alert = 'Votre compte est verrouillé.' new @@ -28,7 +28,7 @@ class Users::SessionsController < Sessions::SessionsController current_user.update(loged_in_with_france_connect: nil) end - if gestionnaire_signed_in? || user_signed_in? + if instructeur_signed_in? || user_signed_in? set_flash_message :notice, :signed_in redirect_to after_sign_in_path_for(:user) else @@ -44,8 +44,8 @@ class Users::SessionsController < Sessions::SessionsController # DELETE /resource/sign_out def destroy - if gestionnaire_signed_in? - sign_out :gestionnaire + if instructeur_signed_in? + sign_out :instructeur end if administrateur_signed_in? @@ -74,8 +74,8 @@ class Users::SessionsController < Sessions::SessionsController end def sign_in_by_link - gestionnaire = Gestionnaire.find(params[:id]) - trusted_device_token = gestionnaire + instructeur = Instructeur.find(params[:id]) + trusted_device_token = instructeur .trusted_device_tokens .find_by(token: params[:jeton]) @@ -89,7 +89,7 @@ class Users::SessionsController < Sessions::SessionsController # redirect to procedure'url if stored by store_location_for(:user) in dossiers_controller # redirect to root_path otherwise - if gestionnaire_signed_in? + if instructeur_signed_in? redirect_to after_sign_in_path_for(:user) else redirect_to new_user_session_path @@ -97,8 +97,8 @@ class Users::SessionsController < Sessions::SessionsController else flash[:alert] = 'Votre lien est invalide ou expiré, un nouveau vient de vous être envoyé.' - send_login_token_or_bufferize(gestionnaire) - redirect_to link_sent_path(email: gestionnaire.email) + send_login_token_or_bufferize(instructeur) + redirect_to link_sent_path(email: instructeur.email) end end diff --git a/app/controllers/webhook_controller.rb b/app/controllers/webhook_controller.rb index 6548b68de..5fc66982f 100644 --- a/app/controllers/webhook_controller.rb +++ b/app/controllers/webhook_controller.rb @@ -4,7 +4,7 @@ class WebhookController < ActionController::Base def helpscout email = params[:customer][:email].downcase user = User.find_by(email: email) - gestionnaire = Gestionnaire.find_by(email: email) + instructeur = Instructeur.find_by(email: email) administrateur = Administrateur.find_by(email: email) html = [] @@ -13,9 +13,9 @@ class WebhookController < ActionController::Base html << link_to_manager(user, url) end - if gestionnaire - url = manager_gestionnaire_url(gestionnaire) - html << link_to_manager(gestionnaire, url) + if instructeur + url = manager_instructeur_url(instructeur) + html << link_to_manager(instructeur, url) end if administrateur diff --git a/app/dashboards/instructeur_dashboard.rb b/app/dashboards/instructeur_dashboard.rb index 2f609a677..9c3b8411b 100644 --- a/app/dashboards/instructeur_dashboard.rb +++ b/app/dashboards/instructeur_dashboard.rb @@ -1,6 +1,6 @@ require "administrate/base_dashboard" -class GestionnaireDashboard < Administrate::BaseDashboard +class InstructeurDashboard < Administrate::BaseDashboard # ATTRIBUTE_TYPES # a hash that describes the type of each of the model's fields. # @@ -48,7 +48,7 @@ class GestionnaireDashboard < Administrate::BaseDashboard # Overwrite this method to customize how users are displayed # across all pages of the admin dashboard. # - def display_resource(gestionnaire) - gestionnaire.email + def display_resource(instructeur) + instructeur.email end end diff --git a/app/dashboards/procedure_dashboard.rb b/app/dashboards/procedure_dashboard.rb index bb931b304..97967bc00 100644 --- a/app/dashboards/procedure_dashboard.rb +++ b/app/dashboards/procedure_dashboard.rb @@ -12,7 +12,7 @@ class ProcedureDashboard < Administrate::BaseDashboard types_de_champ_private: TypesDeChampCollectionField, path: ProcedureLinkField, dossiers: Field::HasMany, - gestionnaires: Field::HasMany, + instructeurs: Field::HasMany, administrateurs: Field::HasMany, id: Field::Number.with_options(searchable: true), libelle: Field::String, @@ -73,7 +73,7 @@ class ProcedureDashboard < Administrate::BaseDashboard :types_de_champ_private, :for_individual, :auto_archive_on, - :gestionnaires, + :instructeurs, :initiated_mail_template, :received_mail_template, :closed_mail_template, diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b99514ae8..0fd4c8bb2 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -86,7 +86,7 @@ module ApplicationHelper def current_email current_user&.email || - current_gestionnaire&.email || + current_instructeur&.email || current_administrateur&.email end @@ -104,8 +104,8 @@ module ApplicationHelper def root_path_for_profile(nav_bar_profile) case nav_bar_profile - when :gestionnaire - gestionnaire_procedures_path + when :instructeur + instructeur_procedures_path when :user dossiers_path else diff --git a/app/helpers/dossier_link_helper.rb b/app/helpers/dossier_link_helper.rb index 3a5e662f0..15ad75f12 100644 --- a/app/helpers/dossier_link_helper.rb +++ b/app/helpers/dossier_link_helper.rb @@ -1,12 +1,12 @@ module DossierLinkHelper def dossier_linked_path(user, dossier) - if user.is_a?(Gestionnaire) - if dossier.procedure.gestionnaires.include?(user) - gestionnaire_dossier_path(dossier.procedure, dossier) + if user.is_a?(Instructeur) + if dossier.procedure.instructeurs.include?(user) + instructeur_dossier_path(dossier.procedure, dossier) else - avis = dossier.avis.find_by(gestionnaire: user) + avis = dossier.avis.find_by(instructeur: user) if avis.present? - gestionnaire_avis_path(avis) + instructeur_avis_path(avis) end end elsif user.owns_or_invite?(dossier) diff --git a/app/helpers/procedure_helper.rb b/app/helpers/procedure_helper.rb index d542ea0e2..6eadece2f 100644 --- a/app/helpers/procedure_helper.rb +++ b/app/helpers/procedure_helper.rb @@ -55,7 +55,7 @@ module ProcedureHelper end def procedure_dossiers_download_path(procedure, format:, version:) - download_dossiers_gestionnaire_procedure_path(format: format, + download_dossiers_instructeur_procedure_path(format: format, procedure_id: procedure.id, tables: [:etablissements], version: version) diff --git a/app/helpers/tableau_de_bord_helper.rb b/app/helpers/tableau_de_bord_helper.rb index 6487ecbdc..3cfd6313c 100644 --- a/app/helpers/tableau_de_bord_helper.rb +++ b/app/helpers/tableau_de_bord_helper.rb @@ -2,8 +2,8 @@ module TableauDeBordHelper def tableau_de_bord_helper_path if current_administrateur.present? admin_procedures_path - elsif current_gestionnaire.present? - gestionnaire_procedures_path + elsif current_instructeur.present? + instructeur_procedures_path else dossiers_path end diff --git a/app/jobs/instructeur_email_notification_job.rb b/app/jobs/instructeur_email_notification_job.rb index 1920457df..ccab40708 100644 --- a/app/jobs/instructeur_email_notification_job.rb +++ b/app/jobs/instructeur_email_notification_job.rb @@ -1,7 +1,7 @@ -class GestionnaireEmailNotificationJob < ApplicationJob +class InstructeurEmailNotificationJob < ApplicationJob queue_as :cron def perform(*args) - NotificationService.send_gestionnaire_email_notification + NotificationService.send_instructeur_email_notification end end diff --git a/app/jobs/weekly_overview_job.rb b/app/jobs/weekly_overview_job.rb index 2d8c09f65..86a5f4abf 100644 --- a/app/jobs/weekly_overview_job.rb +++ b/app/jobs/weekly_overview_job.rb @@ -4,10 +4,10 @@ class WeeklyOverviewJob < ApplicationJob def perform(*args) # Feature flipped to avoid mails in staging due to unprocessed dossier if Rails.application.config.ds_weekly_overview - Gestionnaire.all - .map { |gestionnaire| [gestionnaire, gestionnaire.last_week_overview] } + Instructeur.all + .map { |instructeur| [instructeur, instructeur.last_week_overview] } .reject { |_, overview| overview.nil? } - .each { |gestionnaire, _| GestionnaireMailer.last_week_overview(gestionnaire).deliver_later } + .each { |instructeur, _| InstructeurMailer.last_week_overview(instructeur).deliver_later } end end end diff --git a/app/lib/flipflop/strategies/user_preference_strategy.rb b/app/lib/flipflop/strategies/user_preference_strategy.rb index 822b71531..1aa2c1165 100644 --- a/app/lib/flipflop/strategies/user_preference_strategy.rb +++ b/app/lib/flipflop/strategies/user_preference_strategy.rb @@ -10,7 +10,7 @@ module Flipflop::Strategies def enabled?(feature) find_current_administrateur&.feature_enabled?(feature) || - find_current_gestionnaire&.feature_enabled?(feature) + find_current_instructeur&.feature_enabled?(feature) end private @@ -22,10 +22,10 @@ module Flipflop::Strategies end end - def find_current_gestionnaire - gestionnaire_id = Current.gestionnaire&.id - if gestionnaire_id - Gestionnaire.find_by(id: gestionnaire_id) + def find_current_instructeur + instructeur_id = Current.instructeur&.id + if instructeur_id + Instructeur.find_by(id: instructeur_id) end end end diff --git a/app/mailers/avis_mailer.rb b/app/mailers/avis_mailer.rb index 78c7ac5a8..ea7ebe441 100644 --- a/app/mailers/avis_mailer.rb +++ b/app/mailers/avis_mailer.rb @@ -4,7 +4,7 @@ class AvisMailer < ApplicationMailer def avis_invitation(avis) @avis = avis - email = @avis.gestionnaire&.email || @avis.email + email = @avis.instructeur&.email || @avis.email subject = "Donnez votre avis sur le dossier nº #{@avis.dossier.id} (#{@avis.dossier.procedure.libelle})" mail(to: email, subject: subject) diff --git a/app/mailers/instructeur_mailer.rb b/app/mailers/instructeur_mailer.rb index 7607e37ac..29d58efab 100644 --- a/app/mailers/instructeur_mailer.rb +++ b/app/mailers/instructeur_mailer.rb @@ -1,28 +1,28 @@ -# Preview all emails at http://localhost:3000/rails/mailers/gestionnaire_mailer -class GestionnaireMailer < ApplicationMailer +# Preview all emails at http://localhost:3000/rails/mailers/instructeur_mailer +class InstructeurMailer < ApplicationMailer layout 'mailers/layout' - def invite_gestionnaire(gestionnaire, reset_password_token) + def invite_instructeur(instructeur, reset_password_token) @reset_password_token = reset_password_token - @gestionnaire = gestionnaire + @instructeur = instructeur subject = "Activez votre compte instructeur" - mail(to: gestionnaire.email, + mail(to: instructeur.email, subject: subject, reply_to: CONTACT_EMAIL) end - def user_to_gestionnaire(email) + def user_to_instructeur(email) @email = email subject = "Vous avez été nommé instructeur" mail(to: @email, subject: subject) end - def last_week_overview(gestionnaire) - email = gestionnaire.email + def last_week_overview(instructeur) + email = instructeur.email @subject = 'Votre activité hebdomadaire' - @overview = gestionnaire.last_week_overview + @overview = instructeur.last_week_overview if @overview.present? headers['X-mailjet-campaign'] = 'last_week_overview' @@ -38,18 +38,18 @@ class GestionnaireMailer < ApplicationMailer mail(to: recipient.email, subject: subject) end - def send_login_token(gestionnaire, login_token) - @gestionnaire_id = gestionnaire.id + def send_login_token(instructeur, login_token) + @instructeur_id = instructeur.id @login_token = login_token subject = "Connexion sécurisée à demarches-simplifiees.fr" - mail(to: gestionnaire.email, subject: subject) + mail(to: instructeur.email, subject: subject) end - def send_notifications(gestionnaire, data) + def send_notifications(instructeur, data) @data = data subject = "Vous avez du nouveau sur vos démarches" - mail(to: gestionnaire.email, subject: subject) + mail(to: instructeur.email, subject: subject) end end diff --git a/app/models/administrateur.rb b/app/models/administrateur.rb index cbfc3162b..cc8ad21b2 100644 --- a/app/models/administrateur.rb +++ b/app/models/administrateur.rb @@ -6,7 +6,7 @@ class Administrateur < ApplicationRecord devise :database_authenticatable, :registerable, :async, :recoverable, :rememberable, :trackable, :validatable, :lockable - has_and_belongs_to_many :gestionnaires + has_and_belongs_to_many :instructeurs has_many :administrateurs_procedures has_many :procedures, through: :administrateurs_procedures has_many :services @@ -117,8 +117,8 @@ class Administrateur < ApplicationRecord procedure.administrateurs.include?(self) end - def gestionnaire - Gestionnaire.find_by(email: email) + def instructeur + Instructeur.find_by(email: email) end def can_be_deleted? diff --git a/app/models/administration.rb b/app/models/administration.rb index 0fdf004d4..aa77b2d4d 100644 --- a/app/models/administration.rb +++ b/app/models/administration.rb @@ -26,7 +26,7 @@ class Administration < ApplicationRecord confirmed_at: Time.zone.now }) - Gestionnaire.create({ + Instructeur.create({ email: email, password: password }) diff --git a/app/models/assign_to.rb b/app/models/assign_to.rb index 43da53ea3..61802b8c0 100644 --- a/app/models/assign_to.rb +++ b/app/models/assign_to.rb @@ -1,6 +1,6 @@ class AssignTo < ApplicationRecord belongs_to :procedure - belongs_to :gestionnaire + belongs_to :instructeur has_one :procedure_presentation, dependent: :destroy scope :with_email_notifications, -> { where(email_notifications_enabled: true) } diff --git a/app/models/avis.rb b/app/models/avis.rb index 301028041..5696d6411 100644 --- a/app/models/avis.rb +++ b/app/models/avis.rb @@ -2,8 +2,8 @@ class Avis < ApplicationRecord include EmailSanitizableConcern belongs_to :dossier, inverse_of: :avis, touch: true - belongs_to :gestionnaire - belongs_to :claimant, class_name: 'Gestionnaire' + belongs_to :instructeur + belongs_to :claimant, class_name: 'Instructeur' has_one_attached :piece_justificative_file @@ -11,8 +11,8 @@ class Avis < ApplicationRecord validates :claimant, presence: true before_validation -> { sanitize_email(:email) } - before_create :try_to_assign_gestionnaire - after_create :notify_gestionnaire + before_create :try_to_assign_instructeur + after_create :notify_instructeur default_scope { joins(:dossier) } scope :with_answer, -> { where.not(answer: nil) } @@ -26,11 +26,11 @@ class Avis < ApplicationRecord attr_accessor :emails def email_to_display - gestionnaire&.email || email + instructeur&.email || email end - def self.link_avis_to_gestionnaire(gestionnaire) - Avis.where(email: gestionnaire.email).update_all(email: nil, gestionnaire_id: gestionnaire.id) + def self.link_avis_to_instructeur(instructeur) + Avis.where(email: instructeur.email).update_all(email: nil, instructeur_id: instructeur.id) end def self.avis_exists_and_email_belongs_to_avis?(avis_id, email) @@ -49,14 +49,14 @@ class Avis < ApplicationRecord private - def notify_gestionnaire + def notify_instructeur AvisMailer.avis_invitation(self).deliver_later end - def try_to_assign_gestionnaire - gestionnaire = Gestionnaire.find_by(email: email) - if gestionnaire - self.gestionnaire = gestionnaire + def try_to_assign_instructeur + instructeur = Instructeur.find_by(email: email) + if instructeur + self.instructeur = instructeur self.email = nil end end diff --git a/app/models/commentaire.rb b/app/models/commentaire.rb index bbf492eba..376296064 100644 --- a/app/models/commentaire.rb +++ b/app/models/commentaire.rb @@ -2,7 +2,7 @@ class Commentaire < ApplicationRecord belongs_to :dossier, inverse_of: :commentaires, touch: true belongs_to :user - belongs_to :gestionnaire + belongs_to :instructeur mount_uploader :file, CommentaireFileUploader validate :messagerie_available?, on: :create @@ -19,8 +19,8 @@ class Commentaire < ApplicationRecord def email if user user.email - elsif gestionnaire - gestionnaire.email + elsif instructeur + instructeur.email else read_attribute(:email) end @@ -31,8 +31,8 @@ class Commentaire < ApplicationRecord end def redacted_email - if gestionnaire.present? - gestionnaire.email.split('@').first + if instructeur.present? + instructeur.email.split('@').first else email end @@ -40,7 +40,7 @@ class Commentaire < ApplicationRecord def sent_by_system? [CONTACT_EMAIL, OLD_CONTACT_EMAIL].include?(email) && - user.nil? && gestionnaire.nil? + user.nil? && instructeur.nil? end def sent_by?(someone) @@ -70,7 +70,7 @@ class Commentaire < ApplicationRecord # of an automated notification email we sent to a user, so do nothing. # - If a user or an invited user posted a commentaire, do nothing, # the notification system will properly - # - Otherwise, a gestionnaire posted a commentaire, we need to notify the user + # - Otherwise, a instructeur posted a commentaire, we need to notify the user if !email.in?([CONTACT_EMAIL, dossier_user_email, *invited_users_emails]) notify_user end diff --git a/app/models/concerns/trusted_device_concern.rb b/app/models/concerns/trusted_device_concern.rb index f7dfb8e92..07493f85b 100644 --- a/app/models/concerns/trusted_device_concern.rb +++ b/app/models/concerns/trusted_device_concern.rb @@ -17,10 +17,10 @@ module TrustedDeviceConcern (Time.zone.now - TRUSTED_DEVICE_PERIOD) < trusted_device_cookie_created_at end - def send_login_token_or_bufferize(gestionnaire) - if !gestionnaire.young_login_token? - login_token = gestionnaire.create_trusted_device_token - GestionnaireMailer.send_login_token(gestionnaire, login_token).deliver_later + def send_login_token_or_bufferize(instructeur) + if !instructeur.young_login_token? + login_token = instructeur.create_trusted_device_token + InstructeurMailer.send_login_token(instructeur, login_token).deliver_later end end diff --git a/app/models/current.rb b/app/models/current.rb index b545d5ce5..6d758d000 100644 --- a/app/models/current.rb +++ b/app/models/current.rb @@ -1,3 +1,3 @@ class Current < ActiveSupport::CurrentAttributes - attribute :gestionnaire, :administrateur + attribute :instructeur, :administrateur end diff --git a/app/models/dossier.rb b/app/models/dossier.rb index 6c0bdc665..bbfc893fe 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -29,8 +29,8 @@ class Dossier < ApplicationRecord has_many :invites, dependent: :destroy has_many :follows, -> { active }, inverse_of: :dossier has_many :previous_follows, -> { inactive }, class_name: 'Follow', inverse_of: :dossier - has_many :followers_gestionnaires, through: :follows, source: :gestionnaire - has_many :previous_followers_gestionnaires, -> { distinct }, through: :previous_follows, source: :gestionnaire + has_many :followers_instructeurs, through: :follows, source: :instructeur + has_many :previous_followers_instructeurs, -> { distinct }, through: :previous_follows, source: :instructeur has_many :avis, inverse_of: :dossier, dependent: :destroy has_many :dossier_operation_logs, dependent: :destroy @@ -114,7 +114,7 @@ class Dossier < ApplicationRecord .includes( :user, :individual, - :followers_gestionnaires, + :followers_instructeurs, :avis, etablissement: :champ, champs: { @@ -129,7 +129,7 @@ class Dossier < ApplicationRecord } 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 :followed_by, -> (instructeur) { joins(:follows).where(follows: { instructeur: instructeur }) } scope :with_champs, -> { includes(champs: :type_de_champ) } scope :nearing_end_of_retention, -> (duration = '1 month') { joins(:procedure).where("en_instruction_at + (duree_conservation_dossiers_dans_ds * interval '1 month') - now() < interval ?", duration) } scope :since, -> (since) { where('dossiers.en_construction_at >= ?', since) } @@ -273,14 +273,14 @@ class Dossier < ApplicationRecord parts.join end - def avis_for(gestionnaire) - if gestionnaire.dossiers.include?(self) + def avis_for(instructeur) + if instructeur.dossiers.include?(self) avis.order(created_at: :asc) else avis .where(confidentiel: false) - .or(avis.where(claimant: gestionnaire)) - .or(avis.where(gestionnaire: gestionnaire)) + .or(avis.where(claimant: instructeur)) + .or(avis.where(instructeur: instructeur)) .order(created_at: :asc) end end @@ -335,7 +335,7 @@ class Dossier < ApplicationRecord update(hidden_at: deleted_dossier.deleted_at) if en_construction? - administration_emails = followers_gestionnaires.present? ? followers_gestionnaires.pluck(:email) : procedure.administrateurs.pluck(:email) + administration_emails = followers_instructeurs.present? ? followers_instructeurs.pluck(:email) : procedure.administrateurs.pluck(:email) administration_emails.each do |email| DossierMailer.notify_deletion_to_administration(deleted_dossier, email).deliver_later end @@ -345,34 +345,34 @@ class Dossier < ApplicationRecord log_dossier_operation(author, :supprimer, self) end - def after_passer_en_instruction(gestionnaire) - gestionnaire.follow(self) + def after_passer_en_instruction(instructeur) + instructeur.follow(self) - log_dossier_operation(gestionnaire, :passer_en_instruction) + log_dossier_operation(instructeur, :passer_en_instruction) end def after_passer_automatiquement_en_instruction log_automatic_dossier_operation(:passer_en_instruction) end - def after_repasser_en_construction(gestionnaire) + def after_repasser_en_construction(instructeur) self.en_instruction_at = nil save! - log_dossier_operation(gestionnaire, :repasser_en_construction) + log_dossier_operation(instructeur, :repasser_en_construction) end - def after_repasser_en_instruction(gestionnaire) + def after_repasser_en_instruction(instructeur) self.processed_at = nil self.motivation = nil attestation&.destroy save! DossierMailer.notify_revert_to_instruction(self).deliver_later - log_dossier_operation(gestionnaire, :repasser_en_instruction) + log_dossier_operation(instructeur, :repasser_en_instruction) end - def after_accepter(gestionnaire, motivation, justificatif = nil) + def after_accepter(instructeur, motivation, justificatif = nil) self.motivation = motivation if justificatif @@ -385,7 +385,7 @@ class Dossier < ApplicationRecord save! NotificationMailer.send_closed_notification(self).deliver_later - log_dossier_operation(gestionnaire, :accepter, self) + log_dossier_operation(instructeur, :accepter, self) end def after_accepter_automatiquement @@ -400,7 +400,7 @@ class Dossier < ApplicationRecord log_automatic_dossier_operation(:accepter, self) end - def after_refuser(gestionnaire, motivation, justificatif = nil) + def after_refuser(instructeur, motivation, justificatif = nil) self.motivation = motivation if justificatif @@ -409,10 +409,10 @@ class Dossier < ApplicationRecord save! NotificationMailer.send_refused_notification(self).deliver_later - log_dossier_operation(gestionnaire, :refuser, self) + log_dossier_operation(instructeur, :refuser, self) end - def after_classer_sans_suite(gestionnaire, motivation, justificatif = nil) + def after_classer_sans_suite(instructeur, motivation, justificatif = nil) self.motivation = motivation if justificatif @@ -421,7 +421,7 @@ class Dossier < ApplicationRecord save! NotificationMailer.send_without_continuation_notification(self).deliver_later - log_dossier_operation(gestionnaire, :classer_sans_suite, self) + log_dossier_operation(instructeur, :classer_sans_suite, self) end def check_mandatory_champs @@ -432,9 +432,9 @@ class Dossier < ApplicationRecord end end - def modifier_annotations!(gestionnaire) + def modifier_annotations!(instructeur) champs_private.select(&:value_previously_changed?).each do |champ| - log_dossier_operation(gestionnaire, :modifier_annotation, champ) + log_dossier_operation(instructeur, :modifier_annotation, champ) end end @@ -457,7 +457,7 @@ class Dossier < ApplicationRecord ['Passé en instruction le', :en_instruction_at], ['Traité le', :processed_at], ['Motivation de la décision', :motivation], - ['Instructeurs', followers_gestionnaires.map(&:email).join(' ')] + ['Instructeurs', followers_instructeurs.map(&:email).join(' ')] ] + champs_for_export + annotations_for_export end diff --git a/app/models/follow.rb b/app/models/follow.rb index 6649c52ac..146df6440 100644 --- a/app/models/follow.rb +++ b/app/models/follow.rb @@ -1,8 +1,8 @@ class Follow < ApplicationRecord - belongs_to :gestionnaire + belongs_to :instructeur belongs_to :dossier - validates :gestionnaire_id, uniqueness: { scope: [:dossier_id, :unfollowed_at] } + validates :instructeur_id, uniqueness: { scope: [:dossier_id, :unfollowed_at] } before_create :set_default_date diff --git a/app/models/instructeur.rb b/app/models/instructeur.rb index 1c94f5070..e3ce3b41e 100644 --- a/app/models/instructeur.rb +++ b/app/models/instructeur.rb @@ -1,4 +1,4 @@ -class Gestionnaire < ApplicationRecord +class Instructeur < ApplicationRecord include CredentialsSyncableConcern include EmailSanitizableConcern @@ -12,12 +12,12 @@ class Gestionnaire < ApplicationRecord has_many :assign_to, dependent: :destroy has_many :procedures, through: :assign_to - has_many :assign_to_with_email_notifications, -> { with_email_notifications }, class_name: 'AssignTo', inverse_of: :gestionnaire + has_many :assign_to_with_email_notifications, -> { with_email_notifications }, class_name: 'AssignTo', inverse_of: :instructeur has_many :procedures_with_email_notifications, through: :assign_to_with_email_notifications, source: :procedure has_many :dossiers, -> { state_not_brouillon }, through: :procedures - has_many :follows, -> { active }, inverse_of: :gestionnaire - has_many :previous_follows, -> { inactive }, class_name: 'Follow', inverse_of: :gestionnaire + has_many :follows, -> { active }, inverse_of: :instructeur + has_many :previous_follows, -> { inactive }, class_name: 'Follow', inverse_of: :instructeur has_many :followed_dossiers, through: :follows, source: :dossier has_many :previously_followed_dossiers, -> { distinct }, through: :previous_follows, source: :dossier has_many :avis @@ -37,7 +37,7 @@ class Gestionnaire < ApplicationRecord # Database uniqueness constraint rescue ActiveRecord::RecordInvalid => e # ActiveRecord validation - raise unless e.record.errors.details.dig(:gestionnaire_id, 0, :error) == :taken + raise unless e.record.errors.details.dig(:instructeur_id, 0, :error) == :taken end end @@ -90,7 +90,7 @@ class Gestionnaire < ApplicationRecord def notifications_for_dossier(dossier) follow = Follow .includes(dossier: [:champs, :avis, :commentaires]) - .find_by(gestionnaire: self, dossier: dossier) + .find_by(instructeur: self, dossier: dossier) if follow.present? demande = follow.dossier.champs.updated_since?(follow.demande_seen_at).any? @@ -175,13 +175,13 @@ class Gestionnaire < ApplicationRecord def mark_tab_as_seen(dossier, tab) attributes = {} attributes["#{tab}_seen_at"] = Time.zone.now - Follow.where(gestionnaire: self, dossier: dossier).update_all(attributes) + Follow.where(instructeur: self, dossier: dossier).update_all(attributes) end def invite! reset_password_token = set_reset_password_token - GestionnaireMailer.invite_gestionnaire(self, reset_password_token).deliver_later + InstructeurMailer.invite_instructeur(self, reset_password_token).deliver_later end def feature_enabled?(feature) diff --git a/app/models/procedure.rb b/app/models/procedure.rb index f6f4b160c..7871e6ac4 100644 --- a/app/models/procedure.rb +++ b/app/models/procedure.rb @@ -17,7 +17,7 @@ class Procedure < ApplicationRecord has_many :assign_to, dependent: :destroy has_many :administrateurs_procedures has_many :administrateurs, through: :administrateurs_procedures, after_remove: -> (procedure, _admin) { procedure.validate! } - has_many :gestionnaires, through: :assign_to + has_many :instructeurs, through: :assign_to has_one :initiated_mail, class_name: "Mails::InitiatedMail", dependent: :destroy has_one :received_mail, class_name: "Mails::ReceivedMail", dependent: :destroy @@ -243,7 +243,7 @@ class Procedure < ApplicationRecord procedure.service = self.service.clone_and_assign_to_administrateur(admin) end - admin.gestionnaire.assign_to_procedure(procedure) + admin.instructeur.assign_to_procedure(procedure) procedure end @@ -402,7 +402,7 @@ class Procedure < ApplicationRecord result << :service end - if gestionnaires.empty? + if instructeurs.empty? result << :instructeurs end diff --git a/app/models/procedure_presentation.rb b/app/models/procedure_presentation.rb index 025aa064a..2eb0f51aa 100644 --- a/app/models/procedure_presentation.rb +++ b/app/models/procedure_presentation.rb @@ -19,7 +19,7 @@ class ProcedurePresentation < ApplicationRecord field_hash('En construction le', 'self', 'en_construction_at'), field_hash('Mis à jour le', 'self', 'updated_at'), field_hash('Demandeur', 'user', 'email'), - field_hash('Email instructeur', 'followers_gestionnaires', 'email') + field_hash('Email instructeur', 'followers_instructeurs', 'email') ] if procedure.for_individual @@ -73,13 +73,13 @@ class ProcedurePresentation < ApplicationRecord displayed_fields.map { |field| get_value(dossier, field['table'], field['column']) } end - def sorted_ids(dossiers, gestionnaire) + def sorted_ids(dossiers, instructeur) dossiers.each { |dossier| assert_matching_procedure(dossier) } table, column, order = sort.values_at('table', 'column', 'order') case table when 'notifications' - dossiers_id_with_notification = gestionnaire.dossiers_id_with_notifications(dossiers) + dossiers_id_with_notification = instructeur.dossiers_id_with_notifications(dossiers) if order == 'desc' return dossiers_id_with_notification + (dossiers.order('dossiers.updated_at desc').ids - dossiers_id_with_notification) @@ -93,7 +93,7 @@ class ProcedurePresentation < ApplicationRecord .where("champs.type_de_champ_id = #{column.to_i}") .order("champs.value #{order}") .pluck(:id) - when 'self', 'user', 'individual', 'etablissement', 'followers_gestionnaires' + when 'self', 'user', 'individual', 'etablissement', 'followers_instructeurs' return (table == 'self' ? dossiers : dossiers.includes(table)) .order("#{self.class.sanitized_column(table, column)} #{order}") .pluck(:id) @@ -129,7 +129,7 @@ class ProcedurePresentation < ApplicationRecord .includes(table) .filter_ilike(table, column, values) end - when 'user', 'individual', 'followers_gestionnaires' + when 'user', 'individual', 'followers_instructeurs' dossiers .includes(table) .filter_ilike(table, column, values) @@ -202,7 +202,7 @@ class ProcedurePresentation < ApplicationRecord dossier.send(column)&.strftime('%d/%m/%Y') when 'user', 'individual', 'etablissement' dossier.send(table)&.send(column) - when 'followers_gestionnaires' + when 'followers_instructeurs' dossier.send(table)&.map { |g| g.send(column) }&.join(', ') when 'type_de_champ' dossier.champs.find { |c| c.type_de_champ_id == column.to_i }.value diff --git a/app/models/trusted_device_token.rb b/app/models/trusted_device_token.rb index 951ccbe26..2ba1f88f7 100644 --- a/app/models/trusted_device_token.rb +++ b/app/models/trusted_device_token.rb @@ -2,7 +2,7 @@ class TrustedDeviceToken < ApplicationRecord LOGIN_TOKEN_VALIDITY = 1.week LOGIN_TOKEN_YOUTH = 15.minutes - belongs_to :gestionnaire + belongs_to :instructeur has_secure_token def token_valid? diff --git a/app/policies/application_policy.rb b/app/policies/application_policy.rb index e3bdc3791..91d5d2e01 100644 --- a/app/policies/application_policy.rb +++ b/app/policies/application_policy.rb @@ -35,11 +35,11 @@ class ApplicationPolicy end class Scope - attr_reader :user, :gestionnaire, :administrateur, :scope + attr_reader :user, :instructeur, :administrateur, :scope def initialize(account, scope) @user = account[:user] - @gestionnaire = account[:gestionnaire] + @instructeur = account[:instructeur] @administrateur = account[:administrateur] @scope = scope end diff --git a/app/serializers/dossier_serializer.rb b/app/serializers/dossier_serializer.rb index ae62f6eb9..5e32472ba 100644 --- a/app/serializers/dossier_serializer.rb +++ b/app/serializers/dossier_serializer.rb @@ -94,7 +94,7 @@ class DossierSerializer < ActiveModel::Serializer end def instructeurs - object.followers_gestionnaires.pluck(:email) + object.followers_instructeurs.pluck(:email) end def created_at diff --git a/app/serializers/operation_author_serializer.rb b/app/serializers/operation_author_serializer.rb index 0856a1e90..684e84d81 100644 --- a/app/serializers/operation_author_serializer.rb +++ b/app/serializers/operation_author_serializer.rb @@ -5,7 +5,7 @@ class OperationAuthorSerializer < ActiveModel::Serializer case object when User "Usager##{object.id}" - when Gestionnaire + when Instructeur "Instructeur##{object.id}" when Administrateur "Administrateur##{object.id}" diff --git a/app/services/administrateur_usage_statistics_service.rb b/app/services/administrateur_usage_statistics_service.rb index 6c98d954a..6fc01339b 100644 --- a/app/services/administrateur_usage_statistics_service.rb +++ b/app/services/administrateur_usage_statistics_service.rb @@ -120,7 +120,7 @@ class AdministrateurUsageStatisticsService end def nb_instructeurs_by_administrateur_id - @nb_instructeurs_by_administrateur_id ||= with_default(0, Administrateur.joins(:gestionnaires).group(:administrateur_id).count) + @nb_instructeurs_by_administrateur_id ||= with_default(0, Administrateur.joins(:instructeurs).group(:administrateur_id).count) end def nb_dossiers_by_administrateur_id_and_procedure_id_and_synthetic_state diff --git a/app/services/commentaire_service.rb b/app/services/commentaire_service.rb index 8708401a6..f7611b290 100644 --- a/app/services/commentaire_service.rb +++ b/app/services/commentaire_service.rb @@ -4,8 +4,8 @@ class CommentaireService case sender when User params[:user] = sender - when Gestionnaire - params[:gestionnaire] = sender + when Instructeur + params[:instructeur] = sender end build_with_email(sender.email, dossier, params) diff --git a/app/services/dossier_search_service.rb b/app/services/dossier_search_service.rb index b2947edd5..a161e8e50 100644 --- a/app/services/dossier_search_service.rb +++ b/app/services/dossier_search_service.rb @@ -1,22 +1,22 @@ class DossierSearchService - def self.matching_dossiers_for_gestionnaire(search_terms, gestionnaire) - dossier_by_exact_id_for_gestionnaire(search_terms, gestionnaire) - .presence || dossier_by_full_text_for_gestionnaire(search_terms, gestionnaire) + def self.matching_dossiers_for_instructeur(search_terms, instructeur) + dossier_by_exact_id_for_instructeur(search_terms, instructeur) + .presence || dossier_by_full_text_for_instructeur(search_terms, instructeur) end private - def self.dossier_by_exact_id_for_gestionnaire(search_terms, gestionnaire) + def self.dossier_by_exact_id_for_instructeur(search_terms, instructeur) id = search_terms.to_i - if id != 0 && id_compatible?(id) # Sometimes gestionnaire is searching dossiers with a big number (ex: SIRET), ActiveRecord can't deal with them and throws ActiveModel::RangeError. id_compatible? prevents this. - dossiers_by_id(id, gestionnaire) + if id != 0 && id_compatible?(id) # Sometimes instructeur is searching dossiers with a big number (ex: SIRET), ActiveRecord can't deal with them and throws ActiveModel::RangeError. id_compatible? prevents this. + dossiers_by_id(id, instructeur) else Dossier.none end end - def self.dossiers_by_id(id, gestionnaire) - (gestionnaire.dossiers.where(id: id) + gestionnaire.dossiers_from_avis.where(id: id)).uniq + def self.dossiers_by_id(id, instructeur) + (instructeur.dossiers.where(id: id) + instructeur.dossiers_from_avis.where(id: id)).uniq end def self.id_compatible?(number) @@ -26,11 +26,11 @@ class DossierSearchService false end - def self.dossier_by_full_text_for_gestionnaire(search_terms, gestionnaire) + def self.dossier_by_full_text_for_instructeur(search_terms, instructeur) ts_vector = "to_tsvector('french', search_terms || private_search_terms)" ts_query = "to_tsquery('french', #{Dossier.connection.quote(to_tsquery(search_terms))})" - gestionnaire + instructeur .dossiers .state_not_brouillon .where("#{ts_vector} @@ #{ts_query}") diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb index da8a1bb44..c72816826 100644 --- a/app/services/notification_service.rb +++ b/app/services/notification_service.rb @@ -1,19 +1,19 @@ class NotificationService class << self - def send_gestionnaire_email_notification - Gestionnaire + def send_instructeur_email_notification + Instructeur .includes(assign_to: { procedure: :dossiers }) .where(assign_tos: { email_notifications_enabled: true }) - .find_in_batches { |gestionnaires| send_batch_of_gestionnaires_email_notification(gestionnaires) } + .find_in_batches { |instructeurs| send_batch_of_instructeurs_email_notification(instructeurs) } end private - def send_batch_of_gestionnaires_email_notification(gestionnaires) - gestionnaires - .map { |gestionnaire| [gestionnaire, gestionnaire.email_notification_data] } - .reject { |(_gestionnaire, data)| data.empty? } - .each { |(gestionnaire, data)| GestionnaireMailer.send_notifications(gestionnaire, data).deliver_later } + def send_batch_of_instructeurs_email_notification(instructeurs) + instructeurs + .map { |instructeur| [instructeur, instructeur.email_notification_data] } + .reject { |(_instructeur, data)| data.empty? } + .each { |(instructeur, data)| InstructeurMailer.send_notifications(instructeur, data).deliver_later } end end end diff --git a/app/services/procedure_export_service.rb b/app/services/procedure_export_service.rb index 272be4e3e..e308a5f69 100644 --- a/app/services/procedure_export_service.rb +++ b/app/services/procedure_export_service.rb @@ -167,7 +167,7 @@ class ProcedureExportService when :individual_gender dossier.individual&.gender when :emails_instructeurs - dossier.followers_gestionnaires.map(&:email).join(' ') + dossier.followers_instructeurs.map(&:email).join(' ') else dossier.read_attribute(key) end diff --git a/app/services/switch_devise_profile_service.rb b/app/services/switch_devise_profile_service.rb index d5fcde170..6c024863c 100644 --- a/app/services/switch_devise_profile_service.rb +++ b/app/services/switch_devise_profile_service.rb @@ -4,8 +4,8 @@ class SwitchDeviseProfileService end def multiple_devise_profile_connect? - user_signed_in? && gestionnaire_signed_in? || - gestionnaire_signed_in? && administrateur_signed_in? || + user_signed_in? && instructeur_signed_in? || + instructeur_signed_in? && administrateur_signed_in? || user_signed_in? && administrateur_signed_in? end @@ -15,8 +15,8 @@ class SwitchDeviseProfileService @warden.authenticate(:scope => :user).present? end - def gestionnaire_signed_in? - @warden.authenticate(:scope => :gestionnaire).present? + def instructeur_signed_in? + @warden.authenticate(:scope => :instructeur).present? end def administrateur_signed_in? diff --git a/app/services/sync_credentials_service.rb b/app/services/sync_credentials_service.rb index 9b723d076..13322b1f4 100644 --- a/app/services/sync_credentials_service.rb +++ b/app/services/sync_credentials_service.rb @@ -14,9 +14,9 @@ class SyncCredentialsService end end - if @klass != Gestionnaire - gestionnaire = Gestionnaire.find_by(email: @email_before_last_save) - if gestionnaire && !gestionnaire.update_columns(email: @email, encrypted_password: @encrypted_password) + if @klass != Instructeur + instructeur = Instructeur.find_by(email: @email_before_last_save) + if instructeur && !instructeur.update_columns(email: @email, encrypted_password: @encrypted_password) return false end end diff --git a/app/views/admin/assigns/_list_assign.html.haml b/app/views/admin/assigns/_list_assign.html.haml index 05ef08e02..20310a4d1 100644 --- a/app/views/admin/assigns/_list_assign.html.haml +++ b/app/views/admin/assigns/_list_assign.html.haml @@ -1,7 +1,7 @@ .row{ style: 'height: 34px;' } - if smart_listing.present? - %table.table#liste-gestionnaire + %table.table#liste-instructeur %thead %th Enlever %th#email{ style: 'text-align: right;' } Email diff --git a/app/views/admin/assigns/_list_not_assign.html.haml b/app/views/admin/assigns/_list_not_assign.html.haml index 8b223d92f..26e58255b 100644 --- a/app/views/admin/assigns/_list_not_assign.html.haml +++ b/app/views/admin/assigns/_list_not_assign.html.haml @@ -7,7 +7,7 @@ - if smart_listing.present? - %table.table#liste-gestionnaire + %table.table#liste-instructeur %thead %th#email Email %th Ajouter diff --git a/app/views/admin/assigns/show.html.haml b/app/views/admin/assigns/show.html.haml index 3f0c6a2d3..6fba3a9ca 100644 --- a/app/views/admin/assigns/show.html.haml +++ b/app/views/admin/assigns/show.html.haml @@ -9,15 +9,15 @@ %h3 = t('dynamics.admin.procedure.onglet_instructeurs.add.title') #procedure_new.section.section-label - = form_for @gestionnaire, url: { controller: 'admin/gestionnaires', action: :create } do |f| + = form_for @instructeur, url: { controller: 'admin/instructeurs', action: :create } do |f| .row .col-xs-5 = hidden_field_tag :procedure_id, params[:procedure_id] - = render partial: 'admin/gestionnaires/informations', locals: { f: f } + = render partial: 'admin/instructeurs/informations', locals: { f: f } .col-xs-2 %br %br - = f.submit 'Valider', class: 'btn btn-info', style: 'float: left;', id: 'add-gestionnaire-email' + = f.submit 'Valider', class: 'btn btn-info', style: 'float: left;', id: 'add-instructeur-email' .col-xs-6 %h3.text-success Affectés = smart_listing_render :instructeurs_assign diff --git a/app/views/admin/instructeurs/_list.html.haml b/app/views/admin/instructeurs/_list.html.haml index ce6cb5f71..b1d8b2f66 100644 --- a/app/views/admin/instructeurs/_list.html.haml +++ b/app/views/admin/instructeurs/_list.html.haml @@ -1,17 +1,17 @@ - if smart_listing.present? - %table.table#liste-gestionnaire + %table.table#liste-instructeur %thead %th#libelle= smart_listing.sortable 'Email', 'email' %th - - @gestionnaires.each do |gestionnaire| + - @instructeurs.each do |instructeur| %tr - %td{ style: 'padding-top: 11px; font-size: 15px;' }= gestionnaire.email + %td{ style: 'padding-top: 11px; font-size: 15px;' }= instructeur.email %td{ style: 'text-align: right;' } .delete.btn.btn-sm.fa.fa-trash .confirm - = link_to 'Valider', admin_gestionnaire_path(id: gestionnaire.id), { method: :delete, class: 'btn btn-sm btn-success' } + = link_to 'Valider', admin_instructeur_path(id: instructeur.id), { method: :delete, class: 'btn btn-sm btn-success' } .cancel.btn.btn-sm.btn-danger.fa.fa-minus{ style: 'top: 0;' } = smart_listing.paginate diff --git a/app/views/admin/instructeurs/index.html.haml b/app/views/admin/instructeurs/index.html.haml index d56ef6f50..09773adba 100644 --- a/app/views/admin/instructeurs/index.html.haml +++ b/app/views/admin/instructeurs/index.html.haml @@ -12,13 +12,13 @@ .row .col-xs-4 - = smart_listing_render :gestionnaires + = smart_listing_render :instructeurs .col-xs-1 .col-xs-6 %h3 Ajouter un instructeur #procedure_new.section.section-label - = form_for @gestionnaire, url: { controller: 'admin/gestionnaires', action: :create } do |f| + = form_for @instructeur, url: { controller: 'admin/instructeurs', action: :create } do |f| .row .col-xs-5 = render partial: 'informations', locals: { f: f } diff --git a/app/views/admin/instructeurs/index.js.erb b/app/views/admin/instructeurs/index.js.erb index bd6cb85e9..35f7cb74c 100644 --- a/app/views/admin/instructeurs/index.js.erb +++ b/app/views/admin/instructeurs/index.js.erb @@ -1 +1 @@ -<%= smart_listing_update :gestionnaires %> +<%= smart_listing_update :instructeurs %> diff --git a/app/views/admin/procedures/show.html.haml b/app/views/admin/procedures/show.html.haml index 52f135b4b..c88467779 100644 --- a/app/views/admin/procedures/show.html.haml +++ b/app/views/admin/procedures/show.html.haml @@ -5,9 +5,9 @@ = render partial: '/admin/procedures/modal_transfer' - if @procedure.brouillon? - - if @procedure.gestionnaires.empty? || @procedure.service.nil? + - if @procedure.instructeurs.empty? || @procedure.service.nil? - missing_elements = [] - - if @procedure.gestionnaires.empty? + - if @procedure.instructeurs.empty? - missing_elements << 'des instructeurs' - if @procedure.service.nil? - missing_elements << 'un service' @@ -59,7 +59,7 @@ %br Attention, diffusez toujours le lien complet affiché ci-dessus, et non pas un lien générique vers demarches-simplifiees.fr. Ne dites pas non plus aux usagers de se rendre sur le site générique demarches-simplifiees.fr, donnez-leur toujours le lien complet. - elsif @procedure.brouillon_avec_lien? - - if @procedure.gestionnaires.present? && @procedure.service.present? + - if @procedure.instructeurs.present? && @procedure.service.present? %p Cette démarche est actuellement en test, pour y accéder vous pouvez utiliser le lien : @@ -106,9 +106,9 @@ - else .alert.alert-info Pour pouvoir tester cette démarche, vous devez d’abord lui affecter - - if @procedure.gestionnaires.empty? + - if @procedure.instructeurs.empty? = link_to("des instructeurs", admin_procedure_assigns_path(@procedure)) - - if @procedure.gestionnaires.empty? && @procedure.service.nil? + - if @procedure.instructeurs.empty? && @procedure.service.nil? et - if @procedure.service.nil? = link_to("un service", services_path(procedure_id: @procedure)) diff --git a/app/views/avis_mailer/avis_invitation.html.haml b/app/views/avis_mailer/avis_invitation.html.haml index 860e0d256..1f36944f8 100644 --- a/app/views/avis_mailer/avis_invitation.html.haml +++ b/app/views/avis_mailer/avis_invitation.html.haml @@ -1,5 +1,5 @@ - content_for(:title, 'Invitation à donner votre avis') -- avis_link = @avis.gestionnaire.present? ? gestionnaire_avis_url(@avis) : sign_up_gestionnaire_avis_url(@avis.id, @avis.email) +- avis_link = @avis.instructeur.present? ? instructeur_avis_url(@avis) : sign_up_instructeur_avis_url(@avis.id, @avis.email) - content_for(:footer) do Merci de ne pas répondre à cet email. Donnez votre avis @@ -23,7 +23,7 @@ %p{ style: "padding: 8px; color: #333333; background-color: #EEEEEE; font-size: 14px;" } = @avis.introduction -- if @avis.gestionnaire.present? +- if @avis.instructeur.present? %p = link_to "Connectez-vous pour donner votre avis", avis_link - else diff --git a/app/views/fields/features_field/_show.html.haml b/app/views/fields/features_field/_show.html.haml index ae3d79b23..6db607e55 100644 --- a/app/views/fields/features_field/_show.html.haml +++ b/app/views/fields/features_field/_show.html.haml @@ -1,6 +1,6 @@ :ruby - url = if field.resource.class.name == 'Gestionnaire' - enable_feature_manager_gestionnaire_path(field.resource.id) + url = if field.resource.class.name == 'Instructeur' + enable_feature_manager_instructeur_path(field.resource.id) else enable_feature_manager_administrateur_path(field.resource.id) end diff --git a/app/views/instructeur_mailer/invite_instructeur.html.haml b/app/views/instructeur_mailer/invite_instructeur.html.haml index ef19563db..6ad3ba292 100644 --- a/app/views/instructeur_mailer/invite_instructeur.html.haml +++ b/app/views/instructeur_mailer/invite_instructeur.html.haml @@ -7,8 +7,8 @@ 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 : - = link_to(gestionnaire_activate_url(token: @reset_password_token), gestionnaire_activate_url(token: @reset_password_token)) + Votre compte a été créé pour l'adresse email #{@instructeur.email}. Pour l’activer, je vous invite à cliquer sur le lien suivant : + = link_to(instructeur_activate_url(token: @reset_password_token), instructeur_activate_url(token: @reset_password_token)) %p Par ailleurs, nous vous invitons à prendre quelques minutes pour consulter notre tutoriel à destination des nouveaux instructeurs : diff --git a/app/views/instructeur_mailer/last_week_overview.html.haml b/app/views/instructeur_mailer/last_week_overview.html.haml index 43b2950ae..56aca5f12 100644 --- a/app/views/instructeur_mailer/last_week_overview.html.haml +++ b/app/views/instructeur_mailer/last_week_overview.html.haml @@ -10,7 +10,7 @@ %h2{ style: 'font-size: 16px; font-weight: 300; margin: 25px 0 5px;' } #{procedure_overview.procedure.libelle} - = link_to 'voir', gestionnaire_procedure_url(procedure_overview.procedure), style: 'color: #0069CC; font-size: 14px;' + = link_to 'voir', instructeur_procedure_url(procedure_overview.procedure), style: 'color: #0069CC; font-size: 14px;' %table{ cellpadding: '0', cellspacing: '0', style: 'width: 100%; padding-bottom: 20px;' } %tbody @@ -30,7 +30,7 @@ - if procedure_overview.old_dossiers_en_construction.count < 6 \: - old_dossiers_en_construction = procedure_overview.old_dossiers_en_construction.map do |old_dossier| - - link_to "nº #{old_dossier.id}", gestionnaire_dossier_url(procedure_overview.procedure, old_dossier), style: 'color: #0069CC;' + - link_to "nº #{old_dossier.id}", instructeur_dossier_url(procedure_overview.procedure, old_dossier), style: 'color: #0069CC;' - end.join(', ') = sanitize(old_dossiers_en_construction, attributes: %w(href style)) @@ -44,7 +44,7 @@ - if procedure_overview.old_dossiers_en_instruction.count < 6 \: - old_dossiers_en_instruction = procedure_overview.old_dossiers_en_instruction.map do |old_dossier| - - link_to "nº #{old_dossier.id}", gestionnaire_dossier_url(procedure_overview.procedure, old_dossier), style: 'color: #0069CC;' + - link_to "nº #{old_dossier.id}", instructeur_dossier_url(procedure_overview.procedure, old_dossier), style: 'color: #0069CC;' - end.join(', ') = sanitize(old_dossiers_en_instruction, attributes: %w(href style)) diff --git a/app/views/instructeur_mailer/send_dossier.html.haml b/app/views/instructeur_mailer/send_dossier.html.haml index 7b43b79fc..192ab9b53 100644 --- a/app/views/instructeur_mailer/send_dossier.html.haml +++ b/app/views/instructeur_mailer/send_dossier.html.haml @@ -3,6 +3,6 @@ %p = "#{@sender.email} vous a envoyé le dossier nº #{@dossier.id}, cliquez sur le lien ci-dessous pour y accéder :" - = link_to(gestionnaire_dossier_url(@dossier.procedure, @dossier), gestionnaire_dossier_url(@dossier.procedure, @dossier)) + = link_to(instructeur_dossier_url(@dossier.procedure, @dossier), instructeur_dossier_url(@dossier.procedure, @dossier)) = render partial: "layouts/mailers/signature" diff --git a/app/views/instructeur_mailer/send_login_token.html.haml b/app/views/instructeur_mailer/send_login_token.html.haml index 8d25f4826..6e72adfb6 100644 --- a/app/views/instructeur_mailer/send_login_token.html.haml +++ b/app/views/instructeur_mailer/send_login_token.html.haml @@ -3,7 +3,7 @@ %p Veuillez cliquer sur le lien suivant pour vous connecter sur le site demarches-simplifiees.fr : - = link_to(sign_in_by_link_url(@gestionnaire_id, jeton: @login_token), sign_in_by_link_url(@gestionnaire_id, jeton: @login_token)) + = link_to(sign_in_by_link_url(@instructeur_id, jeton: @login_token), sign_in_by_link_url(@instructeur_id, jeton: @login_token)) %p Ce lien est diff --git a/app/views/instructeurs/_login_banner.html.haml b/app/views/instructeurs/_login_banner.html.haml index ccbde8f1f..391947030 100644 --- a/app/views/instructeurs/_login_banner.html.haml +++ b/app/views/instructeurs/_login_banner.html.haml @@ -1,3 +1,3 @@ -= link_to "/gestionnaires/sign_out", method: :delete do += link_to "/instructeurs/sign_out", method: :delete do %span.fa.fa-sign-out Se déconnecter diff --git a/app/views/instructeurs/activate/new.html.haml b/app/views/instructeurs/activate/new.html.haml index fb16700ce..a1962acfb 100644 --- a/app/views/instructeurs/activate/new.html.haml +++ b/app/views/instructeurs/activate/new.html.haml @@ -1,7 +1,7 @@ .container - = form_for @gestionnaire, url: { controller: 'gestionnaires/activate', action: :create }, html: { class: "form" } do |f| + = form_for @instructeur, url: { controller: 'instructeurs/activate', action: :create }, html: { class: "form" } do |f| %br - %h1= @gestionnaire.email + %h1= @instructeur.email = f.password_field :password, placeholder: 'Mot de passe' = f.hidden_field :reset_password_token, value: params[:token] = f.submit 'Définir le mot de passe', class: 'button large primary expand' diff --git a/app/views/instructeurs/avis/_header.html.haml b/app/views/instructeurs/avis/_header.html.haml index a44f30158..f0bfcd50d 100644 --- a/app/views/instructeurs/avis/_header.html.haml +++ b/app/views/instructeurs/avis/_header.html.haml @@ -1,10 +1,10 @@ .sub-header .container %ul.breadcrumbs - %li= link_to('Avis', gestionnaire_avis_index_path) + %li= link_to('Avis', instructeur_avis_index_path) %li= "#{dossier.procedure.libelle}, dossier nº #{dossier.id}" %ul.tabs - = dynamic_tab_item('Demande', gestionnaire_avis_path(avis)) - = dynamic_tab_item('Avis', instruction_gestionnaire_avis_path(avis), notification: avis.answer.blank?) - = dynamic_tab_item('Messagerie', messagerie_gestionnaire_avis_path(avis)) + = dynamic_tab_item('Demande', instructeur_avis_path(avis)) + = dynamic_tab_item('Avis', instruction_instructeur_avis_path(avis), notification: avis.answer.blank?) + = dynamic_tab_item('Messagerie', messagerie_instructeur_avis_path(avis)) diff --git a/app/views/instructeurs/avis/index.html.haml b/app/views/instructeurs/avis/index.html.haml index c3e694554..329995b7d 100644 --- a/app/views/instructeurs/avis/index.html.haml +++ b/app/views/instructeurs/avis/index.html.haml @@ -1,4 +1,4 @@ -- avis_statut = (@statut == Gestionnaires::AvisController::A_DONNER_STATUS) ? 'à donner' : 'rendus' +- avis_statut = (@statut == Instructeurs::AvisController::A_DONNER_STATUS) ? 'à donner' : 'rendus' - content_for(:title, "Avis #{avis_statut}") .sub-header @@ -7,14 +7,14 @@ %h1.tab-title Avis %ul.tabs = tab_item('avis à donner', - gestionnaire_avis_index_path(statut: Gestionnaires::AvisController::A_DONNER_STATUS), - active: @statut == Gestionnaires::AvisController::A_DONNER_STATUS, + instructeur_avis_index_path(statut: Instructeurs::AvisController::A_DONNER_STATUS), + active: @statut == Instructeurs::AvisController::A_DONNER_STATUS, badge: @avis_a_donner.count, notification: @avis_a_donner.any?) = tab_item("avis #{'donné'.pluralize(@avis_donnes.count)}", - gestionnaire_avis_index_path(statut: Gestionnaires::AvisController::DONNES_STATUS), - active: @statut == Gestionnaires::AvisController::DONNES_STATUS, + instructeur_avis_index_path(statut: Instructeurs::AvisController::DONNES_STATUS), + active: @statut == Instructeurs::AvisController::DONNES_STATUS, badge: @avis_donnes.count) .container @@ -29,11 +29,11 @@ - @avis.each do |avis| %tr %td.number-col - = link_to(gestionnaire_avis_path(avis), class: 'cell-link') do + = link_to(instructeur_avis_path(avis), class: 'cell-link') do %span.icon.folder #{avis.dossier.id} - %td= link_to(avis.dossier.user.email, gestionnaire_avis_path(avis), class: 'cell-link') - %td= link_to(avis.dossier.procedure.libelle, gestionnaire_avis_path(avis), class: 'cell-link') + %td= link_to(avis.dossier.user.email, instructeur_avis_path(avis), class: 'cell-link') + %td= link_to(avis.dossier.procedure.libelle, instructeur_avis_path(avis), class: 'cell-link') = paginate(@avis) - else %h2.empty-text Aucun avis diff --git a/app/views/instructeurs/avis/instruction.html.haml b/app/views/instructeurs/avis/instruction.html.haml index dadee5f12..b8d5eb2f9 100644 --- a/app/views/instructeurs/avis/instruction.html.haml +++ b/app/views/instructeurs/avis/instruction.html.haml @@ -11,7 +11,7 @@ %span.date Demande d'avis envoyée le #{l(@avis.created_at, format: '%d/%m/%y')} %p.introduction= @avis.introduction - = form_for @avis, url: gestionnaire_avis_path(@avis), html: { class: 'form' } do |f| + = form_for @avis, url: instructeur_avis_path(@avis), html: { class: 'form' } do |f| = f.text_area :answer, rows: 3, placeholder: 'Votre avis', required: true = render partial: "shared/attachment/update", locals: { attachment: @avis.piece_justificative_file.attachment, user_can_destroy: true, form: f } @@ -28,7 +28,7 @@ = f.submit 'Envoyer votre avis', class: 'button send' - if !@dossier.termine? - = render partial: "gestionnaires/shared/avis/form", locals: { url: avis_gestionnaire_avis_path(@avis), must_be_confidentiel: @avis.confidentiel?, avis: @new_avis } + = render partial: "instructeurs/shared/avis/form", locals: { url: avis_instructeur_avis_path(@avis), must_be_confidentiel: @avis.confidentiel?, avis: @new_avis } - - if @dossier.avis_for(current_gestionnaire).present? - = render partial: 'gestionnaires/shared/avis/list', locals: { avis: @dossier.avis_for(current_gestionnaire), avis_seen_at: nil } + - if @dossier.avis_for(current_instructeur).present? + = render partial: 'instructeurs/shared/avis/list', locals: { avis: @dossier.avis_for(current_instructeur), avis_seen_at: nil } diff --git a/app/views/instructeurs/avis/messagerie.html.haml b/app/views/instructeurs/avis/messagerie.html.haml index 0847cb19d..46e64e69a 100644 --- a/app/views/instructeurs/avis/messagerie.html.haml +++ b/app/views/instructeurs/avis/messagerie.html.haml @@ -2,4 +2,4 @@ = render partial: 'header', locals: { avis: @avis, dossier: @dossier } -= render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, connected_user: current_gestionnaire, messagerie_seen_at: nil, new_commentaire: @commentaire, form_url: commentaire_gestionnaire_avis_path(@avis) } += render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, connected_user: current_instructeur, messagerie_seen_at: nil, new_commentaire: @commentaire, form_url: commentaire_instructeur_avis_path(@avis) } diff --git a/app/views/instructeurs/avis/sign_up.html.haml b/app/views/instructeurs/avis/sign_up.html.haml index 0ce22571a..29049546e 100644 --- a/app/views/instructeurs/avis/sign_up.html.haml +++ b/app/views/instructeurs/avis/sign_up.html.haml @@ -4,7 +4,7 @@ %p.description= @dossier.procedure.libelle %p.dossier Dossier nº #{@dossier.id} .column - = form_for(Gestionnaire.new, url: { controller: "gestionnaires/avis", action: :create_gestionnaire }, method: :post, html: { class: "form" }) do |f| + = form_for(Instructeur.new, url: { controller: "instructeurs/avis", action: :create_instructeur }, method: :post, html: { class: "form" }) do |f| %h1 Créez-vous un compte = f.label :email, "Email" diff --git a/app/views/instructeurs/dossiers/_envoyer_dossier_block.html.haml b/app/views/instructeurs/dossiers/_envoyer_dossier_block.html.haml index 20fccfb17..1fe8d5714 100644 --- a/app/views/instructeurs/dossiers/_envoyer_dossier_block.html.haml +++ b/app/views/instructeurs/dossiers/_envoyer_dossier_block.html.haml @@ -4,7 +4,7 @@ %p.tab-paragraph Vous êtes le seul instructeur assigné sur cette démarche - else - = form_for dossier, url: send_to_instructeurs_gestionnaire_dossier_path(dossier.procedure, dossier), method: :post, html: { class: 'form recipients-form' } do |f| + = form_for dossier, url: send_to_instructeurs_instructeur_dossier_path(dossier.procedure, dossier), method: :post, html: { class: 'form recipients-form' } do |f| .flex.justify-start.align-start = select_tag(:recipients, options_from_collection_for_select(potential_recipients, :id, :email), diff --git a/app/views/instructeurs/dossiers/_header.html.haml b/app/views/instructeurs/dossiers/_header.html.haml index 77a9debbe..ca33abf99 100644 --- a/app/views/instructeurs/dossiers/_header.html.haml +++ b/app/views/instructeurs/dossiers/_header.html.haml @@ -3,7 +3,7 @@ .flex.justify-between %ul.breadcrumbs %li - = link_to gestionnaire_procedure_path(dossier.procedure), title: dossier.procedure.libelle do + = link_to instructeur_procedure_path(dossier.procedure), title: dossier.procedure.libelle do - if dossier.procedure.brouillon? %span.badge démarche en test = dossier.procedure.libelle.truncate_words(10) @@ -15,7 +15,7 @@ %span.icon.printer %ul.print-menu.dropdown-content %li - = link_to "Tout le dossier", print_gestionnaire_dossier_path(dossier.procedure, dossier), target: "_blank", rel: "noopener", class: "menu-item menu-link" + = link_to "Tout le dossier", print_instructeur_dossier_path(dossier.procedure, dossier), target: "_blank", rel: "noopener", class: "menu-item menu-link" %li = link_to "Uniquement cet onglet", "#", onclick: "window.print()", class: "menu-item menu-link" - if Flipflop.download_as_zip_enabled? && !PiecesJustificativesService.liste_pieces_justificatives(dossier).empty? @@ -25,36 +25,36 @@ %ul.print-menu.dropdown-content %li - if PiecesJustificativesService.pieces_justificatives_total_size(dossier) < Dossier::TAILLE_MAX_ZIP - = link_to "Télécharger toutes les pièces jointes", telecharger_pjs_gestionnaire_dossier_path(dossier.procedure, dossier), target: "_blank", rel: "noopener", class: "menu-item menu-link" + = link_to "Télécharger toutes les pièces jointes", telecharger_pjs_instructeur_dossier_path(dossier.procedure, dossier), target: "_blank", rel: "noopener", class: "menu-item menu-link" - else %p.menu-item Le téléchargement des pièces jointes est désactivé pour les dossiers de plus de #{number_to_human_size Dossier::TAILLE_MAX_ZIP}. - = render partial: "gestionnaires/procedures/dossier_actions", locals: { procedure: dossier.procedure, dossier: dossier, dossier_is_followed: current_gestionnaire&.follow?(dossier) } + = render partial: "instructeurs/procedures/dossier_actions", locals: { procedure: dossier.procedure, dossier: dossier, dossier_is_followed: current_instructeur&.follow?(dossier) } %span.state-button = render partial: "state_button", locals: { dossier: dossier } %ul.tabs - - notifications_summary = current_gestionnaire.notifications_for_dossier(dossier) + - notifications_summary = current_instructeur.notifications_for_dossier(dossier) = dynamic_tab_item('Demande', - gestionnaire_dossier_path(dossier.procedure, dossier), + instructeur_dossier_path(dossier.procedure, dossier), notification: notifications_summary[:demande]) = dynamic_tab_item('Annotations privées', - annotations_privees_gestionnaire_dossier_path(dossier.procedure, dossier), + annotations_privees_instructeur_dossier_path(dossier.procedure, dossier), notification: notifications_summary[:annotations_privees]) = dynamic_tab_item('Avis externes', - avis_gestionnaire_dossier_path(dossier.procedure, dossier), + avis_instructeur_dossier_path(dossier.procedure, dossier), notification: notifications_summary[:avis]) = dynamic_tab_item('Messagerie', - messagerie_gestionnaire_dossier_path(dossier.procedure, dossier), + messagerie_instructeur_dossier_path(dossier.procedure, dossier), notification: notifications_summary[:messagerie]) = dynamic_tab_item('Personnes impliquées', - personnes_impliquees_gestionnaire_dossier_path(dossier.procedure, dossier)) + personnes_impliquees_instructeur_dossier_path(dossier.procedure, dossier)) .container .print-header diff --git a/app/views/instructeurs/dossiers/_state_button.html.haml b/app/views/instructeurs/dossiers/_state_button.html.haml index 6fa054804..fb732382a 100644 --- a/app/views/instructeurs/dossiers/_state_button.html.haml +++ b/app/views/instructeurs/dossiers/_state_button.html.haml @@ -11,7 +11,7 @@ %h4 En construction Vous permettez à l'usager de modifier ses réponses au formulaire %li - = link_to passer_en_instruction_gestionnaire_dossier_path(dossier.procedure, dossier), method: :post, data: { remote: true, confirm: "Confirmez-vous le passage en instruction de ce dossier ?" } do + = link_to passer_en_instruction_instructeur_dossier_path(dossier.procedure, dossier), method: :post, data: { remote: true, confirm: "Confirmez-vous le passage en instruction de ce dossier ?" } do %span.icon.in-progress .dropdown-description %h4 Passer en instruction @@ -19,7 +19,7 @@ - if dossier.en_instruction? %li - = link_to repasser_en_construction_gestionnaire_dossier_path(dossier.procedure, dossier), method: :post, data: { remote:true, confirm: "Confirmez-vous le passage en construction de ce dossier ?" } do + = link_to repasser_en_construction_instructeur_dossier_path(dossier.procedure, dossier), method: :post, data: { remote:true, confirm: "Confirmez-vous le passage en construction de ce dossier ?" } do %span.icon.edit .dropdown-description %h4 Repasser en construction @@ -47,9 +47,9 @@ .dropdown-description %h4 Refuser L'usager sera notifié que son dossier a été refusé - = render partial: 'gestionnaires/dossiers/state_button_motivation', locals: { dossier: dossier, popup_title: 'Accepter le dossier', placeholder: 'Expliquez au demandeur pourquoi ce dossier est accepté (facultatif)', popup_class: 'accept', process_action: 'accepter', title: 'Accepter', confirm: "Confirmez-vous l'acceptation ce dossier ?" } - = render partial: 'gestionnaires/dossiers/state_button_motivation', locals: { dossier: dossier, popup_title: 'Classer le dossier sans suite', placeholder: 'Expliquez au demandeur pourquoi ce dossier est classé sans suite (obligatoire)', popup_class: 'without-continuation', process_action: 'classer_sans_suite', title: 'Classer sans suite', confirm: 'Confirmez-vous le classement sans suite de ce dossier ?' } - = render partial: 'gestionnaires/dossiers/state_button_motivation', locals: { dossier: dossier, popup_title: 'Refuser le dossier', placeholder: 'Expliquez au demandeur pourquoi ce dossier est refusé (obligatoire)', popup_class: 'refuse', process_action: 'refuser', title: 'Refuser', confirm: 'Confirmez-vous le refus de ce dossier ?' } + = render partial: 'instructeurs/dossiers/state_button_motivation', locals: { dossier: dossier, popup_title: 'Accepter le dossier', placeholder: 'Expliquez au demandeur pourquoi ce dossier est accepté (facultatif)', popup_class: 'accept', process_action: 'accepter', title: 'Accepter', confirm: "Confirmez-vous l'acceptation ce dossier ?" } + = render partial: 'instructeurs/dossiers/state_button_motivation', locals: { dossier: dossier, popup_title: 'Classer le dossier sans suite', placeholder: 'Expliquez au demandeur pourquoi ce dossier est classé sans suite (obligatoire)', popup_class: 'without-continuation', process_action: 'classer_sans_suite', title: 'Classer sans suite', confirm: 'Confirmez-vous le classement sans suite de ce dossier ?' } + = render partial: 'instructeurs/dossiers/state_button_motivation', locals: { dossier: dossier, popup_title: 'Refuser le dossier', placeholder: 'Expliquez au demandeur pourquoi ce dossier est refusé (obligatoire)', popup_class: 'refuse', process_action: 'refuser', title: 'Refuser', confirm: 'Confirmez-vous le refus de ce dossier ?' } - else - if dossier.motivation.present? || dossier.attestation.present? @@ -65,13 +65,13 @@ - if dossier.attestation.present? %h4.title Attestation %p.attestation L'acceptation du dossier a envoyé automatiquement une attestation au demandeur - = link_to "Voir l'attestation", attestation_gestionnaire_dossier_path(dossier.procedure, dossier), target: '_blank', rel: 'noopener', class: 'button' + = link_to "Voir l'attestation", attestation_instructeur_dossier_path(dossier.procedure, dossier), target: '_blank', rel: 'noopener', class: 'button' - if dossier.refuse? || dossier.sans_suite? %ul.dropdown-items.with-top-border %li - = link_to repasser_en_instruction_gestionnaire_dossier_path(dossier.procedure, dossier), method: :post, data: { remote:true, confirm: "Voulez vous remettre le dossier #{dossier.id} en instruction ?" } do + = link_to repasser_en_instruction_instructeur_dossier_path(dossier.procedure, dossier), method: :post, data: { remote:true, confirm: "Voulez vous remettre le dossier #{dossier.id} en instruction ?" } do %span.icon.in-progress .dropdown-description %h4 Repasser en instruction diff --git a/app/views/instructeurs/dossiers/_state_button_motivation.html.haml b/app/views/instructeurs/dossiers/_state_button_motivation.html.haml index f0310eb6a..d071c05b2 100644 --- a/app/views/instructeurs/dossiers/_state_button_motivation.html.haml +++ b/app/views/instructeurs/dossiers/_state_button_motivation.html.haml @@ -3,7 +3,7 @@ %span.icon{ class: popup_class } #{popup_title} - = form_tag(terminer_gestionnaire_dossier_path(dossier.procedure, dossier), remote: true, method: :post, class: 'form') do + = form_tag(terminer_instructeur_dossier_path(dossier.procedure, dossier), remote: true, method: :post, class: 'form') do - if title == 'Accepter' = text_area :dossier, :motivation, class: 'motivation-text-area', placeholder: placeholder, required: false %p.help @@ -34,6 +34,6 @@ = file_field :dossier, :justificatif_motivation, direct_upload: true .text-right - if title == 'Accepter' && dossier.procedure.attestation_template&.activated? - = link_to "Voir l'attestation", apercu_attestation_gestionnaire_dossier_path(dossier.procedure, dossier), target: '_blank', rel: 'noopener', class: 'button', title: "Voir l'attestation qui sera envoyée au demandeur" + = link_to "Voir l'attestation", apercu_attestation_instructeur_dossier_path(dossier.procedure, dossier), target: '_blank', rel: 'noopener', class: 'button', title: "Voir l'attestation qui sera envoyée au demandeur" %span.button{ onclick: 'DS.motivationCancel();' } Annuler = button_tag 'Valider la décision', name: :process_action, value: process_action, class: 'button primary', title: title, data: { confirm: confirm } diff --git a/app/views/instructeurs/dossiers/annotations_privees.html.haml b/app/views/instructeurs/dossiers/annotations_privees.html.haml index fb3efa79d..4d3181b7e 100644 --- a/app/views/instructeurs/dossiers/annotations_privees.html.haml +++ b/app/views/instructeurs/dossiers/annotations_privees.html.haml @@ -5,7 +5,7 @@ #dossier-annotations-privees.container - if @dossier.champs_private.present? %section - = form_for @dossier, url: annotations_gestionnaire_dossier_path(@dossier.procedure, @dossier), html: { class: 'form' } do |f| + = form_for @dossier, url: annotations_instructeur_dossier_path(@dossier.procedure, @dossier), html: { class: 'form' } do |f| = f.fields_for :champs_private, f.object.champs_private do |champ_form| - champ = champ_form.object = render partial: "shared/dossiers/editable_champs/editable_champ", diff --git a/app/views/instructeurs/dossiers/avis.html.haml b/app/views/instructeurs/dossiers/avis.html.haml index 45c28b4b9..544f6547d 100644 --- a/app/views/instructeurs/dossiers/avis.html.haml +++ b/app/views/instructeurs/dossiers/avis.html.haml @@ -4,10 +4,10 @@ .container - if !@dossier.termine? - = render partial: "gestionnaires/shared/avis/form", locals: { url: avis_gestionnaire_dossier_path(@dossier.procedure, @dossier), must_be_confidentiel: false, avis: @avis } + = render partial: "instructeurs/shared/avis/form", locals: { url: avis_instructeur_dossier_path(@dossier.procedure, @dossier), must_be_confidentiel: false, avis: @avis } - if @dossier.avis.present? - = render partial: 'gestionnaires/shared/avis/list', locals: { avis: @dossier.avis, avis_seen_at: @avis_seen_at } + = render partial: 'instructeurs/shared/avis/list', locals: { avis: @dossier.avis, avis_seen_at: @avis_seen_at } - if @dossier.termine? && !@dossier.avis.present? .blank-tab diff --git a/app/views/instructeurs/dossiers/messagerie.html.haml b/app/views/instructeurs/dossiers/messagerie.html.haml index 096d37588..f98fbde63 100644 --- a/app/views/instructeurs/dossiers/messagerie.html.haml +++ b/app/views/instructeurs/dossiers/messagerie.html.haml @@ -2,4 +2,4 @@ = render partial: "header", locals: { dossier: @dossier } -= render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, connected_user: current_gestionnaire, messagerie_seen_at: @messagerie_seen_at , new_commentaire: @commentaire, form_url: commentaire_gestionnaire_dossier_path(@dossier.procedure, @dossier) } += render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, connected_user: current_instructeur, messagerie_seen_at: @messagerie_seen_at , new_commentaire: @commentaire, form_url: commentaire_instructeur_dossier_path(@dossier.procedure, @dossier) } diff --git a/app/views/instructeurs/dossiers/personnes_impliquees.html.haml b/app/views/instructeurs/dossiers/personnes_impliquees.html.haml index 44a444e92..7a5ac4cde 100644 --- a/app/views/instructeurs/dossiers/personnes_impliquees.html.haml +++ b/app/views/instructeurs/dossiers/personnes_impliquees.html.haml @@ -3,13 +3,13 @@ = render partial: "header", locals: { dossier: @dossier } .personnes-impliquees.container - = render partial: 'gestionnaires/dossiers/envoyer_dossier_block', locals: { dossier: @dossier, potential_recipients: @potential_recipients } + = render partial: 'instructeurs/dossiers/envoyer_dossier_block', locals: { dossier: @dossier, potential_recipients: @potential_recipients } - = render partial: 'gestionnaires/dossiers/personnes_impliquees_block', locals: { emails_collection: @following_instructeurs_emails, title: "Instructeurs qui suivent actuellement le dossier", blank: "Aucun instructeur ne suit ce dossier" } + = render partial: 'instructeurs/dossiers/personnes_impliquees_block', locals: { emails_collection: @following_instructeurs_emails, title: "Instructeurs qui suivent actuellement le dossier", blank: "Aucun instructeur ne suit ce dossier" } - if @previous_following_instructeurs_emails.present? - = render partial: 'gestionnaires/dossiers/personnes_impliquees_block', locals: { emails_collection: @previous_following_instructeurs_emails, title: "Instructeurs ayant précédemment suivi le dossier", blank: " " } + = render partial: 'instructeurs/dossiers/personnes_impliquees_block', locals: { emails_collection: @previous_following_instructeurs_emails, title: "Instructeurs ayant précédemment suivi le dossier", blank: " " } - = render partial: 'gestionnaires/dossiers/personnes_impliquees_block', locals: { emails_collection: @avis_emails, title: "Personnes à qui un avis a été demandé", blank: "Aucun avis n'a été demandé" } + = render partial: 'instructeurs/dossiers/personnes_impliquees_block', locals: { emails_collection: @avis_emails, title: "Personnes à qui un avis a été demandé", blank: "Aucun avis n'a été demandé" } - = render partial: 'gestionnaires/dossiers/personnes_impliquees_block', locals: { emails_collection: @invites_emails, title: "Personnes invitées à consulter ce dossier", blank: "Aucune personne n'a été invitée à consulter ce dossier" } + = render partial: 'instructeurs/dossiers/personnes_impliquees_block', locals: { emails_collection: @invites_emails, title: "Personnes invitées à consulter ce dossier", blank: "Aucune personne n'a été invitée à consulter ce dossier" } diff --git a/app/views/instructeurs/dossiers/print.html.haml b/app/views/instructeurs/dossiers/print.html.haml index 2cf7bfbc2..7702f8ed4 100644 --- a/app/views/instructeurs/dossiers/print.html.haml +++ b/app/views/instructeurs/dossiers/print.html.haml @@ -49,7 +49,7 @@ %ul.messages-list - @dossier.commentaires.with_attached_piece_jointe.each do |commentaire| %li - = render partial: "shared/dossiers/messages/message", locals: { commentaire: commentaire, connected_user: current_gestionnaire, messagerie_seen_at: nil, show_reply_button: false } + = render partial: "shared/dossiers/messages/message", locals: { commentaire: commentaire, connected_user: current_instructeur, messagerie_seen_at: nil, show_reply_button: false } %script{ type: "text/javascript" } window.print(); diff --git a/app/views/instructeurs/passwords/edit.html.haml b/app/views/instructeurs/passwords/edit.html.haml index 157ab3072..802453c66 100644 --- a/app/views/instructeurs/passwords/edit.html.haml +++ b/app/views/instructeurs/passwords/edit.html.haml @@ -1,7 +1,7 @@ = devise_error_messages! #form-login - %h2#gestionnaire_login Changement de mot de passe + %h2#instructeur_login Changement de mot de passe %br %br diff --git a/app/views/instructeurs/passwords/new.html.haml b/app/views/instructeurs/passwords/new.html.haml index 2b9aec8e1..cb55a2bf1 100644 --- a/app/views/instructeurs/passwords/new.html.haml +++ b/app/views/instructeurs/passwords/new.html.haml @@ -2,7 +2,7 @@ %br #form-login - %h2#gestionnaire_login Mot de passe oublié + %h2#instructeur_login Mot de passe oublié %br %br diff --git a/app/views/instructeurs/procedures/_dossier_actions.html.haml b/app/views/instructeurs/procedures/_dossier_actions.html.haml index 12ac4eff3..44b87a2b9 100644 --- a/app/views/instructeurs/procedures/_dossier_actions.html.haml +++ b/app/views/instructeurs/procedures/_dossier_actions.html.haml @@ -1,19 +1,19 @@ - if dossier.en_construction_ou_instruction? - if dossier_is_followed - = link_to unfollow_gestionnaire_dossier_path(procedure, dossier), method: :patch, class: 'button' do + = link_to unfollow_instructeur_dossier_path(procedure, dossier), method: :patch, class: 'button' do %span.icon.unfollow> Ne plus suivre - else - = link_to follow_gestionnaire_dossier_path(procedure, dossier), method: :patch, class: 'button' do + = link_to follow_instructeur_dossier_path(procedure, dossier), method: :patch, class: 'button' do %span.icon.follow> Suivre le dossier - elsif dossier.termine? - if dossier.archived - = link_to unarchive_gestionnaire_dossier_path(procedure, dossier), method: :patch, class: 'button' do + = link_to unarchive_instructeur_dossier_path(procedure, dossier), method: :patch, class: 'button' do %span.icon.unarchive> Désarchiver le dossier - else - = link_to archive_gestionnaire_dossier_path(procedure, dossier), method: :patch, class: 'button' do + = link_to archive_instructeur_dossier_path(procedure, dossier), method: :patch, class: 'button' do %span.icon.archive> Archiver le dossier diff --git a/app/views/instructeurs/procedures/_header_field.html.haml b/app/views/instructeurs/procedures/_header_field.html.haml index 10cdcb1fb..ee8d56d2a 100644 --- a/app/views/instructeurs/procedures/_header_field.html.haml +++ b/app/views/instructeurs/procedures/_header_field.html.haml @@ -1,5 +1,5 @@ %th{ class: classname } - = link_to update_sort_gestionnaire_procedure_path(@procedure, table: field['table'], column: field['column']) do + = link_to update_sort_instructeur_procedure_path(@procedure, table: field['table'], column: field['column']) do = field['label'] - if @procedure_presentation.sort['table'] == field['table'] && @procedure_presentation.sort['column'] == field['column'] - if @procedure_presentation.sort['order'] == 'asc' diff --git a/app/views/instructeurs/procedures/email_notifications.html.haml b/app/views/instructeurs/procedures/email_notifications.html.haml index a061b5d38..6cb52c508 100644 --- a/app/views/instructeurs/procedures/email_notifications.html.haml +++ b/app/views/instructeurs/procedures/email_notifications.html.haml @@ -7,7 +7,7 @@ .container %h1 Notifications par email - = form_for @assign_to, url: update_email_notifications_gestionnaire_procedure_path(@procedure), html: { class: 'form' } do |form| + = form_for @assign_to, url: update_email_notifications_instructeur_procedure_path(@procedure), html: { class: 'form' } do |form| .explication Configurez sur cette page les notifications que vous souhaitez recevoir par email pour cette démarche. @@ -44,5 +44,5 @@ Non .send-wrapper - = link_to "Revenir à la procédure", gestionnaire_procedure_path(@procedure), class: 'button mr-1' + = link_to "Revenir à la procédure", instructeur_procedure_path(@procedure), class: 'button mr-1' = form.submit "Enregistrer", class: "button primary" diff --git a/app/views/instructeurs/procedures/index.html.haml b/app/views/instructeurs/procedures/index.html.haml index d8a1be838..d1566afb0 100644 --- a/app/views/instructeurs/procedures/index.html.haml +++ b/app/views/instructeurs/procedures/index.html.haml @@ -6,7 +6,7 @@ %ul.procedure-list - @procedures.each do |p| %li.procedure-item.flex.align-start - = link_to(gestionnaire_procedure_path(p)) do + = link_to(instructeur_procedure_path(p)) do .flex .procedure-logo{ style: p.logo.present? ? "background-image: url(#{p.logo.url})" : nil } @@ -18,7 +18,7 @@ %ul.procedure-stats.flex %li %object - = link_to(gestionnaire_procedure_path(p, statut: 'a-suivre')) do + = link_to(instructeur_procedure_path(p, statut: 'a-suivre')) do - a_suivre_count = @dossiers_a_suivre_count_per_procedure[p.id] || 0 .stats-number = a_suivre_count @@ -26,8 +26,8 @@ à suivre %li %object - = link_to(gestionnaire_procedure_path(p, statut: 'suivis')) do - - if current_gestionnaire.notifications_per_procedure[p.id].present? + = link_to(instructeur_procedure_path(p, statut: 'suivis')) do + - if current_instructeur.notifications_per_procedure[p.id].present? %span.notifications{ 'aria-label': "notifications" } - followed_count = @followed_dossiers_count_per_procedure[p.id] || 0 .stats-number @@ -36,8 +36,8 @@ = t('pluralize.followed', count: followed_count) %li %object - = link_to(gestionnaire_procedure_path(p, statut: 'traites')) do - - if current_gestionnaire.notifications_per_procedure(:termine)[p.id].present? + = link_to(instructeur_procedure_path(p, statut: 'traites')) do + - if current_instructeur.notifications_per_procedure(:termine)[p.id].present? %span.notifications{ 'aria-label': "notifications" } - termines_count = @dossiers_termines_count_per_procedure[p.id] || 0 .stats-number @@ -46,7 +46,7 @@ = t('pluralize.processed', count: termines_count) %li %object - = link_to(gestionnaire_procedure_path(p, statut: 'tous')) do + = link_to(instructeur_procedure_path(p, statut: 'tous')) do - dossier_count = @dossiers_count_per_procedure[p.id] || 0 .stats-number = dossier_count @@ -54,7 +54,7 @@ = t('pluralize.case', count: dossier_count) %li %object - = link_to(gestionnaire_procedure_path(p, statut: 'archives')) do + = link_to(instructeur_procedure_path(p, statut: 'archives')) do - archived_count = @dossiers_archived_count_per_procedure[p.id] || 0 .stats-number = archived_count diff --git a/app/views/instructeurs/procedures/show.html.haml b/app/views/instructeurs/procedures/show.html.haml index f40c7c81d..f36e0c324 100644 --- a/app/views/instructeurs/procedures/show.html.haml +++ b/app/views/instructeurs/procedures/show.html.haml @@ -9,34 +9,34 @@ .procedure-header %h1= procedure_libelle @procedure - = link_to 'configurez vos notifications', email_notifications_gestionnaire_procedure_path(@procedure), class: 'notifications' + = link_to 'configurez vos notifications', email_notifications_instructeur_procedure_path(@procedure), class: 'notifications' %ul.tabs = tab_item('à suivre', - gestionnaire_procedure_path(@procedure, statut: 'a-suivre'), + instructeur_procedure_path(@procedure, statut: 'a-suivre'), active: @statut == 'a-suivre', badge: @a_suivre_dossiers.count) = tab_item(t('pluralize.followed', count: @followed_dossiers.count), - gestionnaire_procedure_path(@procedure, statut: 'suivis'), + instructeur_procedure_path(@procedure, statut: 'suivis'), active: @statut == 'suivis', badge: @followed_dossiers.count, - notification: current_gestionnaire.notifications_for_procedure(@procedure).present?) + notification: current_instructeur.notifications_for_procedure(@procedure).present?) = tab_item(t('pluralize.processed', count: @termines_dossiers.count), - gestionnaire_procedure_path(@procedure, statut: 'traites'), + instructeur_procedure_path(@procedure, statut: 'traites'), active: @statut == 'traites', badge: @termines_dossiers.count, - notification: current_gestionnaire.notifications_for_procedure(@procedure, :termine).present?) + notification: current_instructeur.notifications_for_procedure(@procedure, :termine).present?) = tab_item('tous les dossiers', - gestionnaire_procedure_path(@procedure, statut: 'tous'), + instructeur_procedure_path(@procedure, statut: 'tous'), active: @statut == 'tous', badge: @all_state_dossiers.count) = tab_item(t('pluralize.archived', count: @archived_dossiers.count), - gestionnaire_procedure_path(@procedure, statut: 'archives'), + instructeur_procedure_path(@procedure, statut: 'archives'), active: @statut == 'archives', badge: @archived_dossiers.count) @@ -60,7 +60,7 @@ %button.button.dropdown-button Filtrer .dropdown-content.left-aligned.fade-in-down - = form_tag add_filter_gestionnaire_procedure_path(@procedure), method: :post, class: 'dropdown-form large' do + = form_tag add_filter_instructeur_procedure_path(@procedure), method: :post, class: 'dropdown-form large' do = label_tag :field, "Colonne" = select_tag :field, options_for_select(@available_fields_to_filters) %br @@ -77,7 +77,7 @@ - if i > 0 ou %span.filter - = link_to remove_filter_gestionnaire_procedure_path(@procedure, { statut: @statut, table: filter['table'], column: filter['column'], value: filter['value'] }) do + = link_to remove_filter_instructeur_procedure_path(@procedure, { statut: @statut, table: filter['table'], column: filter['column'], value: filter['value'] }) do %img.close-icon{ src: image_url("close.svg") } = "#{filter['label'].truncate(50)} : #{filter['value']}" %table.table.dossiers-table.hoverable @@ -100,7 +100,7 @@ %button.button.dropdown-button Personnaliser .dropdown-content.fade-in-down - = form_tag update_displayed_fields_gestionnaire_procedure_path(@procedure), method: :patch, class: 'dropdown-form columns-form' do + = form_tag update_displayed_fields_instructeur_procedure_path(@procedure), method: :patch, class: 'dropdown-form columns-form' do = select_tag :values, options_for_select(@procedure_presentation.fields_for_select, selected: @displayed_fields_values), @@ -112,23 +112,23 @@ - @dossiers.each do |dossier| %tr %td.folder-col - = link_to(gestionnaire_dossier_path(@procedure, dossier), class: 'cell-link') do + = link_to(instructeur_dossier_path(@procedure, dossier), class: 'cell-link') do %span.icon.folder - - if current_gestionnaire.notifications_for_procedure(@procedure, :not_archived).include?(dossier.id) + - if current_instructeur.notifications_for_procedure(@procedure, :not_archived).include?(dossier.id) %span.notifications{ 'aria-label': 'notifications' } %td.number-col - = link_to(gestionnaire_dossier_path(@procedure, dossier), class: 'cell-link') do + = link_to(instructeur_dossier_path(@procedure, dossier), class: 'cell-link') do = dossier.id - @procedure_presentation.displayed_field_values(dossier).each do |value| %td / FIXME: value should automatically fallback to `""` instead of nil / #get_value should call to_s on the champ - = link_to(value || "", gestionnaire_dossier_path(@procedure, dossier), class: 'cell-link') + = link_to(value || "", instructeur_dossier_path(@procedure, dossier), class: 'cell-link') %td.status-col - = link_to(gestionnaire_dossier_path(@procedure, dossier), class: 'cell-link') do + = link_to(instructeur_dossier_path(@procedure, dossier), class: 'cell-link') do = render partial: 'shared/dossiers/status_badge', locals: { dossier: dossier } %td.action-col.follow-col= render partial: 'dossier_actions', locals: { procedure: @procedure, dossier: dossier, dossier_is_followed: @followed_dossiers_id.include?(dossier.id) } = paginate @dossiers diff --git a/app/views/instructeurs/recherche/index.html.haml b/app/views/instructeurs/recherche/index.html.haml index b6dcb6347..2ccce0994 100644 --- a/app/views/instructeurs/recherche/index.html.haml +++ b/app/views/instructeurs/recherche/index.html.haml @@ -21,16 +21,16 @@ / (due to dossier_linked_path) per result %tr %td.folder-col - = link_to(dossier_linked_path(current_gestionnaire, dossier), class: 'cell-link') do + = link_to(dossier_linked_path(current_instructeur, dossier), class: 'cell-link') do %span.icon.folder %td.number-col - = link_to(dossier_linked_path(current_gestionnaire, dossier), class: 'cell-link') do + = link_to(dossier_linked_path(current_instructeur, dossier), class: 'cell-link') do = dossier.id - %td= link_to(dossier.procedure.libelle, dossier_linked_path(current_gestionnaire, dossier), class: 'cell-link') - %td= link_to(dossier.user.email, dossier_linked_path(current_gestionnaire, dossier), class: 'cell-link') + %td= link_to(dossier.procedure.libelle, dossier_linked_path(current_instructeur, dossier), class: 'cell-link') + %td= link_to(dossier.user.email, dossier_linked_path(current_instructeur, dossier), class: 'cell-link') %td.status-col - = link_to(dossier_linked_path(current_gestionnaire, dossier), class: 'cell-link') do + = link_to(dossier_linked_path(current_instructeur, dossier), class: 'cell-link') do = render partial: 'shared/dossiers/status_badge', locals: { dossier: dossier } - %td.action-col.follow-col= render partial: 'gestionnaires/procedures/dossier_actions', locals: { procedure: dossier.procedure, dossier: dossier, dossier_is_followed: @followed_dossiers_id.include?(dossier.id) } + %td.action-col.follow-col= render partial: 'instructeurs/procedures/dossier_actions', locals: { procedure: dossier.procedure, dossier: dossier, dossier_is_followed: @followed_dossiers_id.include?(dossier.id) } - else %h2 Aucun dossier correspondant à votre recherche n'a été trouvé diff --git a/app/views/instructeurs/sessions/new.html.haml b/app/views/instructeurs/sessions/new.html.haml index 13a23e2c8..ada6dabbb 100644 --- a/app/views/instructeurs/sessions/new.html.haml +++ b/app/views/instructeurs/sessions/new.html.haml @@ -1,10 +1,10 @@ #form-login - %h2#gestionnaire_login Instructeur + %h2#instructeur_login Instructeur %br %br #new-user - = form_for @gestionnaire, url: gestionnaire_session_path, method: :post do |f| + = form_for @instructeur, url: instructeur_session_path, method: :post do |f| %h4 = f.label :email .input-group @@ -17,10 +17,10 @@ .input-group .input-group-addon %span.fa.fa-asterisk - = f.password_field :password, autocomplete: "off", class: 'form-control', value: @gestionnaire.password + = f.password_field :password, autocomplete: "off", class: 'form-control', value: @instructeur.password %br %br .actions = f.submit "Se connecter", class: 'btn btn-primary' %br - = render "gestionnaires/shared/links" + = render "instructeurs/shared/links" diff --git a/app/views/instructeurs/shared/avis/_list.html.haml b/app/views/instructeurs/shared/avis/_list.html.haml index cc3c25282..d86914cc1 100644 --- a/app/views/instructeurs/shared/avis/_list.html.haml +++ b/app/views/instructeurs/shared/avis/_list.html.haml @@ -9,7 +9,7 @@ .width-100 %h2.claimant Demandeur : - %span.email= (avis.claimant.email == current_gestionnaire.email) ? 'Vous' : avis.claimant.email + %span.email= (avis.claimant.email == current_instructeur.email) ? 'Vous' : avis.claimant.email - if avis.confidentiel? %span.confidentiel confidentiel @@ -21,8 +21,8 @@ .answer.flex.align-start %span.icon.bubble.avis-icon .width-100 - %h2.gestionnaire - = (avis.email_to_display == current_gestionnaire.email) ? 'Vous' : avis.email_to_display + %h2.instructeur + = (avis.email_to_display == current_instructeur.email) ? 'Vous' : avis.email_to_display - if avis.answer.present? %span.date{ class: highlight_if_unseen_class(avis_seen_at, avis.updated_at) } Réponse donnée le #{l(avis.updated_at, format: '%d/%m/%y à %H:%M')} diff --git a/app/views/layouts/_account_dropdown.haml b/app/views/layouts/_account_dropdown.haml index 181e23687..db7440911 100644 --- a/app/views/layouts/_account_dropdown.haml +++ b/app/views/layouts/_account_dropdown.haml @@ -16,9 +16,9 @@ = link_to dossiers_path, class: "menu-item menu-link" do = image_tag "icons/switch-profile.svg" Passer en usager - - if gestionnaire_signed_in? && nav_bar_profile != :gestionnaire + - if instructeur_signed_in? && nav_bar_profile != :instructeur %li - = link_to gestionnaire_procedures_path, class: "menu-item menu-link" do + = link_to instructeur_procedures_path, class: "menu-item menu-link" do = image_tag "icons/switch-profile.svg" Passer en instructeur - if administrateur_signed_in? && nav_bar_profile != :administrateur diff --git a/app/views/layouts/_credentials.html.haml b/app/views/layouts/_credentials.html.haml index 0f5457453..dc8006fd0 100644 --- a/app/views/layouts/_credentials.html.haml +++ b/app/views/layouts/_credentials.html.haml @@ -1,4 +1,4 @@ .dropdown-menu#credentials .description= t("utils.deconnexion") - = @current_gestionnaire.email if @current_gestionnaire + = @current_instructeur.email if @current_instructeur = @current_user.email if @current_user diff --git a/app/views/layouts/_new_header.haml b/app/views/layouts/_new_header.haml index 8bb1ca264..0ffb8eda5 100644 --- a/app/views/layouts/_new_header.haml +++ b/app/views/layouts/_new_header.haml @@ -9,17 +9,17 @@ .flex.align-center = link_to '', root_path_for_profile(nav_bar_profile), class: "header-logo", title: "Revenir à l’accueil" - - if nav_bar_profile == :gestionnaire && gestionnaire_signed_in? + - if nav_bar_profile == :instructeur && instructeur_signed_in? - current_url = request.path_info %ul.header-tabs - - if current_gestionnaire.visible_procedures.count > 0 + - if current_instructeur.visible_procedures.count > 0 %li - = active_link_to "Démarches", gestionnaire_procedures_path, active: :inclusive, class: 'tab-link' - - if current_gestionnaire.avis.count > 0 + = active_link_to "Démarches", instructeur_procedures_path, active: :inclusive, class: 'tab-link' + - if current_instructeur.avis.count > 0 %li - = active_link_to gestionnaire_avis_index_path, active: :inclusive, class: 'tab-link' do + = active_link_to instructeur_avis_index_path, active: :inclusive, class: 'tab-link' do Avis - - avis_counter = current_gestionnaire.avis.without_answer.count + - avis_counter = current_instructeur.avis.without_answer.count - if avis_counter > 0 %span.badge.warning= avis_counter @@ -29,10 +29,10 @@ = active_link_to "Dossiers", dossiers_path, active: :inclusive, class: 'tab-link' %ul.header-right-content - - if nav_bar_profile == :gestionnaire && gestionnaire_signed_in? + - if nav_bar_profile == :instructeur && instructeur_signed_in? %li .header-search - = form_tag gestionnaire_recherche_path, method: :get, class: "form" do + = form_tag instructeur_recherche_path, method: :get, class: "form" do = text_field_tag "q", "#{@search_terms if @search_terms.present?}", placeholder: "Rechercher un dossier" %button{ title: "Rechercher" } = image_tag "icons/search-blue.svg" @@ -45,7 +45,7 @@ %button{ title: "Rechercher" } = image_tag "icons/search-blue.svg" - - if gestionnaire_signed_in? || user_signed_in? + - if instructeur_signed_in? || user_signed_in? %li = render partial: 'layouts/account_dropdown', locals: { nav_bar_profile: nav_bar_profile } @@ -64,8 +64,8 @@ - elsif procedure.present? && (nav_bar_profile == :user || nav_bar_profile == :guest) = render partial: 'shared/help/help_dropdown_procedure', locals: { procedure: procedure } - - elsif nav_bar_profile == :gestionnaire - = render partial: 'shared/help/help_dropdown_gestionnaire' + - elsif nav_bar_profile == :instructeur + = render partial: 'shared/help/help_dropdown_instructeur' - else = render partial: 'shared/help/help_button' diff --git a/app/views/layouts/_switch_devise_profile_module.html.haml b/app/views/layouts/_switch_devise_profile_module.html.haml index 02f2678a2..766f795b0 100644 --- a/app/views/layouts/_switch_devise_profile_module.html.haml +++ b/app/views/layouts/_switch_devise_profile_module.html.haml @@ -7,8 +7,8 @@ = link_to(dossiers_path, id: :menu_item_procedure, title: 'Aller dans votre espace usager. Vous pourrez revenir ici ensuite') do %i.fa.fa-users Usager - - if gestionnaire_signed_in? + - if instructeur_signed_in? %li - = link_to(gestionnaire_procedures_path, title: 'Aller dans votre espace instructeur. Vous pourrez revenir ici ensuite.') do + = link_to(instructeur_procedures_path, title: 'Aller dans votre espace instructeur. Vous pourrez revenir ici ensuite.') do %i.fa.fa-user Instructeur diff --git a/app/views/layouts/mailers/layout.html.erb b/app/views/layouts/mailers/layout.html.erb index 71d0c744b..a92268786 100644 --- a/app/views/layouts/mailers/layout.html.erb +++ b/app/views/layouts/mailers/layout.html.erb @@ -50,7 +50,7 @@