From 38e8acf285cea3cbcf4eb519301bfb27a73c5829 Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Tue, 31 Jan 2017 10:46:20 +0100 Subject: [PATCH 1/4] Change some wordings and clean some templates --- .gitignore | 1 + app/assets/stylesheets/procedure.scss | 10 +++- app/views/admin/procedures/show.html.haml | 11 ++-- app/views/dossiers/_dossier_show.html.haml | 60 +------------------ app/views/dossiers/_messagerie.html.haml | 47 +++++++++++++++ .../sessions/_resume_procedure.html.haml | 23 +++---- 6 files changed, 78 insertions(+), 74 deletions(-) create mode 100644 app/views/dossiers/_messagerie.html.haml diff --git a/.gitignore b/.gitignore index 298f5f1bc..d7587c6c6 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ config/fog_credentials.yml uploads/* coverage/**/* .DS_Store +.byebug_history diff --git a/app/assets/stylesheets/procedure.scss b/app/assets/stylesheets/procedure.scss index 95cb96de8..bb353956f 100644 --- a/app/assets/stylesheets/procedure.scss +++ b/app/assets/stylesheets/procedure.scss @@ -8,4 +8,12 @@ #individual_with_siret { display: none; -} \ No newline at end of file +} + +.procedure { + &-description { + img { + max-width: 100%; + } + } +} diff --git a/app/views/admin/procedures/show.html.haml b/app/views/admin/procedures/show.html.haml index 26e940142..f13f46bfb 100644 --- a/app/views/admin/procedures/show.html.haml +++ b/app/views/admin/procedures/show.html.haml @@ -50,7 +50,7 @@ %b Cette procédure a été archivée et n'est plus accessible par le public. - elsif @facade.procedure.published? - = @facade.procedure.lien + = link_to @facade.procedure.lien, @facade.procedure.lien, target: '_blank' - else %b Cette procédure n'a pas encore été publiée et n'est donc pas accessible par le public. @@ -59,12 +59,13 @@ %h3 Détails .row{style:'margin-right:3%; margin-left:3%;'} - .description.col-md-3.col-sm-3.col-xs-3.col-lg-3 + .description.col-xs-6.col-md-3.procedure-description %h4.text-info = @facade.procedure.libelle = h @facade.procedure.description.html_safe - .champs.col-md-3.col-sm-3.col-xs-3.col-lg-3 + + .champs.col-xs-6.col-md-3 %h4.text-info Champs .badge.progress-bar-info @@ -73,7 +74,7 @@ = champ.libelle %br - .champs_private.col-md-3.col-sm-3.col-xs-3.col-lg-3 + .champs_private.col-xs-6.col-md-3 %h4.text-info Champs privés .badge.progress-bar-info @@ -82,7 +83,7 @@ = champ.libelle %br - .pieces_justificatives.col-md-3.col-sm-3.col-xs-3.col-lg-3 + .pieces_justificatives.col-xs-6.col-md-3 %h4.text-info Pièces justificatives .badge.progress-bar-info diff --git a/app/views/dossiers/_dossier_show.html.haml b/app/views/dossiers/_dossier_show.html.haml index e8681b45d..a89154ab0 100644 --- a/app/views/dossiers/_dossier_show.html.haml +++ b/app/views/dossiers/_dossier_show.html.haml @@ -1,57 +1,4 @@ -.default_data_block{style:'margin-top: 40px'} - .row.show-block#messages - %div.header - %div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title - .carret-right - .carret-down - MESSAGERIE avec votre - - if user_signed_in? - Administration - - elsif gestionnaire_signed_in? - Usager - %div.col-lg-2.col-md-2.col-sm-2.col-xs-2.count - - message_count = @facade.commentaires.count - = (message_count == 1) ? "1 message" : "#{message_count} messages" - %div.body - - unless @facade.commentaires.empty? - %div.commentaires - - @facade.commentaires.object.sort.each do |commentaire| - = render partial: 'dossiers/commentaire', locals: {commentaire: commentaire} - .row - .col-lg-12.col-md-12.col-sm-12.col-xs-12 - %div.split-hr - .row - %div.col-lg-12.col-md-12.col-sm-12.col-xs-12#new-commentaire - = form_tag(url_for({ controller: 'commentaires', action: :create, dossier_id: @facade.dossier.id, champ_id: @facade.champ_id }), class: 'form-inline', method: 'POST', multipart: true) do - %textarea.form-control{id: 'texte_commentaire', class: 'wysihtml5', name: 'texte_commentaire', style: 'width: 100%; margin-bottom:2%', rows: '5', placeholder:"Commentaire"} - %h4.text-primary{style: 'margin-top: 0px'} Ajouter un fichier - = file_field_tag "piece_justificative[content]", accept: PieceJustificative.accept_format, style: 'float: left; margin-left: 20px' - %input#save-message.form-control.btn.btn-send{ type: 'submit', value: 'ENVOYER' } - - if last_comment = @facade.commentaires.first - %div.last-commentaire - .row - %div.col-lg-12.col-md-12.col-sm-12.col-xs-12.comment-header - = "DERNIER MESSAGE (#{last_comment.header})" - .row - %div.col-lg-12.col-md-12.col-sm-12.col-xs-12.content - = last_comment.body.html_safe - - if file = last_comment.piece_justificative - .row - %div.col-lg-12.col-md-12.col-sm-12.col-xs-12.file - = link_to file.content_url, class: 'link', target: '_blank' do - %span.fa.fa-file - %div - = file.original_filename - .row - .col-lg-12.col-md-12.col-sm-12.col-xs-12 - %div#open-message.new-action - ENVOYER UN MESSAGE - - else - .last-commentaire - .row - .col-lg-12.col-md-12.col-sm-12.col-xs-12 - %div#open-message.new-action - ENVOYER UN MESSAGE += render partial: 'dossiers/messagerie', locals: { dossier_facade: @facade } - if @facade.procedure.individual_with_siret .default_data_block @@ -59,7 +6,7 @@ %div.header %div.col-lg-8.col-md-8.col-sm-8.col-xs-8.title-no-expanse %div.carret-right - INFORMATIONS ENTREPRISE / ASSOCIATION + INFORMATIONS DU DEMANDEUR - if !@current_gestionnaire && ["draft", "updated", "replied", "initiated"].include?(@facade.dossier.state) %a#add_siret.action{href: users_dossier_add_siret_path(dossier_id: @facade.dossier.id)} %div.col-lg-4.col-md-4.col-sm-4.col-xs-4.action @@ -72,7 +19,7 @@ %div.col-lg-12.col-md-12.col-sm-12.col-xs-12.title %div.carret-right %div.carret-down - INFORMATIONS ENTREPRISE / ASSOCIATION + INFORMATIONS DU DEMANDEUR %div.body = render partial: '/dossiers/infos_entreprise' @@ -118,4 +65,3 @@ = (private_fields_count == 1) ? "1 champ" : "#{private_fields_count} champs" %div.body = render partial: '/dossiers/infos_private_fields' - diff --git a/app/views/dossiers/_messagerie.html.haml b/app/views/dossiers/_messagerie.html.haml new file mode 100644 index 000000000..754c34e50 --- /dev/null +++ b/app/views/dossiers/_messagerie.html.haml @@ -0,0 +1,47 @@ +.default_data_block{style:'margin-top: 40px'} + .row.show-block.clearfix#messages + .header + .col-xs-10.title + .carret-right + .carret-down + MESSAGERIE + + .col-xs-2.count + - message_count = dossier_facade.commentaires.count + = (message_count == 1) ? "1 message" : "#{message_count} messages" + .alert.alert-info + Cette messagerie permet d'échanger entre le demandeur et le service instructeur. + .body + - if dossier_facade.commentaires.any? + .commentaires + = render partial: 'dossiers/commentaire', collection: dossier_facade.commentaires.object.sort + .split-hr + #new-commentaire + = form_tag(url_for({ controller: 'commentaires', action: :create, dossier_id: dossier_facade.dossier.id, champ_id: dossier_facade.champ_id }), class: 'form-inline', method: 'POST', multipart: true) do + + %textarea.form-control{id: 'texte_commentaire', class: 'wysihtml5', name: 'texte_commentaire', style: 'width: 100%; margin-bottom:2%', rows: '5', placeholder:"Commentaire"} + + .row + .col-md-6 + %h4.text-primary{style: 'margin-top: 0px'} Ajouter un fichier + = file_field_tag "piece_justificative[content]", accept: PieceJustificative.accept_format, style: 'float: left; margin-left: 20px' + + .col-md-6 + %input#save-message.form-control.btn.btn-send{ type: 'submit', value: 'ENVOYER' } + + + .last-commentaire.clearfix + - if last_comment = dossier_facade.commentaires.first + %div + DERNIER MESSAGE + = render partial: 'dossiers/commentaire', object: last_comment + -# = "DERNIER MESSAGE (#{last_comment.header})" + -# .content + -# = last_comment.body.html_safe + -# - if file = last_comment.piece_justificative + -# .file + -# = link_to file.content_url, class: 'link', target: '_blank' do + -# %span.fa.fa-file + -# = file.original_filename + #open-message.new-action + ENVOYER UN MESSAGE diff --git a/app/views/users/sessions/_resume_procedure.html.haml b/app/views/users/sessions/_resume_procedure.html.haml index 3fdbfdaa2..590169cad 100644 --- a/app/views/users/sessions/_resume_procedure.html.haml +++ b/app/views/users/sessions/_resume_procedure.html.haml @@ -1,19 +1,20 @@ - if @dossier - = link_to 'X', users_no_procedure_url, class: 'btn btn-xs', style:'float: right' + .panel.panel-default + .panel-body + = link_to 'X', users_no_procedure_url, class: 'btn btn-xs', style:'float: right' - - if @dossier.procedure.euro_flag - #euro_flag.flag - =image_tag('drapeau_europe.png') + - if @dossier.procedure.euro_flag + #euro_flag.flag + =image_tag('drapeau_europe.png') - #logo_procedure.flag - =image_tag( @dossier.procedure.decorate.logo_img ) + #logo_procedure.flag + =image_tag( @dossier.procedure.decorate.logo_img ) - %h2#titre_procedure.text-info - = @dossier.procedure.libelle - %p - = h @dossier.procedure.description.html_safe + %h2#titre_procedure.text-info + = @dossier.procedure.libelle + %p.procedure-description + = h @dossier.procedure.description.html_safe - else #logo_procedure.flag = image_tag(image_url(LOGO_NAME), {id: 'logo_tps'}) -%br \ No newline at end of file From 37d31fae7bb3a733502dd06a4f4bf294ce7cb907 Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Tue, 31 Jan 2017 11:45:29 +0100 Subject: [PATCH 2/4] Rename formulaire to formulaire de demande --- app/views/admin/procedures/_informations.html.haml | 4 ++-- app/views/users/description/_pieces_justificatives.html.haml | 2 +- app/views/users/description/_show.html.haml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/admin/procedures/_informations.html.haml b/app/views/admin/procedures/_informations.html.haml index bf5776e99..dfbbcaf67 100644 --- a/app/views/admin/procedures/_informations.html.haml +++ b/app/views/admin/procedures/_informations.html.haml @@ -49,10 +49,10 @@ Cadastre .col-md-6.col-sm-6.col-xs-6.col-lg-6 - %h4 Formulaire / CERFA + %h4 Formulaire de demande ou CERFA %label =f.check_box :cerfa_flag - Activer l'envoi de formulaire / CERFA + Activer l'envoi de formulaire de demande ou CERFA %br =f.text_field :lien_demarche, class: 'form-control', placeholder: 'URL vers le formulaire vierge (facultatif)' diff --git a/app/views/users/description/_pieces_justificatives.html.haml b/app/views/users/description/_pieces_justificatives.html.haml index b21942179..939148476 100644 --- a/app/views/users/description/_pieces_justificatives.html.haml +++ b/app/views/users/description/_pieces_justificatives.html.haml @@ -4,7 +4,7 @@ - if @dossier.procedure.cerfa_flag %tr %th.col-lg-6 - ='Formulaire / CERFA (complété et numérisé)' + ='Formulaire de demande ou CERFA (complété et numérisé)' %td.col-lg-5 -if @dossier.cerfa_available? diff --git a/app/views/users/description/_show.html.haml b/app/views/users/description/_show.html.haml index b9daf89f5..210ea4783 100644 --- a/app/views/users/description/_show.html.haml +++ b/app/views/users/description/_show.html.haml @@ -26,7 +26,7 @@ -unless @procedure.lien_demarche.blank? %p - Récupérer le formulaire / CERFA vierge pour mon dossier : + Récupérer le formulaire de demande ou CERFA vierge pour mon dossier : %a{style:'font-size:0.9em; padding-left:3px', id: 'lien_cerfa' ,href: "#{@procedure.lien_demarche}", :target => '_blank'} Télécharger From aea1816da19fc8a407f311f31ceae51f1fcdf2db Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Tue, 31 Jan 2017 17:22:03 +0100 Subject: [PATCH 3/4] add mailcatcher config in dev --- config/environments/development.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/config/environments/development.rb b/config/environments/development.rb index 4b96a6c33..96dc809bb 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -39,9 +39,17 @@ Rails.application.configure do # Raises helpful error messages. config.assets.raise_runtime_errors = true - config.action_mailer.delivery_method = :test + # Action Mailer settings + config.action_mailer.delivery_method = :smtp config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } + # Config for mailcatcher https://mailcatcher.me/ + config.action_mailer.smtp_settings = { + :address => "localhost", + :port => 1025, + :locale => 'fr' + } + # Raises error for missing translations # config.action_view.raise_on_missing_translations = true From ef9012cd822a27f64be282fa63e1d68c7fe1d647 Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Tue, 31 Jan 2017 17:58:44 +0100 Subject: [PATCH 4/4] Add lien cerfa vierge in the modification popup --- .../_pieces_justificatives.html.haml | 59 ++++++++++--------- app/views/users/description/_show.html.haml | 11 +--- .../recapitulatif/_modal_upload_pj.html.haml | 2 +- 3 files changed, 35 insertions(+), 37 deletions(-) diff --git a/app/views/users/description/_pieces_justificatives.html.haml b/app/views/users/description/_pieces_justificatives.html.haml index 939148476..e63b2968e 100644 --- a/app/views/users/description/_pieces_justificatives.html.haml +++ b/app/views/users/description/_pieces_justificatives.html.haml @@ -1,30 +1,33 @@ -.row - .col-lg-8.col-lg-push-1 - %table.table - - if @dossier.procedure.cerfa_flag - %tr - %th.col-lg-6 - ='Formulaire de demande ou CERFA (complété et numérisé)' +-unless dossier.procedure.lien_demarche.blank? + %p + Récupérer le formulaire de demande ou CERFA vierge pour mon dossier : + = link_to "Télécharger", dossier.procedure.lien_demarche, target: '_blank', id: 'lien_cerfa' - %td.col-lg-5 - -if @dossier.cerfa_available? - %span.btn.btn-sm.btn-file.btn-success - Modifier - %input{type: 'file', name:'cerfa_pdf', id:'cerfa_pdf', accept: PieceJustificative.accept_format, :max_file_size => 6.megabytes } - -else - %input{type: 'file', name:'cerfa_pdf', id:'cerfa_pdf', accept: PieceJustificative.accept_format, :max_file_size => 6.megabytes } +%table.table + - if dossier.procedure.cerfa_flag + %tr + %th.col-lg-6 + Formulaire de demande ou CERFA (complété et numérisé) - - @dossier.types_de_piece_justificative.order('order_place ASC').each do |type_de_piece_justificative| - %tr - %th.col-lg-6.piece-libelle - = type_de_piece_justificative.libelle - %td.col-lg-5 - -if type_de_piece_justificative.api_entreprise - %span.text-success{ id: "piece_justificative_#{type_de_piece_justificative.id}" } Nous l'avons récupéré pour vous. - -else - -if @dossier.retrieve_last_piece_justificative_by_type(type_de_piece_justificative.id).nil? - = file_field_tag "piece_justificative_#{type_de_piece_justificative.id}", accept: PieceJustificative.accept_format, :max_file_size => 6.megabytes - -else - %span.btn.btn-sm.btn-file.btn-success - Modifier - = file_field_tag "piece_justificative_#{type_de_piece_justificative.id}", accept: PieceJustificative.accept_format, :max_file_size => 6.megabytes + %td.col-lg-5 + -if dossier.cerfa_available? + %span.btn.btn-sm.btn-file.btn-success + Modifier + %input{type: 'file', name:'cerfa_pdf', id:'cerfa_pdf', accept: PieceJustificative.accept_format, :max_file_size => 6.megabytes } + -else + %input{type: 'file', name:'cerfa_pdf', id:'cerfa_pdf', accept: PieceJustificative.accept_format, :max_file_size => 6.megabytes } + + - dossier.types_de_piece_justificative.order('order_place ASC').each do |type_de_piece_justificative| + %tr + %th.col-lg-6.piece-libelle + = type_de_piece_justificative.libelle + %td.col-lg-5 + -if type_de_piece_justificative.api_entreprise + %span.text-success{ id: "piece_justificative_#{type_de_piece_justificative.id}" } Nous l'avons récupéré pour vous. + -else + -if dossier.retrieve_last_piece_justificative_by_type(type_de_piece_justificative.id).nil? + = file_field_tag "piece_justificative_#{type_de_piece_justificative.id}", accept: PieceJustificative.accept_format, :max_file_size => 6.megabytes + -else + %span.btn.btn-sm.btn-file.btn-success + Modifier + = file_field_tag "piece_justificative_#{type_de_piece_justificative.id}", accept: PieceJustificative.accept_format, :max_file_size => 6.megabytes diff --git a/app/views/users/description/_show.html.haml b/app/views/users/description/_show.html.haml index 210ea4783..7e130baaa 100644 --- a/app/views/users/description/_show.html.haml +++ b/app/views/users/description/_show.html.haml @@ -24,15 +24,10 @@ %br %h3 Documents administratifs - -unless @procedure.lien_demarche.blank? - %p - Récupérer le formulaire de demande ou CERFA vierge pour mon dossier : - %a{style:'font-size:0.9em; padding-left:3px', id: 'lien_cerfa' ,href: "#{@procedure.lien_demarche}", :target => '_blank'} Télécharger - - - %br //TODO a refactorer - = render partial: 'users/description/pieces_justificatives' + .row + .col-lg-8 + = render partial: 'users/description/pieces_justificatives', locals: { dossier: @dossier } - unless Features.opensimplif #state_description.row{style:'width: 50%; margin-left:20px'} diff --git a/app/views/users/recapitulatif/_modal_upload_pj.html.haml b/app/views/users/recapitulatif/_modal_upload_pj.html.haml index 0691c3f09..cba2b0b7d 100644 --- a/app/views/users/recapitulatif/_modal_upload_pj.html.haml +++ b/app/views/users/recapitulatif/_modal_upload_pj.html.haml @@ -11,7 +11,7 @@ Modification des documents .modal-body - = render partial: 'users/description/pieces_justificatives' + = render partial: 'users/description/pieces_justificatives', locals: { dossier: @dossier } .modal-footer = submit_tag 'Modification terminée', class: %w(btn btn btn-info), id: 'modification_terminee', data: { disable_with: 'Modification terminée', submit: true}