Merge branch 'dev'
This commit is contained in:
commit
da3f528464
14 changed files with 138 additions and 40 deletions
|
@ -3,7 +3,7 @@ document.addEventListener('turbolinks:load', function() {
|
||||||
|
|
||||||
$('select.select2-limited').select2({
|
$('select.select2-limited').select2({
|
||||||
'placeholder': 'Sélectionnez des colonnes',
|
'placeholder': 'Sélectionnez des colonnes',
|
||||||
'maximumSelectionLength': '2',
|
'maximumSelectionLength': '5',
|
||||||
'width': '300px'
|
'width': '300px'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,6 +2,13 @@
|
||||||
@import "constants";
|
@import "constants";
|
||||||
|
|
||||||
.table.dossiers-table {
|
.table.dossiers-table {
|
||||||
|
font-size: 14px;
|
||||||
|
|
||||||
|
th {
|
||||||
|
vertical-align: middle;
|
||||||
|
padding: (2 * $default-spacer) $default-spacer;
|
||||||
|
}
|
||||||
|
|
||||||
td {
|
td {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +25,10 @@
|
||||||
|
|
||||||
.cell-link {
|
.cell-link {
|
||||||
color: $black;
|
color: $black;
|
||||||
padding: (3 * $default-spacer) 2px;
|
// In order to have identical height in the table header and the table rows,
|
||||||
|
// we compensate for the height difference between the biggest element of the header
|
||||||
|
// (the Personnaliser button, 38px) and the biggest cell-link element of the rows (the label, 28px)
|
||||||
|
padding: calc((2 * #{$default-spacer}) + ((38px - 28px) / 2)) $default-spacer;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,18 +42,23 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.number-col,
|
.number-col {
|
||||||
.status-col {
|
width: 110px;
|
||||||
width: 130px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-col span {
|
.status-col {
|
||||||
|
width: 110px;
|
||||||
|
|
||||||
|
.label {
|
||||||
width: 110px;
|
width: 110px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.follow-col {
|
.follow-col {
|
||||||
width: 200px;
|
width: 190px;
|
||||||
text-align: center;
|
text-align: right;
|
||||||
|
padding-left: $default-spacer;
|
||||||
|
padding-right: $default-spacer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
line-height: 18px;
|
||||||
|
|
||||||
&.instruction {
|
&.instruction {
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
|
|
|
@ -80,13 +80,6 @@ $landing-breakpoint: 1040px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.hero-phone-cta {
|
|
||||||
color: $grey;
|
|
||||||
text-align: center;
|
|
||||||
width: 293px;
|
|
||||||
margin-top: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.landing-panel-title {
|
.landing-panel-title {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
|
@ -275,15 +268,15 @@ $cta-panel-button-border-size: 2px;
|
||||||
|
|
||||||
.cta-panel-button {
|
.cta-panel-button {
|
||||||
@include horizontal-padding(30px);
|
@include horizontal-padding(30px);
|
||||||
|
@include vertical-padding(10px);
|
||||||
display: block;
|
display: block;
|
||||||
padding: 10px;
|
|
||||||
border-radius: 100px;
|
border-radius: 100px;
|
||||||
border: $cta-panel-button-border-size solid #FFFFFF;
|
border: $cta-panel-button-border-size solid #FFFFFF;
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
margin-top: 20px;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
|
@ -296,11 +289,3 @@ $cta-panel-button-border-size: 2px;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.cta-panel-phone-cta {
|
|
||||||
color: rgba(255, 255, 255, 0.9);
|
|
||||||
text-align: center;
|
|
||||||
width: 293px;
|
|
||||||
margin-top: 12px;
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.dossiers-table {
|
.dossiers-table {
|
||||||
margin: (3 * $default-spacer) auto;
|
margin-top: $default-spacer;
|
||||||
|
margin-bottom: 3 * $default-spacer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.procedure-actions {
|
.procedure-actions {
|
||||||
|
|
|
@ -21,6 +21,14 @@ class NotificationMailer < ApplicationMailer
|
||||||
mail(subject: @object) { |format| format.html { @body } }
|
mail(subject: @object) { |format| format.html { @body } }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def send_draft_notification(dossier)
|
||||||
|
vars_mailer(dossier)
|
||||||
|
|
||||||
|
@object = "Retrouvez votre brouillon pour la démarche : #{dossier.procedure.libelle}"
|
||||||
|
|
||||||
|
mail(subject: @object)
|
||||||
|
end
|
||||||
|
|
||||||
def new_answer(dossier)
|
def new_answer(dossier)
|
||||||
send_mail dossier, "Nouveau message pour votre dossier TPS nº #{dossier.id}"
|
send_mail dossier, "Nouveau message pour votre dossier TPS nº #{dossier.id}"
|
||||||
end
|
end
|
||||||
|
|
|
@ -36,7 +36,7 @@ module MailTemplateConcern
|
||||||
|
|
||||||
def replace_tags(string, dossier)
|
def replace_tags(string, dossier)
|
||||||
TAGS.inject(string) do |acc, tag|
|
TAGS.inject(string) do |acc, tag|
|
||||||
acc.gsub!("--#{tag[:name]}--", replace_tag(tag, dossier)) || acc
|
acc.gsub("--#{tag[:name]}--", replace_tag(tag, dossier)) || acc
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,7 @@ class Dossier < ActiveRecord::Base
|
||||||
after_save :build_default_champs, if: Proc.new { procedure_id_changed? }
|
after_save :build_default_champs, if: Proc.new { procedure_id_changed? }
|
||||||
after_save :build_default_individual, if: Proc.new { procedure.for_individual? }
|
after_save :build_default_individual, if: Proc.new { procedure.for_individual? }
|
||||||
after_save :send_dossier_received
|
after_save :send_dossier_received
|
||||||
|
after_create :send_draft_notification_email
|
||||||
|
|
||||||
validates :user, presence: true
|
validates :user, presence: true
|
||||||
|
|
||||||
|
@ -380,4 +381,10 @@ class Dossier < ActiveRecord::Base
|
||||||
NotificationMailer.send_dossier_received(id).deliver_later
|
NotificationMailer.send_dossier_received(id).deliver_later
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def send_draft_notification_email
|
||||||
|
if brouillon?
|
||||||
|
NotificationMailer.send_draft_notification(self).deliver_now!
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
Bonjour,
|
||||||
|
%br
|
||||||
|
%br
|
||||||
|
Vous pouvez retrouver et compléter le brouillon que vous avez créé pour la démarche
|
||||||
|
%strong= @dossier.procedure.libelle
|
||||||
|
à l'adresse suivante :
|
||||||
|
= link_to users_dossiers_url(liste: 'brouillon'), users_dossiers_url(liste: 'brouillon'), target: '_blank'
|
||||||
|
%br
|
||||||
|
%br
|
||||||
|
Bonne journée,
|
||||||
|
%br
|
||||||
|
%br
|
||||||
|
L'équipe Téléprocédures Simplifiées
|
||||||
|
%br
|
||||||
|
%br
|
||||||
|
—
|
||||||
|
%br
|
||||||
|
%br
|
||||||
|
Merci de ne pas répondre à cet email. Postez directement vos questions dans votre dossier sur la plateforme.
|
|
@ -13,9 +13,6 @@
|
||||||
target: "_blank",
|
target: "_blank",
|
||||||
onclick: "javascript: ga('send', 'pageview', '/demander-une-demo')"
|
onclick: "javascript: ga('send', 'pageview', '/demander-une-demo')"
|
||||||
|
|
||||||
%p.hero-phone-cta
|
|
||||||
ou nous appeler au 09 72 62 57 12
|
|
||||||
|
|
||||||
.hero-illustration
|
.hero-illustration
|
||||||
%img{ :src => image_url("landing/hero/dematerialiser.svg") }
|
%img{ :src => image_url("landing/hero/dematerialiser.svg") }
|
||||||
|
|
||||||
|
@ -136,5 +133,3 @@
|
||||||
class: "cta-panel-button",
|
class: "cta-panel-button",
|
||||||
target: "_blank",
|
target: "_blank",
|
||||||
onclick: "javascript: ga('send', 'pageview', '/demander-une-demo')"
|
onclick: "javascript: ga('send', 'pageview', '/demander-une-demo')"
|
||||||
%p.cta-panel-phone-cta
|
|
||||||
ou nous appeler au 09 72 62 57 12
|
|
||||||
|
|
|
@ -2,4 +2,8 @@ class NotificationMailerPreview < ActionMailer::Preview
|
||||||
def send_notification
|
def send_notification
|
||||||
NotificationMailer.send_notification(Dossier.last, Dossier.last.procedure.initiated_mail_template)
|
NotificationMailer.send_notification(Dossier.last, Dossier.last.procedure.initiated_mail_template)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def send_draft_notification
|
||||||
|
NotificationMailer.send_draft_notification(Dossier.last)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -102,7 +102,7 @@ describe AttestationTemplate, type: :model do
|
||||||
let(:entreprise) { create(:entreprise, etablissement: etablissement) }
|
let(:entreprise) { create(:entreprise, etablissement: etablissement) }
|
||||||
let(:types_de_champ) { [] }
|
let(:types_de_champ) { [] }
|
||||||
let(:types_de_champ_private) { [] }
|
let(:types_de_champ_private) { [] }
|
||||||
let(:dossier) { create(:dossier, procedure: procedure, individual: individual, entreprise: entreprise) }
|
let!(:dossier) { create(:dossier, procedure: procedure, individual: individual, entreprise: entreprise) }
|
||||||
let(:template_title) { 'title' }
|
let(:template_title) { 'title' }
|
||||||
let(:template_body) { 'body' }
|
let(:template_body) { 'body' }
|
||||||
let(:attestation_template) do
|
let(:attestation_template) do
|
||||||
|
|
|
@ -1,17 +1,56 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe MailTemplateConcern do
|
describe MailTemplateConcern do
|
||||||
describe '.replace_tags' do
|
|
||||||
let(:dossier) { create :dossier }
|
let(:dossier) { create :dossier }
|
||||||
|
let(:dossier2) { create :dossier }
|
||||||
let(:initiated_mail) { Mails::InitiatedMail.default }
|
let(:initiated_mail) { Mails::InitiatedMail.default }
|
||||||
|
|
||||||
it 'works' do
|
shared_examples "can replace tokens in template" do
|
||||||
initiated_mail.object = '[TPS] --numero_dossier-- --libelle_procedure-- --lien_dossier--'
|
describe 'with no token to replace' do
|
||||||
|
let(:template) { '[TPS] rien à remplacer' }
|
||||||
|
it do
|
||||||
|
is_expected.to eq("[TPS] rien à remplacer")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'with one token to replace' do
|
||||||
|
let(:template) { '[TPS] Dossier : --numero_dossier--' }
|
||||||
|
it do
|
||||||
|
is_expected.to eq("[TPS] Dossier : #{dossier.id}")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'with multiples tokens to replace' do
|
||||||
|
let(:template) { '[TPS] --numero_dossier-- --libelle_procedure-- --lien_dossier--' }
|
||||||
|
it do
|
||||||
expected =
|
expected =
|
||||||
"[TPS] #{dossier.id} #{dossier.procedure.libelle} " +
|
"[TPS] #{dossier.id} #{dossier.procedure.libelle} " +
|
||||||
"<a target=\"_blank\" href=\"http://localhost:3000/users/dossiers/#{dossier.id}/recapitulatif\">http://localhost:3000/users/dossiers/#{dossier.id}/recapitulatif</a>"
|
"<a target=\"_blank\" href=\"http://localhost:3000/users/dossiers/#{dossier.id}/recapitulatif\">http://localhost:3000/users/dossiers/#{dossier.id}/recapitulatif</a>"
|
||||||
|
|
||||||
expect(initiated_mail.object_for_dossier(dossier)).to eq(expected)
|
is_expected.to eq(expected)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '.object_for_dossier' do
|
||||||
|
before { initiated_mail.object = template }
|
||||||
|
subject { initiated_mail.object_for_dossier(dossier) }
|
||||||
|
|
||||||
|
it_behaves_like "can replace tokens in template"
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '.body_for_dossier' do
|
||||||
|
before { initiated_mail.body = template }
|
||||||
|
subject { initiated_mail.body_for_dossier(dossier) }
|
||||||
|
|
||||||
|
it_behaves_like "can replace tokens in template"
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '.replace_tags' do
|
||||||
|
it "avoids side effects" do
|
||||||
|
subject = "n --numero_dossier--"
|
||||||
|
expect(initiated_mail.replace_tags(subject, dossier)).to eq("n #{dossier.id}")
|
||||||
|
expect(initiated_mail.replace_tags(subject, dossier2)).to eq("n #{dossier2.id}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -792,6 +792,30 @@ describe Dossier do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#send_draft_notification_email" do
|
||||||
|
let(:procedure) { create(:procedure) }
|
||||||
|
let(:user) { create(:user) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
ActionMailer::Base.deliveries.clear
|
||||||
|
end
|
||||||
|
|
||||||
|
it "send an email when the dossier is created for the very first time" do
|
||||||
|
expect { Dossier.create(procedure: procedure, state: "draft", user: user) }.to change(ActionMailer::Base.deliveries, :size).from(0).to(1)
|
||||||
|
|
||||||
|
mail = ActionMailer::Base.deliveries.last
|
||||||
|
expect(mail.subject).to eq("Retrouvez votre brouillon pour la démarche : #{procedure.libelle}")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "does not send an email when the dossier is created with a non draft state" do
|
||||||
|
expect { Dossier.create(procedure: procedure, state: "initiated", user: user) }.not_to change(ActionMailer::Base.deliveries, :size)
|
||||||
|
expect { Dossier.create(procedure: procedure, state: "received", user: user) }.not_to change(ActionMailer::Base.deliveries, :size)
|
||||||
|
expect { Dossier.create(procedure: procedure, state: "closed", user: user) }.not_to change(ActionMailer::Base.deliveries, :size)
|
||||||
|
expect { Dossier.create(procedure: procedure, state: "refused", user: user) }.not_to change(ActionMailer::Base.deliveries, :size)
|
||||||
|
expect { Dossier.create(procedure: procedure, state: "without_continuation", user: user) }.not_to change(ActionMailer::Base.deliveries, :size)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe '.build_attestation' do
|
describe '.build_attestation' do
|
||||||
let(:attestation_template) { nil }
|
let(:attestation_template) { nil }
|
||||||
let(:procedure) { create(:procedure, attestation_template: attestation_template) }
|
let(:procedure) { create(:procedure, attestation_template: attestation_template) }
|
||||||
|
|
Loading…
Reference in a new issue