Champ Repetition dossier display
This commit is contained in:
parent
862ab4ed04
commit
a4a421a91a
5 changed files with 47 additions and 36 deletions
|
@ -20,6 +20,10 @@
|
||||||
padding: (3 * $default-spacer) 2px;
|
padding: (3 * $default-spacer) 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
th.padded {
|
||||||
|
padding-left: (2 * $default-spacer);
|
||||||
|
}
|
||||||
|
|
||||||
&.hoverable {
|
&.hoverable {
|
||||||
tbody tr:hover {
|
tbody tr:hover {
|
||||||
background: $light-grey;
|
background: $light-grey;
|
||||||
|
|
|
@ -147,10 +147,7 @@ class TypeDeChamp < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def exclude_from_view?
|
def exclude_from_view?
|
||||||
type_champ.in?([
|
type_champ == TypeDeChamp.type_champs.fetch(:explication)
|
||||||
TypeDeChamp.type_champs.fetch(:explication),
|
|
||||||
TypeDeChamp.type_champs.fetch(:repetition)
|
|
||||||
])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def public?
|
def public?
|
||||||
|
|
40
app/views/shared/dossiers/_champ_row.html.haml
Normal file
40
app/views/shared/dossiers/_champ_row.html.haml
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
- champs.reject(&:exclude_from_view?).each do |c|
|
||||||
|
- if c.type_champ == TypeDeChamp.type_champs.fetch(:repetition)
|
||||||
|
%tr
|
||||||
|
%th.libelle.repetition{ colspan: 3 }
|
||||||
|
= "#{c.libelle} :"
|
||||||
|
- c.rows.each do |champs|
|
||||||
|
= render partial: "shared/dossiers/champ_row", locals: { champs: champs, demande_seen_at: demande_seen_at, profile: profile, repetition: true }
|
||||||
|
%tr
|
||||||
|
%th{ colspan: 4 }
|
||||||
|
- else
|
||||||
|
%tr
|
||||||
|
- if c.type_champ == TypeDeChamp.type_champs.fetch(:header_section)
|
||||||
|
%th.header-section{ colspan: 3 }
|
||||||
|
= c.libelle
|
||||||
|
- else
|
||||||
|
%th.libelle{ class: repetition ? 'padded' : '' }
|
||||||
|
= "#{c.libelle} :"
|
||||||
|
%td.rich-text
|
||||||
|
%span{ class: highlight_if_unseen_class(demande_seen_at, c.updated_at) }
|
||||||
|
- case c.type_champ
|
||||||
|
- when TypeDeChamp.type_champs.fetch(:carte)
|
||||||
|
= render partial: "shared/champs/carte/show", locals: { champ: c }
|
||||||
|
- when TypeDeChamp.type_champs.fetch(:dossier_link)
|
||||||
|
= render partial: "shared/champs/dossier_link/show", locals: { champ: c }
|
||||||
|
- when TypeDeChamp.type_champs.fetch(:multiple_drop_down_list)
|
||||||
|
= render partial: "shared/champs/multiple_drop_down_list/show", locals: { champ: c }
|
||||||
|
- when TypeDeChamp.type_champs.fetch(:piece_justificative)
|
||||||
|
= render partial: "shared/champs/piece_justificative/show", locals: { champ: c }
|
||||||
|
- when TypeDeChamp.type_champs.fetch(:siret)
|
||||||
|
= render partial: "shared/champs/siret/show", locals: { champ: c, profile: profile }
|
||||||
|
- when TypeDeChamp.type_champs.fetch(:textarea)
|
||||||
|
= render partial: "shared/champs/textarea/show", locals: { champ: c }
|
||||||
|
- else
|
||||||
|
= sanitize(c.to_s)
|
||||||
|
|
||||||
|
- if c.type_champ != TypeDeChamp.type_champs.fetch(:header_section)
|
||||||
|
%td.updated-at
|
||||||
|
%span{ class: highlight_if_unseen_class(demande_seen_at, c.updated_at) }
|
||||||
|
modifié le
|
||||||
|
= c.updated_at.strftime("%d/%m/%Y à %H:%M")
|
|
@ -1,33 +1,3 @@
|
||||||
%table.table.vertical.dossier-champs
|
%table.table.vertical.dossier-champs
|
||||||
%tbody
|
%tbody
|
||||||
- champs.reject(&:exclude_from_view?).each do |c|
|
= render partial: "shared/dossiers/champ_row", locals: { champs: champs, demande_seen_at: demande_seen_at, profile: profile, repetition: false }
|
||||||
%tr
|
|
||||||
- if c.type_champ == TypeDeChamp.type_champs.fetch(:header_section)
|
|
||||||
%th.header-section{ colspan: 3 }
|
|
||||||
= c.libelle
|
|
||||||
- else
|
|
||||||
%th.libelle
|
|
||||||
= "#{c.libelle} :"
|
|
||||||
%td.rich-text
|
|
||||||
%span{ class: highlight_if_unseen_class(demande_seen_at, c.updated_at) }
|
|
||||||
- case c.type_champ
|
|
||||||
- when TypeDeChamp.type_champs.fetch(:carte)
|
|
||||||
= render partial: "shared/champs/carte/show", locals: { champ: c }
|
|
||||||
- when TypeDeChamp.type_champs.fetch(:dossier_link)
|
|
||||||
= render partial: "shared/champs/dossier_link/show", locals: { champ: c }
|
|
||||||
- when TypeDeChamp.type_champs.fetch(:multiple_drop_down_list)
|
|
||||||
= render partial: "shared/champs/multiple_drop_down_list/show", locals: { champ: c }
|
|
||||||
- when TypeDeChamp.type_champs.fetch(:piece_justificative)
|
|
||||||
= render partial: "shared/champs/piece_justificative/show", locals: { champ: c }
|
|
||||||
- when TypeDeChamp.type_champs.fetch(:siret)
|
|
||||||
= render partial: "shared/champs/siret/show", locals: { champ: c, profile: profile }
|
|
||||||
- when TypeDeChamp.type_champs.fetch(:textarea)
|
|
||||||
= render partial: "shared/champs/textarea/show", locals: { champ: c }
|
|
||||||
- else
|
|
||||||
= sanitize(c.to_s)
|
|
||||||
|
|
||||||
- if c.type_champ != TypeDeChamp.type_champs.fetch(:header_section)
|
|
||||||
%td.updated-at
|
|
||||||
%span{ class: highlight_if_unseen_class(demande_seen_at, c.updated_at) }
|
|
||||||
modifié le
|
|
||||||
= c.updated_at.strftime("%d/%m/%Y à %H:%M")
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ describe 'shared/dossiers/champs.html.haml', type: :view do
|
||||||
allow(view).to receive(:current_gestionnaire).and_return(gestionnaire)
|
allow(view).to receive(:current_gestionnaire).and_return(gestionnaire)
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { render 'shared/dossiers/champs.html.haml', champs: champs, demande_seen_at: demande_seen_at }
|
subject { render 'shared/dossiers/champs.html.haml', champs: champs, demande_seen_at: demande_seen_at, profile: nil }
|
||||||
|
|
||||||
context "there are some champs" do
|
context "there are some champs" do
|
||||||
let(:dossier) { create(:dossier) }
|
let(:dossier) { create(:dossier) }
|
||||||
|
|
Loading…
Add table
Reference in a new issue