From e87264b402ddb3d9d10c9b3f7f081f16646cfd0e Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Tue, 2 Oct 2018 17:09:27 +0200 Subject: [PATCH 1/9] stylesheets: add a devise-container class --- .../{administrateurs_activate.scss => devise_container.scss} | 2 +- app/views/administrateurs/activate/new.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename app/assets/stylesheets/new_design/{administrateurs_activate.scss => devise_container.scss} (54%) diff --git a/app/assets/stylesheets/new_design/administrateurs_activate.scss b/app/assets/stylesheets/new_design/devise_container.scss similarity index 54% rename from app/assets/stylesheets/new_design/administrateurs_activate.scss rename to app/assets/stylesheets/new_design/devise_container.scss index 04393bdd0..0f7be1ce8 100644 --- a/app/assets/stylesheets/new_design/administrateurs_activate.scss +++ b/app/assets/stylesheets/new_design/devise_container.scss @@ -1,4 +1,4 @@ -.administrateurs-activate.container { +.container.devise-container { margin-top: 60px; margin-bottom: 60px; } diff --git a/app/views/administrateurs/activate/new.html.haml b/app/views/administrateurs/activate/new.html.haml index 4b7e5f6c7..f940e128d 100644 --- a/app/views/administrateurs/activate/new.html.haml +++ b/app/views/administrateurs/activate/new.html.haml @@ -3,7 +3,7 @@ - content_for :footer do = render partial: "root/footer" -.administrateurs-activate.container +.container.devise-container .one-column-centered = form_for @administrateur, url: { controller: 'administrateurs/activate', action: :create }, html: { class: "form" } do |f| %br From bfd106ba3055bebfa20c749506a550686140743c Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Tue, 2 Oct 2018 13:47:32 +0000 Subject: [PATCH 2/9] session: migrate the "token confirmation" page to the new design --- .../users/confirmations_controller.rb | 32 +++++++++++++++++++ app/views/users/confirmations/new.html.erb | 16 ---------- app/views/users/confirmations/new.html.haml | 17 ++++++++++ config/routes.rb | 1 + 4 files changed, 50 insertions(+), 16 deletions(-) create mode 100644 app/controllers/users/confirmations_controller.rb delete mode 100644 app/views/users/confirmations/new.html.erb create mode 100644 app/views/users/confirmations/new.html.haml diff --git a/app/controllers/users/confirmations_controller.rb b/app/controllers/users/confirmations_controller.rb new file mode 100644 index 000000000..8aae938f1 --- /dev/null +++ b/app/controllers/users/confirmations_controller.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +class Users::ConfirmationsController < Devise::ConfirmationsController + layout "new_application" + + # GET /resource/confirmation/new + # def new + # super + # end + + # POST /resource/confirmation + # def create + # super + # end + + # GET /resource/confirmation?confirmation_token=abcdef + # def show + # super + # end + + # protected + + # The path used after resending confirmation instructions. + # def after_resending_confirmation_instructions_path_for(resource_name) + # super(resource_name) + # end + + # The path used after confirmation. + # def after_confirmation_path_for(resource_name, resource) + # super(resource_name, resource) + # end +end diff --git a/app/views/users/confirmations/new.html.erb b/app/views/users/confirmations/new.html.erb deleted file mode 100644 index fbcac0308..000000000 --- a/app/views/users/confirmations/new.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -

Renvoyer les instructions de confirmation de compte

- -<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> - <%= devise_error_messages! %> - -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true %> -
- -
- <%= f.submit "Renvoyer les instructions de confirmation" %> -
-<% end %> - -<%= render "users/shared/links" %> diff --git a/app/views/users/confirmations/new.html.haml b/app/views/users/confirmations/new.html.haml new file mode 100644 index 000000000..0f7e6534a --- /dev/null +++ b/app/views/users/confirmations/new.html.haml @@ -0,0 +1,17 @@ +- content_for(:title, 'Renvoyer les instructions de confirmation de compte') + +- content_for :footer do + = render partial: 'root/footer' + +.container.devise-container + .one-column-centered + = devise_error_messages! + + = form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { class: 'form' }) do |f| + + %h1 Renvoyer les instructions de confirmation de compte + + = f.label :email, 'Email' + = f.email_field :email, autofocus: true + + = f.submit 'Renvoyer les instructions de confirmation', class: 'button primary' diff --git a/config/routes.rb b/config/routes.rb index 4f35ffe32..d61486811 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -73,6 +73,7 @@ Rails.application.routes.draw do devise_for :users, controllers: { sessions: 'users/sessions', registrations: 'users/registrations', + confirmations: 'users/confirmations', passwords: 'users/passwords' } From 627df7a1f31717dc146cd5f6806ceefc8716b32c Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Tue, 2 Oct 2018 14:03:15 +0000 Subject: [PATCH 3/9] session: migrate the password pages to the new design --- app/controllers/users/passwords_controller.rb | 2 + app/views/users/passwords/edit.html.haml | 43 ++++++++----------- app/views/users/passwords/new.html.haml | 34 +++++++-------- 3 files changed, 35 insertions(+), 44 deletions(-) diff --git a/app/controllers/users/passwords_controller.rb b/app/controllers/users/passwords_controller.rb index f65b71202..b679af447 100644 --- a/app/controllers/users/passwords_controller.rb +++ b/app/controllers/users/passwords_controller.rb @@ -1,4 +1,6 @@ class Users::PasswordsController < Devise::PasswordsController + layout "new_application" + after_action :try_to_authenticate_gestionnaire, only: [:update] after_action :try_to_authenticate_administrateur, only: [:update] diff --git a/app/views/users/passwords/edit.html.haml b/app/views/users/passwords/edit.html.haml index f037d1041..33b8d466b 100644 --- a/app/views/users/passwords/edit.html.haml +++ b/app/views/users/passwords/edit.html.haml @@ -1,29 +1,22 @@ -= devise_error_messages! +- content_for(:title, 'Changement de mot de passe') -#form-login - %h2#gestionnaire_login Changement de mot de passe +- content_for :footer do + = render partial: 'root/footer' + +.container.devise-container + .one-column-centered + = devise_error_messages! + + = form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :patch, class: 'form' }) do |f| + + %h1 Changement de mot de passe - %br - %br - #new-user - = form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| = f.hidden_field :reset_password_token - %h4 - = f.label 'Nouveau mot de passe' - .input-group - .input-group-addon - %span.fa.fa-asterisk - = f.password_field :password, autofocus: true, autocomplete: "off", class: 'form-control' - %br - %h4 - = f.label 'Retaper le mot de passe' - .input-group - .input-group-addon - %span.fa.fa-asterisk - = f.password_field :password_confirmation, autocomplete: "off", class: 'form-control' - %br - %br - .actions - = f.submit "Changer", class: 'btn btn-primary' - %br + = f.label 'Nouveau mot de passe' + = f.password_field :password, autofocus: true, autocomplete: 'off' + + = f.label 'Confirmez le nouveau mot de passe' + = f.password_field :password_confirmation, autocomplete: 'off' + + = f.submit 'Changer le mot de passe', class: 'button primary' diff --git a/app/views/users/passwords/new.html.haml b/app/views/users/passwords/new.html.haml index c8a6b356c..fab006b53 100644 --- a/app/views/users/passwords/new.html.haml +++ b/app/views/users/passwords/new.html.haml @@ -1,21 +1,17 @@ -= devise_error_messages! +- content_for(:title, 'Mot de passe oublié') -%br -#form-login - %h2#gestionnaire_login Mot de passe oublié +- content_for :footer do + = render partial: 'root/footer' - %br - %br - #new-user - = form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| - %h4 - = f.label :email - .input-group - .input-group-addon - %span.fa.fa-user - = f.email_field :email, class: 'form-control', placeholder: 'Email' - %br - %br - .actions - = f.submit "Renvoyer", class: 'btn btn-primary' - %br +.container.devise-container + .one-column-centered + = devise_error_messages! + + = form_for(resource, as: resource_name, url: password_path(resource_name), html: { class: 'form' }) do |f| + + %h1 Mot de passe oublié + + = f.label :email, 'Email' + = f.email_field :email, autofocus: true + + = f.submit 'Réinitialier', class: 'button primary' From 7a23aaf62f89cf58219acfce21c53730d37454f2 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Wed, 3 Oct 2018 08:41:36 +0200 Subject: [PATCH 4/9] session: consistent wording between usagers and instructeurs --- app/views/gestionnaires/passwords/edit.html.haml | 4 ++-- app/views/gestionnaires/passwords/new.html.haml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/gestionnaires/passwords/edit.html.haml b/app/views/gestionnaires/passwords/edit.html.haml index f037d1041..157ab3072 100644 --- a/app/views/gestionnaires/passwords/edit.html.haml +++ b/app/views/gestionnaires/passwords/edit.html.haml @@ -17,7 +17,7 @@ = f.password_field :password, autofocus: true, autocomplete: "off", class: 'form-control' %br %h4 - = f.label 'Retaper le mot de passe' + = f.label 'Confirmez le nouveau mot de passe' .input-group .input-group-addon %span.fa.fa-asterisk @@ -25,5 +25,5 @@ %br %br .actions - = f.submit "Changer", class: 'btn btn-primary' + = f.submit 'Changer le mot de passe', class: 'btn btn-primary' %br diff --git a/app/views/gestionnaires/passwords/new.html.haml b/app/views/gestionnaires/passwords/new.html.haml index c8a6b356c..2b9aec8e1 100644 --- a/app/views/gestionnaires/passwords/new.html.haml +++ b/app/views/gestionnaires/passwords/new.html.haml @@ -17,5 +17,5 @@ %br %br .actions - = f.submit "Renvoyer", class: 'btn btn-primary' + = f.submit 'Réinitialiser', class: 'btn btn-primary' %br From bfe29388195db6086e440e13173e72cc99bd5825 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Tue, 2 Oct 2018 15:42:12 +0200 Subject: [PATCH 5/9] session: improve error message for unconfirmed accounts --- config/locales/devise.fr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/devise.fr.yml b/config/locales/devise.fr.yml index 3582cd4ce..b19018c0b 100755 --- a/config/locales/devise.fr.yml +++ b/config/locales/devise.fr.yml @@ -15,7 +15,7 @@ fr: not_found_in_database: "adresse email ou mot de passe invalide." timeout: "Votre session est expirée. Veuillez vous reconnecter pour continuer." unauthenticated: "Vous devez vous connecter ou vous inscrire pour continuer." - unconfirmed: "Vous devez activer votre compte pour continuer." + unconfirmed: "Vous devez confirmer votre adresse email pour continuer. Cliquez sur le lien qui vous a été envoyé par email." mailer: confirmation_instructions: subject: "Instructions d'activation de votre compte" From 39f1b7547eeb0f358f78ace58aefc5c5cedaf0d4 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Tue, 2 Oct 2018 18:04:58 +0200 Subject: [PATCH 6/9] session: improve message after reseting a password --- config/locales/devise.fr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/devise.fr.yml b/config/locales/devise.fr.yml index b19018c0b..92c4af92d 100755 --- a/config/locales/devise.fr.yml +++ b/config/locales/devise.fr.yml @@ -34,7 +34,7 @@ fr: no_token: "Vous ne pouvez accéder à cette page sans passer par un email de réinitialisation de mot de passe. Si vous êtes passé par un email de ce type, assurez-vous d'utiliser l'URL complète." send_instructions: "Vous allez recevoir les instructions de réinitialisation du mot de passe dans quelques instants" send_paranoid_instructions: "Si votre adresse email existe dans notre base de données, vous allez recevoir un lien de réinitialisation par email" - updated: "Votre mot de passe a été édité avec succès, vous êtes maintenant connecté" + updated: "Votre mot de passe a été changé avec succès, vous êtes maintenant connecté" updated_not_active: "Votre mot de passe a été changé avec succès." registrations: destroyed: "Votre compte a été supprimé avec succès. Nous espérons vous revoir bientôt." From baca93dc38a56310cafd8a3da1d7fd119f1f6d9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Wed, 3 Oct 2018 15:43:07 +0200 Subject: [PATCH 7/9] Rename the Informations tab to Publication --- .../_left_panel_admin_procedurescontroller_navbar.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml index 70bdcf11e..560f960b9 100644 --- a/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml +++ b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml @@ -12,7 +12,7 @@ #procedure-list %a#onglet-infos{ href: url_for(admin_procedure_path(@procedure)) } .procedure-list-element{ class: ('active' if active == 'Informations') } - Informations + Publication %a#onglet-services{ href: current_administrateur.services.present? ? url_for(services_path(procedure_id: @procedure.id)) : url_for(new_service_path(procedure_id: @procedure.id)) } .procedure-list-element From dc0dd8a4794f7a7142a8915c5c75f0aa66e8c5a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Wed, 3 Oct 2018 15:44:07 +0200 Subject: [PATCH 8/9] Remove the details from the Publication tab --- app/views/admin/procedures/show.html.haml | 43 ----------------------- 1 file changed, 43 deletions(-) diff --git a/app/views/admin/procedures/show.html.haml b/app/views/admin/procedures/show.html.haml index 46bfef62c..1d9f335b8 100644 --- a/app/views/admin/procedures/show.html.haml +++ b/app/views/admin/procedures/show.html.haml @@ -76,49 +76,6 @@ Cette démarche n’a pas encore de lien, et n’est donc pas accessible par le public. %br - %h3 Détails - - .row{ style: 'margin-right: 3%; margin-left: 3%;' } - .description.col-xs-6.col-md-3.procedure-description - %h4.text-info - = @procedure.libelle - - = h string_to_html(@procedure.description) - - .champs.col-xs-6.col-md-3 - %h4.text-info - Champs - .badge.progress-bar-info - = @procedure.types_de_champ.size - %ul - - @procedure.types_de_champ.order(:order_place).each do |champ| - %li= champ.libelle - - .champs_private.col-xs-6.col-md-3 - %h4.text-info - Annotations privées - .badge.progress-bar-info - = @procedure.types_de_champ_private.size - %ul - - @procedure.types_de_champ_private.order(:order_place).each do |champ| - %li= champ.libelle - - .pieces-justificatives.col-xs-6.col-md-3 - %h4.text-info - Pièces jointes - .badge.progress-bar-info - = @procedure.types_de_piece_justificative.size - - @procedure.types_de_piece_justificative.each do |piece_justificative| - = piece_justificative.libelle - %br - - - durees_de_conservation = politiques_conservation_de_donnees(@procedure) - - if durees_de_conservation.present? - .row{ style: 'margin-right: 3%; margin-left: 3%;' } - .col-xs-6.col-md-3 - %h4.text-info Conservation des données - - durees_de_conservation.each do |text| - %p= text - if @procedure.publiee_ou_archivee? %h3 Supprimer la démarche From b36d1536206fd57c3cdf785321441773048f82c0 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Wed, 3 Oct 2018 16:20:27 +0200 Subject: [PATCH 9/9] Fix missing sort columns --- app/models/procedure_presentation.rb | 7 ++++++- spec/models/procedure_presentation_spec.rb | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/models/procedure_presentation.rb b/app/models/procedure_presentation.rb index b7ff11662..b9fccc2d7 100644 --- a/app/models/procedure_presentation.rb +++ b/app/models/procedure_presentation.rb @@ -1,4 +1,9 @@ class ProcedurePresentation < ApplicationRecord + EXTRA_SORT_COLUMNS = { + 'notifications' => Set['notifications'], + 'self' => Set['id', 'state'] + } + belongs_to :assign_to delegate :procedure, to: :assign_to @@ -40,6 +45,6 @@ class ProcedurePresentation < ApplicationRecord private def valid_sort_column?(procedure, table, column) - DossierFieldService.valid_column?(procedure, table, column) || (table == 'notifications' && column == 'notifications') + DossierFieldService.valid_column?(procedure, table, column) || EXTRA_SORT_COLUMNS[table]&.include?(column) end end diff --git a/spec/models/procedure_presentation_spec.rb b/spec/models/procedure_presentation_spec.rb index 50bfabd3c..3cc555401 100644 --- a/spec/models/procedure_presentation_spec.rb +++ b/spec/models/procedure_presentation_spec.rb @@ -37,6 +37,8 @@ describe ProcedurePresentation do context 'of sort' do it { expect(build(:procedure_presentation, sort: { "table" => "notifications", "column" => "notifications", "order" => "asc" })).to be_valid } + it { expect(build(:procedure_presentation, sort: { "table" => "self", "column" => "id", "order" => "asc" })).to be_valid } + it { expect(build(:procedure_presentation, sort: { "table" => "self", "column" => "state", "order" => "asc" })).to be_valid } it { expect(build(:procedure_presentation, sort: { "table" => "user", "column" => "reset_password_token", "order" => "asc" })).to be_invalid } end