Merge branch 'dev'
This commit is contained in:
commit
fdd96837c6
17 changed files with 173 additions and 91 deletions
|
@ -18,5 +18,6 @@
|
|||
//= require highcharts
|
||||
//= require chartkick
|
||||
//= require select2
|
||||
//= require select2_locale_fr
|
||||
//= require typeahead.bundle
|
||||
//= require_tree .
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
document.addEventListener('turbolinks:load', function() {
|
||||
$('select.select2').select2();
|
||||
$('select.select2').select2({
|
||||
'language': 'fr'
|
||||
});
|
||||
|
||||
$('select.select2-limited').select2({
|
||||
'language': 'fr',
|
||||
'placeholder': 'Sélectionnez des colonnes',
|
||||
'maximumSelectionLength': '5',
|
||||
'width': '300px'
|
||||
|
|
|
@ -9,63 +9,4 @@
|
|||
.libelle {
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
i {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
b {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
small {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
ol,
|
||||
ul {
|
||||
list-style: inside;
|
||||
}
|
||||
|
||||
ol {
|
||||
list-style-type: decimal;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
margin: $default-padding 0 $default-padding $default-padding;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: $default-padding;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
margin-bottom: $default-padding;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 32px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 28px;
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
h5 {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
h6 {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,19 +3,19 @@
|
|||
@import "constants";
|
||||
|
||||
.messagerie {
|
||||
ul {
|
||||
.messages-list {
|
||||
max-height: 350px;
|
||||
overflow-y: scroll;
|
||||
border: 1px solid $border-grey;
|
||||
padding: 2 * $default-spacer;
|
||||
margin-bottom: $default-spacer;
|
||||
}
|
||||
|
||||
li {
|
||||
> li {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 2 * $default-padding;
|
||||
}
|
||||
}
|
||||
|
||||
.person-icon {
|
||||
margin-right: $default-spacer;
|
||||
|
|
62
app/assets/stylesheets/new_design/rich-text.scss
Normal file
62
app/assets/stylesheets/new_design/rich-text.scss
Normal file
|
@ -0,0 +1,62 @@
|
|||
@import "constants";
|
||||
|
||||
.rich-text {
|
||||
i {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
b {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
small {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
ol,
|
||||
ul {
|
||||
list-style: inside;
|
||||
}
|
||||
|
||||
ol {
|
||||
list-style-type: decimal;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
margin: $default-padding 0 $default-padding $default-padding;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: $default-padding;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
margin-bottom: $default-padding;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 32px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 28px;
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
h5 {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
h6 {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@ class Avis < ApplicationRecord
|
|||
belongs_to :gestionnaire
|
||||
belongs_to :claimant, class_name: 'Gestionnaire'
|
||||
|
||||
before_save :downcase_email
|
||||
before_save :clean_email
|
||||
before_create :try_to_assign_gestionnaire
|
||||
after_create :notify_gestionnaire
|
||||
|
||||
|
@ -28,9 +28,9 @@ class Avis < ApplicationRecord
|
|||
|
||||
private
|
||||
|
||||
def downcase_email
|
||||
def clean_email
|
||||
if email.present?
|
||||
email.downcase!
|
||||
self.email = email.downcase.strip
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -70,6 +70,23 @@ class Champ < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def for_export
|
||||
if value.present?
|
||||
case type_champ
|
||||
when 'textarea'
|
||||
ActionView::Base.full_sanitizer.sanitize(value)
|
||||
when 'yes_no'
|
||||
value == 'yes' ? 'oui' : 'non'
|
||||
when 'multiple_drop_down_list'
|
||||
drop_down_list.selected_options_without_decorator(self).join(', ')
|
||||
else
|
||||
value
|
||||
end
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def format_date_to_iso
|
||||
|
|
|
@ -228,11 +228,11 @@ class Dossier < ActiveRecord::Base
|
|||
value = serialize_value_for_export(value)
|
||||
hash.store(key, value)
|
||||
end
|
||||
return hash
|
||||
hash
|
||||
end
|
||||
|
||||
def full_data_strings_array
|
||||
data_with_champs.map do |value|
|
||||
to_sorted_values.map do |value|
|
||||
serialize_value_for_export(value)
|
||||
end
|
||||
end
|
||||
|
@ -245,16 +245,16 @@ class Dossier < ActiveRecord::Base
|
|||
etablissement_attr = EtablissementSerializer.new(Etablissement.new).attributes.map { |k, v| ["etablissement.#{k}".parameterize.underscore.to_sym, v] }.to_h
|
||||
entreprise_attr = EntrepriseSerializer.new(Entreprise.new).attributes.map { |k, v| ["entreprise.#{k}".parameterize.underscore.to_sym, v] }.to_h
|
||||
end
|
||||
return convert_specific_hash_values_to_string(etablissement_attr.merge(entreprise_attr))
|
||||
convert_specific_hash_values_to_string(etablissement_attr.merge(entreprise_attr))
|
||||
end
|
||||
|
||||
def data_with_champs
|
||||
def to_sorted_values
|
||||
serialized_dossier = DossierTableExportSerializer.new(self)
|
||||
data = serialized_dossier.attributes.values
|
||||
data += self.ordered_champs.map(&:value)
|
||||
data += self.ordered_champs_private.map(&:value)
|
||||
data += self.export_entreprise_data.values
|
||||
return data
|
||||
values = serialized_dossier.attributes.values
|
||||
values += self.ordered_champs.map(&:for_export)
|
||||
values += self.ordered_champs_private.map(&:for_export)
|
||||
values += self.export_entreprise_data.values
|
||||
values
|
||||
end
|
||||
|
||||
def export_headers
|
||||
|
@ -263,7 +263,7 @@ class Dossier < ActiveRecord::Base
|
|||
headers += self.procedure.types_de_champ.order(:order_place).map { |types_de_champ| types_de_champ.libelle.parameterize.underscore.to_sym }
|
||||
headers += self.procedure.types_de_champ_private.order(:order_place).map { |types_de_champ| types_de_champ.libelle.parameterize.underscore.to_sym }
|
||||
headers += self.export_entreprise_data.keys
|
||||
return headers
|
||||
headers
|
||||
end
|
||||
|
||||
def followers_gestionnaires
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
- else
|
||||
%small Désactivée
|
||||
|
||||
%p.notice Les attestation, si elles sont activées, sont délivrées par email aux usagers lorsque leurs dossiers sont acceptés, et sont également disponibles au téléchargement sur leur espace personnel.
|
||||
%p.notice Les attestations, si elles sont activées, sont délivrées par email aux usagers lorsque leurs dossiers sont acceptés, et sont également disponibles au téléchargement sur leur espace personnel.
|
||||
|
||||
.image-upload
|
||||
- if @attestation_template.logo.present?
|
||||
|
|
|
@ -8,5 +8,5 @@
|
|||
- elsif c.type_champ != "explication"
|
||||
%th.libelle
|
||||
= "#{c.libelle} :"
|
||||
%td
|
||||
%td.rich-text
|
||||
= sanitize(c.value)
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
.icon.in-progress
|
||||
.description
|
||||
%h4 En instruction
|
||||
L'usager ne peut modifer son dossier pendant l'instruction
|
||||
L'usager ne peut modifier son dossier pendant l'instruction
|
||||
%li{ onclick: "TPS.acceptDossier();" }
|
||||
.icon.accept
|
||||
.description
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
= render partial: "header", locals: { dossier: @dossier }
|
||||
|
||||
.messagerie.container
|
||||
%ul
|
||||
%ul.messages-list
|
||||
- @dossier.commentaires.each do |commentaire|
|
||||
%li
|
||||
= render partial: 'commentaire_icon', locals: { commentaire: commentaire, current_gestionnaire: current_gestionnaire }
|
||||
|
@ -13,7 +13,8 @@
|
|||
- if ![current_gestionnaire.email, @dossier.user.email, 'contact@tps.apientreprise.fr'].include?(commentaire.email)
|
||||
%span.guest Invité
|
||||
%span.date= I18n.l(commentaire.created_at.localtime, format: '%H:%M le %d/%m/%Y')
|
||||
%p= sanitize(commentaire.body)
|
||||
.rich-text
|
||||
= sanitize(commentaire.body)
|
||||
- if file = commentaire.piece_justificative
|
||||
.attachment-link
|
||||
= link_to file.content_url, class: "button", target: "_blank", title: "Télécharger" do
|
||||
|
|
|
@ -125,7 +125,7 @@
|
|||
.container
|
||||
.cta-panel-wrapper
|
||||
%div
|
||||
%h1.cta-panel-title Commencez à dématerialiser vos procédures
|
||||
%h1.cta-panel-title Commencez à dématérialiser vos procédures
|
||||
%p.cta-panel-explanation Nous vous accompagnons dans la prise en main de l’outil
|
||||
%div
|
||||
= link_to "Demander une démo",
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe DossierDecorator do
|
||||
let(:dossier) { create(:dossier, created_at: Time.new(2015, 12, 24, 14, 10), updated_at: Time.new(2015, 12, 24, 14, 10)) }
|
||||
let(:dossier) do
|
||||
dossier = create(:dossier, created_at: Time.new(2015, 12, 24, 14, 10))
|
||||
dossier.update_column('updated_at', Time.new(2015, 12, 24, 14, 10))
|
||||
dossier
|
||||
end
|
||||
|
||||
subject { dossier.decorate }
|
||||
|
||||
describe 'first_creation' do
|
||||
|
|
|
@ -118,7 +118,7 @@ RSpec.describe Avis, type: :model do
|
|||
end
|
||||
end
|
||||
|
||||
describe "#downcase_email" do
|
||||
describe "#clean_email" do
|
||||
subject { Avis.create(claimant: claimant, email: email, dossier: create(:dossier), gestionnaire: create(:gestionnaire)) }
|
||||
|
||||
context "when there is no email" do
|
||||
|
@ -138,5 +138,11 @@ RSpec.describe Avis, type: :model do
|
|||
|
||||
it { expect(subject.email).to eq("toto@tps.fr") }
|
||||
end
|
||||
|
||||
context "when the email has some spaces before and after" do
|
||||
let(:email) { " toto@tps.fr " }
|
||||
|
||||
it { expect(subject.email).to eq("toto@tps.fr") }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -63,4 +63,50 @@ describe Champ do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'for_export' do
|
||||
let(:type_de_champ) { create(:type_de_champ_public, type_champ: type_champ) }
|
||||
let(:champ) { Champ.new(type_de_champ: type_de_champ, value: value) }
|
||||
|
||||
before { champ.save }
|
||||
|
||||
context 'when type_de_champ is text' do
|
||||
let(:type_champ) { 'text' }
|
||||
let(:value) { '123' }
|
||||
|
||||
it { expect(champ.for_export).to eq('123') }
|
||||
end
|
||||
|
||||
context 'when type_de_champ is textarea' do
|
||||
let(:type_champ) { 'textarea' }
|
||||
let(:value) { '<b>gras<b>' }
|
||||
|
||||
it { expect(champ.for_export).to eq('gras') }
|
||||
end
|
||||
|
||||
context 'when type_de_champ is yes_no' do
|
||||
let(:type_champ) { 'yes_no' }
|
||||
|
||||
context 'if yes' do
|
||||
let(:value) { 'yes' }
|
||||
|
||||
it { expect(champ.for_export).to eq('oui') }
|
||||
end
|
||||
|
||||
context 'if no' do
|
||||
let(:value) { 'no' }
|
||||
|
||||
it { expect(champ.for_export).to eq('non') }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when type_de_champ is multiple_drop_down_list' do
|
||||
let(:type_champ) { 'multiple_drop_down_list' }
|
||||
let(:value) { '["Crétinier", "Mousserie"]' }
|
||||
|
||||
before { type_de_champ.drop_down_list = create(:drop_down_list) }
|
||||
|
||||
it { expect(champ.for_export).to eq('Crétinier, Mousserie') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -412,8 +412,8 @@ describe Dossier do
|
|||
}
|
||||
end
|
||||
|
||||
describe '#data_with_champs' do
|
||||
subject { dossier.data_with_champs }
|
||||
describe '#to_sorted_values' do
|
||||
subject { dossier.to_sorted_values }
|
||||
|
||||
it { expect(subject[0]).to be_a_kind_of(Integer) }
|
||||
it { expect(subject[1]).to be_a_kind_of(Time) }
|
||||
|
@ -441,7 +441,7 @@ describe Dossier do
|
|||
context 'dossier for individual' do
|
||||
let(:dossier_with_individual) { create(:dossier, :for_individual, user: user, procedure: procedure) }
|
||||
|
||||
subject { dossier_with_individual.data_with_champs }
|
||||
subject { dossier_with_individual.to_sorted_values }
|
||||
|
||||
it { expect(subject[12]).to eq(dossier_with_individual.individual.gender) }
|
||||
it { expect(subject[13]).to eq(dossier_with_individual.individual.prenom) }
|
||||
|
@ -887,7 +887,7 @@ describe Dossier do
|
|||
it { expect(dossier.get_value('type_de_champ_private', @champ_private.type_de_champ.id.to_s)).to eq(dossier.champs_private.first.value) }
|
||||
end
|
||||
|
||||
describe 'updated_at', focus: true do
|
||||
describe 'updated_at' do
|
||||
let!(:dossier) { create(:dossier) }
|
||||
let(:modif_date) { DateTime.parse('01/01/2100') }
|
||||
|
||||
|
|
Loading…
Reference in a new issue