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], 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 734b4fe25..79040b995 100644 --- a/app/dashboards/dossier_dashboard.rb +++ b/app/dashboards/dossier_dashboard.rb @@ -8,12 +8,13 @@ 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, + 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/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, 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