From ab2181ea13c621780ae70417865bc69051cb79ed Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Fri, 20 Jul 2018 10:23:34 +0200 Subject: [PATCH 1/7] [Fix #2280] Correct a typo --- app/views/shared/dossiers/_edit.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/shared/dossiers/_edit.html.haml b/app/views/shared/dossiers/_edit.html.haml index 83f4d2867..c975b16d2 100644 --- a/app/views/shared/dossiers/_edit.html.haml +++ b/app/views/shared/dossiers/_edit.html.haml @@ -10,7 +10,7 @@ .prologue .mandatory-explanation - Les champs avec une astérisque ( + Les champs avec un astérisque ( %span.mandatory> * ) sont obligatoires. From 20790569a9603b9a7749c186babfb2ff392f49f2 Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Mon, 23 Jul 2018 14:52:14 +0200 Subject: [PATCH 2/7] fix-input-file-margin --- app/assets/stylesheets/new_design/forms.scss | 21 +++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/app/assets/stylesheets/new_design/forms.scss b/app/assets/stylesheets/new_design/forms.scss index 11988feab..ba7b16d39 100644 --- a/app/assets/stylesheets/new_design/forms.scss +++ b/app/assets/stylesheets/new_design/forms.scss @@ -100,12 +100,27 @@ input[type=date], input[type=number], input[type=tel], + input[type=file], textarea, select { display: block; + margin-bottom: 2 * $default-padding; + + &.small-margin { + margin-bottom: $default-padding / 2; + } + } + + input[type=text]:not([data-address='true']), + input[type=email], + input[type=password], + input[type=date], + input[type=number], + input[type=tel], + textarea, + select { border-radius: 4px; border: solid 1px $border-grey; - margin-bottom: 2 * $default-padding; padding: $default-padding; &:disabled { @@ -115,10 +130,6 @@ &.small { padding: $default-padding / 2; } - - &.small-margin { - margin-bottom: $default-padding / 2; - } } input[type=text], From 099fac69c0f39244bcd28a41b1781268c5da7221 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 23 Jul 2018 11:01:56 +0200 Subject: [PATCH 3/7] manager: fix typo --- app/views/manager/application/_navigation.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/manager/application/_navigation.html.erb b/app/views/manager/application/_navigation.html.erb index bb217b350..216e3fe4c 100644 --- a/app/views/manager/application/_navigation.html.erb +++ b/app/views/manager/application/_navigation.html.erb @@ -23,6 +23,6 @@ as defined by the routes in the `admin/` namespace
- <%= link_to "Delayed Job", manager_delayed_job_path, class: "navigation__link" %> + <%= link_to "Delayed Jobs", manager_delayed_job_path, class: "navigation__link" %> <%= link_to "Features", manager_flipflop_path, class: "navigation__link" %> From 1348f81f3170294946fc2f8619de175ec7b5fda5 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 23 Jul 2018 11:41:22 +0200 Subject: [PATCH 4/7] manager: fix pluralization of "Dossier" --- config/locales/models/dossier/fr.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/locales/models/dossier/fr.yml b/config/locales/models/dossier/fr.yml index 8ac363e1f..3fc73da1e 100644 --- a/config/locales/models/dossier/fr.yml +++ b/config/locales/models/dossier/fr.yml @@ -1,7 +1,9 @@ fr: activerecord: models: - dossier: 'Dossier' + dossier: + one: "Dossier" + other: "Dossiers" attributes: dossier: montant_projet: 'Le montant du projet' From 5c6fa992f877b1e1e04ba04274bc55c7885fab88 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 23 Jul 2018 10:56:01 +0200 Subject: [PATCH 5/7] manager: fix exception when searching for a dossier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Text summary is a generated accessor, and not a true DB column – so we should tell Administrate not to use it in a search query. --- app/dashboards/dossier_dashboard.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/dashboards/dossier_dashboard.rb b/app/dashboards/dossier_dashboard.rb index 734b4fe25..67b4ec88c 100644 --- a/app/dashboards/dossier_dashboard.rb +++ b/app/dashboards/dossier_dashboard.rb @@ -11,7 +11,7 @@ class DossierDashboard < Administrate::BaseDashboard id: Field::Number, procedure: Field::HasOne, state: Field::String, - text_summary: Field::String, + text_summary: Field::String.with_options(searchable: false), created_at: Field::DateTime, updated_at: Field::DateTime, types_de_champ: TypesDeChampCollectionField, From f6c83cae1fa44d47cb271c9f5729139b284ff1aa Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 23 Jul 2018 09:01:25 +0000 Subject: [PATCH 6/7] manager: make resources searchable by id --- app/dashboards/dossier_dashboard.rb | 2 +- app/dashboards/procedure_dashboard.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/dashboards/dossier_dashboard.rb b/app/dashboards/dossier_dashboard.rb index 67b4ec88c..55a1de1ac 100644 --- a/app/dashboards/dossier_dashboard.rb +++ b/app/dashboards/dossier_dashboard.rb @@ -8,7 +8,7 @@ class DossierDashboard < Administrate::BaseDashboard # which determines how the attribute is displayed # on pages throughout the dashboard. ATTRIBUTE_TYPES = { - id: Field::Number, + id: Field::Number.with_options(searchable: true), procedure: Field::HasOne, state: Field::String, text_summary: Field::String.with_options(searchable: false), diff --git a/app/dashboards/procedure_dashboard.rb b/app/dashboards/procedure_dashboard.rb index 0d18c8635..1867d4404 100644 --- a/app/dashboards/procedure_dashboard.rb +++ b/app/dashboards/procedure_dashboard.rb @@ -14,7 +14,7 @@ class ProcedureDashboard < Administrate::BaseDashboard dossiers: Field::HasMany, gestionnaires: Field::HasMany, administrateur: Field::BelongsTo, - id: Field::Number, + id: Field::Number.with_options(searchable: true), libelle: Field::String, description: Field::String, organisation: Field::String, From 6e5840e838d0cd6e48bc4081ccf0d6cb43f630ee Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 23 Jul 2018 11:02:25 +0000 Subject: [PATCH 7/7] manager: allow searching for deleted dossier Deleted dossiers don't appear in the unfiltered list though. You have to know its id to find it. --- .../manager/dossiers_controller.rb | 26 +++++++++++++++++++ app/dashboards/dossier_dashboard.rb | 2 ++ app/views/manager/dossiers/show.html.erb | 3 +++ 3 files changed, 31 insertions(+) diff --git a/app/controllers/manager/dossiers_controller.rb b/app/controllers/manager/dossiers_controller.rb index 23068d4c4..dcbd30d62 100644 --- a/app/controllers/manager/dossiers_controller.rb +++ b/app/controllers/manager/dossiers_controller.rb @@ -1,5 +1,25 @@ module Manager class DossiersController < Manager::ApplicationController + # + # Administrate overrides + # + + # Override this if you have certain roles that require a subset + # this will be used to set the records shown on the `index` action. + def scoped_resource + if unfiltered_list? + # Don't display deleted dossiers in the unfiltered list… + Dossier + else + # … but allow them to be searched and displayed. + Dossier.unscope(:where) + end + end + + # + # Custom actions + # + def change_state_to_instruction dossier = Dossier.find(params[:id]) dossier.update(state: 'en_instruction', processed_at: nil, motivation: nil) @@ -8,5 +28,11 @@ module Manager flash[:notice] = "Le dossier #{dossier.id} est repassé en instruction" redirect_to manager_dossier_path(dossier) end + + private + + def unfiltered_list? + action_name == "index" && !params[:search] + end end end diff --git a/app/dashboards/dossier_dashboard.rb b/app/dashboards/dossier_dashboard.rb index 55a1de1ac..79040b995 100644 --- a/app/dashboards/dossier_dashboard.rb +++ b/app/dashboards/dossier_dashboard.rb @@ -14,6 +14,7 @@ class DossierDashboard < Administrate::BaseDashboard text_summary: Field::String.with_options(searchable: false), created_at: Field::DateTime, updated_at: Field::DateTime, + hidden_at: Field::DateTime, types_de_champ: TypesDeChampCollectionField, }.freeze @@ -38,6 +39,7 @@ class DossierDashboard < Administrate::BaseDashboard :types_de_champ, :created_at, :updated_at, + :hidden_at ].freeze # FORM_ATTRIBUTES diff --git a/app/views/manager/dossiers/show.html.erb b/app/views/manager/dossiers/show.html.erb index 5ed7252aa..900439f99 100644 --- a/app/views/manager/dossiers/show.html.erb +++ b/app/views/manager/dossiers/show.html.erb @@ -22,6 +22,9 @@ as well as a link to its edit page.