Merge pull request #2292 from betagouv/dev

2018-07-24-01
This commit is contained in:
Pierre de La Morinerie 2018-07-24 14:28:07 +02:00 committed by GitHub
commit 157e336789
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 55 additions and 11 deletions

View file

@ -100,12 +100,27 @@
input[type=date], input[type=date],
input[type=number], input[type=number],
input[type=tel], input[type=tel],
input[type=file],
textarea, textarea,
select { select {
display: block; 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-radius: 4px;
border: solid 1px $border-grey; border: solid 1px $border-grey;
margin-bottom: 2 * $default-padding;
padding: $default-padding; padding: $default-padding;
&:disabled { &:disabled {
@ -115,10 +130,6 @@
&.small { &.small {
padding: $default-padding / 2; padding: $default-padding / 2;
} }
&.small-margin {
margin-bottom: $default-padding / 2;
}
} }
input[type=text], input[type=text],

View file

@ -1,5 +1,25 @@
module Manager module Manager
class DossiersController < Manager::ApplicationController 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 def change_state_to_instruction
dossier = Dossier.find(params[:id]) dossier = Dossier.find(params[:id])
dossier.update(state: 'en_instruction', processed_at: nil, motivation: nil) 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" flash[:notice] = "Le dossier #{dossier.id} est repassé en instruction"
redirect_to manager_dossier_path(dossier) redirect_to manager_dossier_path(dossier)
end end
private
def unfiltered_list?
action_name == "index" && !params[:search]
end
end end
end end

View file

@ -8,12 +8,13 @@ class DossierDashboard < Administrate::BaseDashboard
# which determines how the attribute is displayed # which determines how the attribute is displayed
# on pages throughout the dashboard. # on pages throughout the dashboard.
ATTRIBUTE_TYPES = { ATTRIBUTE_TYPES = {
id: Field::Number, id: Field::Number.with_options(searchable: true),
procedure: Field::HasOne, procedure: Field::HasOne,
state: Field::String, state: Field::String,
text_summary: Field::String, text_summary: Field::String.with_options(searchable: false),
created_at: Field::DateTime, created_at: Field::DateTime,
updated_at: Field::DateTime, updated_at: Field::DateTime,
hidden_at: Field::DateTime,
types_de_champ: TypesDeChampCollectionField, types_de_champ: TypesDeChampCollectionField,
}.freeze }.freeze
@ -38,6 +39,7 @@ class DossierDashboard < Administrate::BaseDashboard
:types_de_champ, :types_de_champ,
:created_at, :created_at,
:updated_at, :updated_at,
:hidden_at
].freeze ].freeze
# FORM_ATTRIBUTES # FORM_ATTRIBUTES

View file

@ -14,7 +14,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
dossiers: Field::HasMany, dossiers: Field::HasMany,
gestionnaires: Field::HasMany, gestionnaires: Field::HasMany,
administrateur: Field::BelongsTo, administrateur: Field::BelongsTo,
id: Field::Number, id: Field::Number.with_options(searchable: true),
libelle: Field::String, libelle: Field::String,
description: Field::String, description: Field::String,
organisation: Field::String, organisation: Field::String,

View file

@ -23,6 +23,6 @@ as defined by the routes in the `admin/` namespace
<hr /> <hr />
<%= 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" %> <%= link_to "Features", manager_flipflop_path, class: "navigation__link" %>
</nav> </nav>

View file

@ -22,6 +22,9 @@ as well as a link to its edit page.
<header class="main-content__header" role="banner"> <header class="main-content__header" role="banner">
<h1 class="main-content__page-title"> <h1 class="main-content__page-title">
<%= content_for(:title) %> <%= content_for(:title) %>
<% if dossier.hidden_at %>
(SUPPRIMÉ)
<% end %>
</h1> </h1>
<div> <div>

View file

@ -10,7 +10,7 @@
.prologue .prologue
.mandatory-explanation .mandatory-explanation
Les champs avec une astérisque ( Les champs avec un astérisque (
%span.mandatory> * %span.mandatory> *
) sont obligatoires. ) sont obligatoires.

View file

@ -1,7 +1,9 @@
fr: fr:
activerecord: activerecord:
models: models:
dossier: 'Dossier' dossier:
one: "Dossier"
other: "Dossiers"
attributes: attributes:
dossier: dossier:
montant_projet: 'Le montant du projet' montant_projet: 'Le montant du projet'