Merge branch 'dev'
This commit is contained in:
commit
7ed975fd71
27 changed files with 264 additions and 46 deletions
1
app/assets/images/icons/download-white.svg
Normal file
1
app/assets/images/icons/download-white.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="20" viewBox="0 0 16 20"><g fill="none" fill-rule="evenodd"><path d="M11.5 8H15l-7 7-7-7h3.5V1h7zM1 19h14" stroke="#FFF" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/><path d="M-4-2h24v24H-4z"/></g></svg>
|
After Width: | Height: | Size: 281 B |
32
app/assets/stylesheets/new_design/demarches_index.scss
Normal file
32
app/assets/stylesheets/new_design/demarches_index.scss
Normal file
|
@ -0,0 +1,32 @@
|
|||
@import "colors";
|
||||
|
||||
#demarches-index {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
margin-top: 30px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.list-header {
|
||||
color: $grey;
|
||||
font-weight: bold;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.demarche-links {
|
||||
border-top: 1px solid $border-grey;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.demarche-link {
|
||||
display: block;
|
||||
padding: 10px;
|
||||
border-bottom: 1px solid $border-grey;
|
||||
width: 100%;
|
||||
|
||||
&:hover {
|
||||
background-color: $lighter-blue;
|
||||
}
|
||||
}
|
|
@ -2,6 +2,8 @@
|
|||
@import "constants";
|
||||
|
||||
#dossier-show {
|
||||
margin-bottom: 30px;
|
||||
|
||||
.sub-header {
|
||||
.label {
|
||||
float: right;
|
||||
|
|
|
@ -53,6 +53,10 @@
|
|||
background-image: image-url("icons/attachment.svg");
|
||||
}
|
||||
|
||||
&.download {
|
||||
background-image: image-url("icons/download-white.svg");
|
||||
}
|
||||
|
||||
&.lock {
|
||||
background-image: image-url("icons/lock.svg");
|
||||
}
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
@import "placeholders";
|
||||
@import "colors";
|
||||
|
||||
.patron {
|
||||
p {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.icon.download {
|
||||
background-color: $blue;
|
||||
box-shadow: 0px 0px 1px 2px $blue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,18 +55,28 @@
|
|||
margin: auto;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.1em;
|
||||
font-weight: bold;
|
||||
margin-bottom: $default-spacer;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: $default-padding;
|
||||
}
|
||||
|
||||
.decision {
|
||||
font-size: 1.2em;
|
||||
margin-top: $default-padding * 3;
|
||||
margin-bottom: $default-padding * 3;
|
||||
}
|
||||
|
||||
.icon {
|
||||
margin-right: $default-spacer;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-weight: bold;
|
||||
margin-bottom: $default-spacer;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
quotes: "« " " »" "‘" "’";
|
||||
margin-bottom: $default-padding * 3;
|
||||
}
|
||||
|
||||
blockquote::before {
|
||||
|
@ -77,7 +87,7 @@
|
|||
content: close-quote;
|
||||
}
|
||||
|
||||
.icon {
|
||||
margin-right: $default-spacer;
|
||||
.action {
|
||||
margin-bottom: $default-padding * 3;
|
||||
}
|
||||
}
|
||||
|
|
21
app/controllers/new_user/demarches_controller.rb
Normal file
21
app/controllers/new_user/demarches_controller.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
module NewUser
|
||||
class DemarchesController < UserController
|
||||
def index
|
||||
@previous_demarches_still_active = current_user
|
||||
.dossiers
|
||||
.includes(:procedure)
|
||||
.map(&:procedure)
|
||||
.uniq
|
||||
.select { |p| p.publiee? }
|
||||
|
||||
@popular_demarches = Procedure
|
||||
.select("procedures.*, COUNT(*) AS procedures_count")
|
||||
.joins(:dossiers)
|
||||
.publiees
|
||||
.where(dossiers: { created_at: 7.days.ago..Time.now })
|
||||
.group("procedures.id")
|
||||
.order("procedures_count DESC")
|
||||
.limit(5)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -2,8 +2,6 @@ module NewUser
|
|||
class DossiersController < UserController
|
||||
include DossierHelper
|
||||
|
||||
helper_method :new_demarche_url
|
||||
|
||||
before_action :ensure_ownership!, except: [:index, :show, :demande, :messagerie, :brouillon, :update_brouillon, :modifier, :update, :recherche]
|
||||
before_action :ensure_ownership_or_invitation!, only: [:show, :demande, :messagerie, :brouillon, :update_brouillon, :modifier, :update, :create_commentaire]
|
||||
before_action :ensure_dossier_can_be_updated, only: [:update_identite, :update_brouillon, :modifier, :update]
|
||||
|
@ -177,10 +175,6 @@ module NewUser
|
|||
end
|
||||
end
|
||||
|
||||
def new_demarche_url
|
||||
"https://doc.demarches-simplifiees.fr/listes-des-demarches"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def ensure_dossier_can_be_updated
|
||||
|
|
25
app/views/new_user/demarches/index.html.haml
Normal file
25
app/views/new_user/demarches/index.html.haml
Normal file
|
@ -0,0 +1,25 @@
|
|||
- content_for(:title, "Démarches")
|
||||
|
||||
- content_for :footer do
|
||||
= render partial: "new_user/dossiers/index_footer"
|
||||
|
||||
#demarches-index
|
||||
.container
|
||||
%h1.page-title Démarches
|
||||
|
||||
- if @previous_demarches_still_active.present?
|
||||
%h2.list-header SUR LESQUELLES VOUS AVEZ DÉJÀ DÉPOSÉ UN DOSSIER
|
||||
%ul.demarche-links
|
||||
- @previous_demarches_still_active.each do |demarche|
|
||||
%li
|
||||
= link_to(demarche.libelle, commencer_url(procedure_path: demarche.path), class: "demarche-link")
|
||||
|
||||
- if @popular_demarches.present?
|
||||
%h2.list-header LES PLUS POPULAIRES
|
||||
%ul.demarche-links
|
||||
- @popular_demarches.each do |demarche|
|
||||
%li
|
||||
= link_to(demarche.libelle, commencer_url(procedure_path: demarche.path), class: "demarche-link")
|
||||
|
||||
%h2.list-header TOUTES LES DÉMARCHES
|
||||
= link_to("Voir l'intégralité des démarches disponibles", LISTE_DES_DEMARCHES_URL, class: "button")
|
|
@ -36,10 +36,4 @@
|
|||
%p= politique
|
||||
|
||||
.footer-row.footer-bottom-line
|
||||
= link_to "Accessibilité", accessibilite_index_path, :class => "footer-link"
|
||||
–
|
||||
= link_to "CGU", CGU_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer"
|
||||
–
|
||||
= link_to "Mentions légales", MENTIONS_LEGALES_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer"
|
||||
–
|
||||
= contact_link "Contact technique", class: "footer-link", dossier_id: dossier.id
|
||||
= render partial: "new_user/dossiers/general_footer_row", locals: { dossier: @dossier }
|
|
@ -0,0 +1,7 @@
|
|||
= link_to "Accessibilité", accessibilite_index_path, :class => "footer-link"
|
||||
–
|
||||
= link_to "CGU", CGU_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer"
|
||||
–
|
||||
= link_to "Mentions légales", MENTIONS_LEGALES_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer"
|
||||
–
|
||||
= contact_link "Contact technique", class: "footer-link", dossier_id: dossier&.id
|
4
app/views/new_user/dossiers/_index_footer.html.haml
Normal file
4
app/views/new_user/dossiers/_index_footer.html.haml
Normal file
|
@ -0,0 +1,4 @@
|
|||
%footer.dossier-footer
|
||||
.container
|
||||
.footer-row.footer-bottom-line
|
||||
= render partial: "new_user/dossiers/general_footer_row", locals: { dossier: nil }
|
|
@ -1,7 +1,7 @@
|
|||
- content_for(:title, "Modification du brouillon nº #{@dossier.id} (#{@dossier.procedure.libelle})")
|
||||
|
||||
- content_for :footer do
|
||||
= render partial: "new_user/dossiers/footer", locals: { dossier: @dossier }
|
||||
= render partial: "new_user/dossiers/dossier_footer", locals: { dossier: @dossier }
|
||||
|
||||
.dossier-edit
|
||||
.dossier-header.sub-header
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
- content_for(:title, "Demande · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})")
|
||||
|
||||
- content_for :footer do
|
||||
= render partial: "new_user/dossiers/dossier_footer", locals: { dossier: @dossier }
|
||||
|
||||
#dossier-show
|
||||
= render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier }
|
||||
|
||||
|
@ -8,3 +11,4 @@
|
|||
.container
|
||||
- if !@dossier.read_only?
|
||||
= link_to "Modifier le dossier", modifier_dossier_path(@dossier), class: 'button primary edit-form'
|
||||
.clearfix
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
- content_for(:title, "Nouveau dossier (#{@dossier.procedure.libelle})")
|
||||
|
||||
- content_for :footer do
|
||||
= render partial: "new_user/dossiers/footer", locals: { dossier: @dossier }
|
||||
= render partial: "new_user/dossiers/dossier_footer", locals: { dossier: @dossier }
|
||||
|
||||
.two-columns
|
||||
.columns-container
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
- content_for(:title, "Dossiers")
|
||||
|
||||
- content_for :footer do
|
||||
= render partial: "new_user/dossiers/index_footer"
|
||||
|
||||
.dossiers-headers.sub-header
|
||||
.container
|
||||
= link_to "Commencer une nouvelle démarche", new_demarche_url, class: "button secondary new-demarche"
|
||||
= link_to "Commencer une nouvelle démarche", demarches_url, class: "button secondary new-demarche"
|
||||
|
||||
- if @dossiers_invites.count == 0
|
||||
%h1.page-title Mes dossiers
|
||||
|
@ -63,4 +66,4 @@
|
|||
.dossiers-table-empty
|
||||
%h2.empty-text Aucun dossier.
|
||||
%p.empty-text-details Vous n’avez pas encore commencé de démarche.
|
||||
= link_to "Commencer une nouvelle démarche", new_demarche_url, class: "button primary"
|
||||
= link_to "Commencer une nouvelle démarche", demarches_url, class: "button primary"
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
- content_for(:title, "Messagerie · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})")
|
||||
|
||||
- content_for :footer do
|
||||
= render partial: "new_user/dossiers/dossier_footer", locals: { dossier: @dossier }
|
||||
|
||||
#dossier-show
|
||||
= render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier }
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
- content_for(:title, "Modifier · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})")
|
||||
|
||||
- content_for :footer do
|
||||
= render partial: "new_user/dossiers/dossier_footer", locals: { dossier: @dossier }
|
||||
|
||||
#dossier-show
|
||||
= render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier }
|
||||
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
- content_for(:title, "Résumé · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})")
|
||||
|
||||
- content_for :footer do
|
||||
= render partial: "new_user/dossiers/dossier_footer", locals: { dossier: @dossier }
|
||||
|
||||
#dossier-show
|
||||
= render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier }
|
||||
|
||||
.container
|
||||
= render partial: 'new_user/dossiers/show/status_overview', locals: { dossier: @dossier }
|
||||
|
||||
- latest_message = @dossier.commentaires.last
|
||||
- if latest_message.present?
|
||||
.latest-message-section
|
||||
%h3.tab-title Dernier message
|
||||
|
||||
.message.inverted-background
|
||||
= render partial: "shared/dossiers/messages/message", locals: { commentaire: latest_message, connected_user: current_user, messagerie_seen_at: nil }
|
||||
|
||||
= link_to commentaire_answer_action(latest_message, current_user), messagerie_dossier_url(@dossier, anchor: 'new_commentaire'), class: 'button send'
|
||||
- if !@dossier.termine?
|
||||
= render partial: 'new_user/dossiers/show/latest_message', locals: { dossier: @dossier }
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
- latest_message = dossier.commentaires.last
|
||||
- if latest_message.present?
|
||||
.latest-message-section
|
||||
%h3.tab-title Dernier message
|
||||
|
||||
.message.inverted-background
|
||||
= render partial: "shared/dossiers/messages/message", locals: { commentaire: latest_message, connected_user: current_user, messagerie_seen_at: nil }
|
||||
|
||||
= link_to commentaire_answer_action(latest_message, current_user), messagerie_dossier_url(dossier, anchor: 'new_commentaire'), class: 'button send'
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
- elsif dossier.accepte?
|
||||
.accepte
|
||||
%p
|
||||
%p.decision
|
||||
%span.icon.accept
|
||||
Votre dossier a été
|
||||
= succeed '.' do
|
||||
|
@ -38,9 +38,15 @@
|
|||
%h3 Motif de l’acceptation
|
||||
%blockquote= dossier.motivation
|
||||
|
||||
- if dossier.attestation.present?
|
||||
.action
|
||||
= link_to attestation_dossier_path(dossier), target: '_blank', class: 'button primary' do
|
||||
%span.icon.download
|
||||
Télécharger l’attestation
|
||||
|
||||
- elsif dossier.refuse?
|
||||
.refuse
|
||||
%p
|
||||
%p.decision
|
||||
%span.icon.refuse
|
||||
Nous sommes désolés, votre dossier a malheureusement été
|
||||
= succeed '.' do
|
||||
|
@ -50,9 +56,12 @@
|
|||
%h3 Motif du refus
|
||||
%blockquote= dossier.motivation
|
||||
|
||||
.action
|
||||
= link_to 'Envoyer un message à l’administration', messagerie_dossier_url(dossier, anchor: 'new_commentaire'), class: 'button'
|
||||
|
||||
- elsif dossier.sans_suite?
|
||||
.sans-suite
|
||||
%p
|
||||
%p.decision
|
||||
%span.icon.without-continuation
|
||||
Votre dossier a été classé
|
||||
= succeed '.' do
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
%span.icon.search
|
||||
%span.icon.sign-out
|
||||
%span.icon.info
|
||||
%span.icon.download
|
||||
%span.icon.frown
|
||||
%span.icon.meh
|
||||
%span.icon.smile
|
||||
|
|
|
@ -292,6 +292,7 @@ Rails.application.routes.draw do
|
|||
end
|
||||
end
|
||||
resource :feedback, only: [:create]
|
||||
get 'demarches' => 'demarches#index'
|
||||
end
|
||||
|
||||
#
|
||||
|
|
75
lib/tasks/2018_09_12_fix_templates.rake
Normal file
75
lib/tasks/2018_09_12_fix_templates.rake
Normal file
|
@ -0,0 +1,75 @@
|
|||
namespace :'2018_09_12_fix_templates' do
|
||||
task run: :environment do
|
||||
dossiers_with_invalid_attestations = find_dossiers_with_sent_and_invalid_attestations
|
||||
fix_templates
|
||||
fixed_attestations = regenerate_attestations(dossiers_with_invalid_attestations)
|
||||
send_regenerated_attestations(dossiers_with_invalid_attestations)
|
||||
end
|
||||
|
||||
# 16:15 in Paris -> 14:15 UTC
|
||||
DEPLOY_DATETIME = DateTime.new(2018, 9, 5, 14, 15, 0)
|
||||
|
||||
def find_dossiers_with_sent_and_invalid_attestations
|
||||
invalid_procedures_ids = AttestationTemplate
|
||||
.where("body LIKE '%--libellé procédure--%'")
|
||||
.pluck(:procedure_id)
|
||||
|
||||
dossiers_with_invalid_template_ids = Dossier
|
||||
.where(procedure_id: invalid_procedures_ids)
|
||||
.where(processed_at: DEPLOY_DATETIME..Time.now)
|
||||
.pluck(:id)
|
||||
|
||||
Attestation
|
||||
.includes(:dossier)
|
||||
.where(created_at: DEPLOY_DATETIME..Time.now)
|
||||
.where(dossier_id: dossiers_with_invalid_template_ids)
|
||||
.map(&:dossier)
|
||||
end
|
||||
|
||||
def fix_templates
|
||||
klasses = [
|
||||
Mails::ClosedMail,
|
||||
Mails::InitiatedMail,
|
||||
Mails::ReceivedMail,
|
||||
Mails::RefusedMail,
|
||||
Mails::WithoutContinuationMail,
|
||||
AttestationTemplate
|
||||
]
|
||||
|
||||
klasses.each do |klass|
|
||||
klass
|
||||
.where("body LIKE '%--libellé procédure--%'")
|
||||
.each do |instance|
|
||||
|
||||
instance.update(body: instance.body.gsub("--libellé procédure--", "--libellé démarche--"))
|
||||
rake_puts "Body mis-à-jour pour #{klass.to_s}##{instance.id}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def delete_then_regenerate_attestations(dossiers_with_invalid_attestations)
|
||||
dossiers_with_invalid_attestations.each do |dossier|
|
||||
begin
|
||||
dossier.attestation.destroy
|
||||
|
||||
dossier.attestation = dossier.build_attestation
|
||||
dossier.save
|
||||
|
||||
rake_puts "Attestation regénérée pour le dossier #{dossier.id}"
|
||||
rescue
|
||||
rake_puts "Erreur lors de la régénération de l'attestation pour le dossier #{dossier.id}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def send_regenerated_attestations(dossiers_with_invalid_attestations)
|
||||
dossiers_with_invalid_attestations.each do |dossier|
|
||||
begin
|
||||
ResendAttestationMailer.resend_attestation(dossier).deliver_later
|
||||
rake_puts "Email envoyé à #{dossier.user.email} pour le dossier #{dossier.id}"
|
||||
rescue
|
||||
rake_puts "Erreur lors de l'envoi de l'email à #{dossier.user.email} pour le dossier #{dossier.id}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -136,5 +136,14 @@ FactoryBot.define do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
trait :with_attestation do
|
||||
after(:create) do |dossier, _evaluator|
|
||||
if dossier.procedure.attestation_template.blank?
|
||||
dossier.procedure.attestation_template = create(:attestation_template)
|
||||
end
|
||||
dossier.attestation = dossier.build_attestation
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
describe 'new_user/dossiers/_footer.html.haml', type: :view do
|
||||
describe 'new_user/dossiers/_dossier_footer.html.haml', type: :view do
|
||||
let(:service) { create(:service) }
|
||||
let(:dossier) {
|
||||
dossier = create(:dossier)
|
||||
|
@ -6,7 +6,7 @@ describe 'new_user/dossiers/_footer.html.haml', type: :view do
|
|||
return dossier
|
||||
}
|
||||
|
||||
subject { render 'new_user/dossiers/footer.html.haml', dossier: dossier }
|
||||
subject { render 'new_user/dossiers/dossier_footer.html.haml', dossier: dossier }
|
||||
|
||||
it "affiche les informations de contact" do
|
||||
expect(subject).to have_text(service.nom)
|
|
@ -67,6 +67,11 @@ describe 'new_user/dossiers/show/_status_overview.html.haml', type: :view do
|
|||
it { is_expected.not_to have_selector('.status-timeline') }
|
||||
it { is_expected.to have_selector('.status-explanation .accepte') }
|
||||
it { is_expected.to have_text(dossier.motivation) }
|
||||
|
||||
context 'with attestation' do
|
||||
let(:dossier) { create :dossier, :accepte, :with_attestation }
|
||||
it { is_expected.to have_link(nil, href: attestation_dossier_path(dossier)) }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when refusé' do
|
||||
|
@ -75,6 +80,7 @@ describe 'new_user/dossiers/show/_status_overview.html.haml', type: :view do
|
|||
it { is_expected.not_to have_selector('.status-timeline') }
|
||||
it { is_expected.to have_selector('.status-explanation .refuse') }
|
||||
it { is_expected.to have_text(dossier.motivation) }
|
||||
it { is_expected.to have_link(nil, href: messagerie_dossier_url(dossier, anchor: 'new_commentaire')) }
|
||||
end
|
||||
|
||||
context 'when classé sans suite' do
|
||||
|
|
Loading…
Reference in a new issue