Merge pull request #2284 from betagouv/manager-make-deleted-dossiers-searchable
[Manager] Affiche les dossiers supprimés dans la recherche
This commit is contained in:
commit
7ff3101945
3 changed files with 31 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -22,6 +22,9 @@ as well as a link to its edit page.
|
|||
<header class="main-content__header" role="banner">
|
||||
<h1 class="main-content__page-title">
|
||||
<%= content_for(:title) %>
|
||||
<% if dossier.hidden_at %>
|
||||
(SUPPRIMÉ)
|
||||
<% end %>
|
||||
</h1>
|
||||
|
||||
<div>
|
||||
|
|
Loading…
Reference in a new issue