From 51daa2f49806a03b7b9ba93d2e3420e54d9bc71a Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 26 Apr 2017 14:46:43 +0200 Subject: [PATCH 1/5] Use implicit div tags instead of explicit --- app/views/admin/procedures/_modal_transfer.html.haml | 2 +- app/views/admin/procedures/index.html.haml | 2 +- app/views/dossiers/_edit_dossier.html.haml | 2 +- app/views/layouts/_footer.html.haml | 2 +- app/views/layouts/application.html.haml | 4 ++-- ..._left_panel_admin_procedurescontroller_index.html.haml | 8 ++++---- ...left_panel_admin_procedurescontroller_navbar.html.haml | 8 ++++---- .../left_panels/_left_panel_cgucontroller_index.html.haml | 2 +- .../_left_panel_users_dossierscontroller_index.html.haml | 8 ++++---- ...eft_panel_users_recapitulatifcontroller_show.html.haml | 6 +++--- .../_navbar_users_recapitulatifcontroller_show.html.haml | 2 +- 11 files changed, 23 insertions(+), 23 deletions(-) diff --git a/app/views/admin/procedures/_modal_transfer.html.haml b/app/views/admin/procedures/_modal_transfer.html.haml index 02a1a121e..733b19936 100644 --- a/app/views/admin/procedures/_modal_transfer.html.haml +++ b/app/views/admin/procedures/_modal_transfer.html.haml @@ -15,7 +15,7 @@ type: 'email', placeholder: 'Email administrateur cible', style: 'width: 300px; margin-left:auto; margin-right:auto' } - %div#not_found_admin.center.text-danger{ style:'display: none; margin-top: 10px;' } + #not_found_admin.center.text-danger{ style:'display: none; margin-top: 10px;' } Cet administrateur n'existe pas. .modal-footer = submit_tag "Envoyer", class: 'btn btn-success' diff --git a/app/views/admin/procedures/index.html.haml b/app/views/admin/procedures/index.html.haml index 7b2e1370c..89ed60b86 100644 --- a/app/views/admin/procedures/index.html.haml +++ b/app/views/admin/procedures/index.html.haml @@ -7,7 +7,7 @@ .carret-down Procédures %a{ href: '/admin/procedures/new' } - %div#new-procedure.col-lg-2.col-md-2.col-sm-2.col-xs-2.action + #new-procedure.col-lg-2.col-md-2.col-sm-2.col-xs-2.action Nouvelle .body diff --git a/app/views/dossiers/_edit_dossier.html.haml b/app/views/dossiers/_edit_dossier.html.haml index d02c08c89..50efbbd2f 100644 --- a/app/views/dossiers/_edit_dossier.html.haml +++ b/app/views/dossiers/_edit_dossier.html.haml @@ -1,5 +1,5 @@ - unless @facade.dossier.read_only? - if user_signed_in? && (@facade.dossier.owner?(current_user.email) || @facade.dossier.invite_by_user?(current_user.email)) %a#maj_infos.action{ href: "/users/dossiers/#{@facade.dossier.id}/description" } - %div#edit-dossier.col-lg-2.col-md-2.col-sm-2.col-xs-2.action + #edit-dossier.col-lg-2.col-md-2.col-sm-2.col-xs-2.action = "éditer".upcase diff --git a/app/views/layouts/_footer.html.haml b/app/views/layouts/_footer.html.haml index aa3ee661b..1fd340cc6 100644 --- a/app/views/layouts/_footer.html.haml +++ b/app/views/layouts/_footer.html.haml @@ -1,4 +1,4 @@ -%div#footer +#footer %p{ class: "copyright col-md-push-#{12-main_container_size} col-md-#{main_container_size} col-lg-push-#{12-main_container_size} col-lg-#{main_container_size} text-muted small" } = link_to 'SGMAP', "http://etatplateforme.modernisation.gouv.fr" = Time.now.year diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 225169964..e6aeea5e5 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -32,9 +32,9 @@ = render partial: 'layouts/ie_lt_10' - %div#wrap + #wrap .row - %div#header.navbar + #header.navbar = render partial: "layouts/navbar" .row.no-margin - if RenderPartialService.left_panel_exist? @left_pannel_url diff --git a/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_index.html.haml b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_index.html.haml index 865c47868..20ebb2a58 100644 --- a/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_index.html.haml +++ b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_index.html.haml @@ -1,12 +1,12 @@ -%div#first-block +#first-block .en-cours %b = dossier_count = current_administrateur.procedures.count = ("Procedures".pluralize(dossier_count)).upcase -%div#action-block +#action-block -%div#menu-block +#menu-block .split-hr-left #procedure-list %a{ :href => "#{url_for :admin_procedures_draft}", id: "draft-procedures" } @@ -30,4 +30,4 @@ .split-hr-left -%div#infos-block +#infos-block diff --git a/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml index e23c96832..14d66d5ef 100644 --- a/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml +++ b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml @@ -1,13 +1,13 @@ -%div#first-block +#first-block .en-cours - unless @procedure.logo.blank? = image_tag @procedure.decorate.logo_img, style: 'width: 30px;' %b = @procedure.libelle -%div#action-block +#action-block -%div#menu-block +#menu-block .split-hr-left #procedure-list %a{ :href => "#{url_for admin_procedure_path(@procedure)}", id: 'onglet-infos' } @@ -48,4 +48,4 @@ .split-hr-left -%div#infos-block +#infos-block diff --git a/app/views/layouts/left_panels/_left_panel_cgucontroller_index.html.haml b/app/views/layouts/left_panels/_left_panel_cgucontroller_index.html.haml index 6fce145f3..8e93c244e 100644 --- a/app/views/layouts/left_panels/_left_panel_cgucontroller_index.html.haml +++ b/app/views/layouts/left_panels/_left_panel_cgucontroller_index.html.haml @@ -1,4 +1,4 @@ -%div#cgu_menu_block +#cgu_menu_block #procedure-list{ style: 'margin-top: 0;' } = link_to cgu_path(:anchor => "editeur") do .procedure-list-element diff --git a/app/views/layouts/left_panels/_left_panel_users_dossierscontroller_index.html.haml b/app/views/layouts/left_panels/_left_panel_users_dossierscontroller_index.html.haml index 70c8fb208..86a67577b 100644 --- a/app/views/layouts/left_panels/_left_panel_users_dossierscontroller_index.html.haml +++ b/app/views/layouts/left_panels/_left_panel_users_dossierscontroller_index.html.haml @@ -1,13 +1,13 @@ -%div#first-block +#first-block .en-cours = dossier_count = current_user.dossiers.count = ("Dossier".pluralize(dossier_count)).upcase %br EN COURS -%div#action-block +#action-block -%div#menu-block +#menu-block .split-hr-left #procedure-list - unless current_user.dossiers.count == 0 @@ -43,4 +43,4 @@ .split-hr-left -%div#infos-block +#infos-block diff --git a/app/views/layouts/left_panels/_left_panel_users_recapitulatifcontroller_show.html.haml b/app/views/layouts/left_panels/_left_panel_users_recapitulatifcontroller_show.html.haml index 6b4a877c2..a32b48b77 100644 --- a/app/views/layouts/left_panels/_left_panel_users_recapitulatifcontroller_show.html.haml +++ b/app/views/layouts/left_panels/_left_panel_users_recapitulatifcontroller_show.html.haml @@ -1,12 +1,12 @@ -%div#first-block +#first-block .en-cours %h2 Récapitulatif .infos %div= t('dynamics.dossiers.numéro') + @facade.dossier.id.to_s -%div#menu-block +#menu-block -%div#infos-block +#infos-block .split-hr-left .dossier-state= @facade.dossier.display_state .split-hr-left diff --git a/app/views/layouts/navbars/_navbar_users_recapitulatifcontroller_show.html.haml b/app/views/layouts/navbars/_navbar_users_recapitulatifcontroller_show.html.haml index f9eb9e83c..71a9d09b1 100644 --- a/app/views/layouts/navbars/_navbar_users_recapitulatifcontroller_show.html.haml +++ b/app/views/layouts/navbars/_navbar_users_recapitulatifcontroller_show.html.haml @@ -4,7 +4,7 @@ .col-lg-3.col-md-3.col-sm-3.col-xs-3.options .row.centered-option .col-lg-12.col-md-12.col-sm-12.col-xs-12 - %div#invitations.dropdown-toggle{ 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false } + #invitations.dropdown-toggle{ 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false } %i.fa.fa-user = t('utils.involved') .badge.progress-bar-info From e9d32541ce29aaaacb7a6ffa241d8ad2cb46689a Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 26 Apr 2017 14:46:55 +0200 Subject: [PATCH 2/5] Detect implicit divs with haml-lint --- .haml-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.haml-lint.yml b/.haml-lint.yml index e1fc25e4d..0927e9027 100644 --- a/.haml-lint.yml +++ b/.haml-lint.yml @@ -36,7 +36,7 @@ linters: style: lisp_case ImplicitDiv: - enabled: false + enabled: true Indentation: enabled: true From 7ddcb9aedc0b4408be56844f4f9f2deff0cf7515 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 26 Apr 2017 14:55:14 +0200 Subject: [PATCH 3/5] Extract id attributes from HAML tag attributes --- app/views/admin/procedures/show.html.haml | 4 ++-- app/views/dossiers/_dossier_show.html.haml | 6 +++--- app/views/dossiers/_infos_carto.html.haml | 6 +++--- .../dossiers/_pieces_justificatives.html.haml | 2 +- app/views/dossiers/commentaires/_form.html.haml | 2 +- ...el_admin_procedurescontroller_index.html.haml | 6 +++--- ...l_admin_procedurescontroller_navbar.html.haml | 16 ++++++++-------- ...anel_users_dossierscontroller_index.html.haml | 10 +++++----- .../layouts/left_panels/_search_area.html.haml | 2 +- app/views/users/_login_banner.html.haml | 2 +- app/views/users/carte/show.html.haml | 6 +++--- .../description/_pieces_justificatives.html.haml | 6 +++--- app/views/users/siret/_pro.html.haml | 2 +- 13 files changed, 35 insertions(+), 35 deletions(-) diff --git a/app/views/admin/procedures/show.html.haml b/app/views/admin/procedures/show.html.haml index 79d3090d9..171eb5ace 100644 --- a/app/views/admin/procedures/show.html.haml +++ b/app/views/admin/procedures/show.html.haml @@ -2,11 +2,11 @@ #procedure_show - unless @facade.procedure.published? - if @facade.procedure.gestionnaires.size == 0 - %a.action_button.btn.btn-success{ style: 'float: right; margin-top: 10px;', disabled: 'disabled', 'data-toggle' => :tooltip, title: 'Vous ne pouvez pas publier une procédure sans qu\'aucun accompagnateur ne soit affecté à celle-ci.', id: 'publish-procedure' } + %a.action_button.btn.btn-success#publish-procedure{ style: 'float: right; margin-top: 10px;', disabled: 'disabled', 'data-toggle' => :tooltip, title: 'Vous ne pouvez pas publier une procédure sans qu\'aucun accompagnateur ne soit affecté à celle-ci.' } %i.fa.fa-eraser Publier - else - %a.btn.btn-success{ "data-target" => "#publish-modal", "data-toggle" => "modal", :type => "button", style: 'float: right; margin-top: 10px;', id: 'publish-procedure' } + %a.btn.btn-success#publish-procedure{ "data-target" => "#publish-modal", "data-toggle" => "modal", :type => "button", style: 'float: right; margin-top: 10px;' } %i.fa.fa-eraser Publier diff --git a/app/views/dossiers/_dossier_show.html.haml b/app/views/dossiers/_dossier_show.html.haml index 2a96ccc76..632a32f20 100644 --- a/app/views/dossiers/_dossier_show.html.haml +++ b/app/views/dossiers/_dossier_show.html.haml @@ -44,9 +44,9 @@ CARTOGRAPHIE = render partial: '/dossiers/edit_carto' .body.display-block-on-print - %input{ id: 'json_latlngs', type: 'hidden', value: "#{@facade.dossier.json_latlngs}", name: 'json_latlngs' } - %input{ id: 'quartier_prioritaires', type: 'hidden', value: "#{@facade.dossier.quartier_prioritaires.to_json}" } - %input{ id: 'cadastres', type: 'hidden', value: "#{@facade.dossier.cadastres.to_json}" } + %input#json_latlngs{ type: 'hidden', value: "#{@facade.dossier.json_latlngs}", name: 'json_latlngs' } + %input#quartier_prioritaires{ type: 'hidden', value: "#{@facade.dossier.quartier_prioritaires.to_json}" } + %input#cadastres{ type: 'hidden', value: "#{@facade.dossier.cadastres.to_json}" } = render partial: '/users/carte/map', locals: { dossier: @facade.dossier } = render partial: 'users/carte/init_carto', locals: { dossier: @facade.dossier } diff --git a/app/views/dossiers/_infos_carto.html.haml b/app/views/dossiers/_infos_carto.html.haml index fc5971888..18cbce8da 100644 --- a/app/views/dossiers/_infos_carto.html.haml +++ b/app/views/dossiers/_infos_carto.html.haml @@ -2,9 +2,9 @@ .col-xs-12 #map.mini{ class: @facade.dossier.procedure.module_api_carto.classes } - %input{ id: 'json_latlngs', type: 'hidden', value: "#{@facade.dossier.json_latlngs}" } - %input{ id: 'quartier_prioritaires', type: 'hidden', value: "#{@facade.dossier.quartier_prioritaires.to_json}" } - %input{ id: 'cadastres', type: 'hidden', value: "#{@facade.dossier.cadastres.to_json}" } + %input#json_latlngs{ type: 'hidden', value: "#{@facade.dossier.json_latlngs}" } + %input#quartier_prioritaires{ type: 'hidden', value: "#{@facade.dossier.quartier_prioritaires.to_json}" } + %input#cadastres{ type: 'hidden', value: "#{@facade.dossier.cadastres.to_json}" } %script{ type: 'text/javascript' } = "var dossier_id =#{@facade.dossier.id}" diff --git a/app/views/dossiers/_pieces_justificatives.html.haml b/app/views/dossiers/_pieces_justificatives.html.haml index 74d837d30..2d4427ac9 100644 --- a/app/views/dossiers/_pieces_justificatives.html.haml +++ b/app/views/dossiers/_pieces_justificatives.html.haml @@ -1,7 +1,7 @@ #pieces-justificatives %table.table - if @facade.procedure.cerfa_flag? - %tr{ id: "piece_justificative_0" } + %tr#piece_justificative_0 %th.col-lg-6 Formulaire %td.col-lg-6.col-md-6.col-sm-6.col-xs-6 diff --git a/app/views/dossiers/commentaires/_form.html.haml b/app/views/dossiers/commentaires/_form.html.haml index d2b56b0f8..e88551110 100644 --- a/app/views/dossiers/commentaires/_form.html.haml +++ b/app/views/dossiers/commentaires/_form.html.haml @@ -1,6 +1,6 @@ = 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.wysihtml5{ id: 'texte_commentaire', name: 'texte_commentaire', style: 'width: 100%; margin-bottom: 2%;', rows: '5', placeholder: "Commentaire" } + %textarea.form-control.wysihtml5#texte_commentaire{ name: 'texte_commentaire', style: 'width: 100%; margin-bottom: 2%;', rows: '5', placeholder: "Commentaire" } .row .col-md-6 diff --git a/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_index.html.haml b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_index.html.haml index 20ebb2a58..385a0f38d 100644 --- a/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_index.html.haml +++ b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_index.html.haml @@ -9,19 +9,19 @@ #menu-block .split-hr-left #procedure-list - %a{ :href => "#{url_for :admin_procedures_draft}", id: "draft-procedures" } + %a#draft-procedures{ :href => "#{url_for :admin_procedures_draft}" } .procedure-list-element{ class: @draft_class } Brouillons .badge.progress-bar-default = current_administrateur.procedures.where(published: false, archived: false).count - %a{ :href => "#{url_for :admin_procedures}", id: "active-procedures" } + %a#active-procedures{ :href => "#{url_for :admin_procedures}" } .procedure-list-element{ class: @active_class } Actives .badge.progress-bar-success = current_administrateur.procedures.where(published: true, archived: false).count - %a{ :href => "#{url_for :admin_procedures_archived}", id: "archived-procedures" } + %a#archived-procedures{ :href => "#{url_for :admin_procedures_archived}" } .procedure-list-element{ class: @archived_class } Archivées .badge.progress-bar-purple diff --git a/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml index 14d66d5ef..3185ce653 100644 --- a/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml +++ b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml @@ -10,38 +10,38 @@ #menu-block .split-hr-left #procedure-list - %a{ :href => "#{url_for admin_procedure_path(@procedure)}", id: 'onglet-infos' } + %a#onglet-infos{ :href => "#{url_for admin_procedure_path(@procedure)}" } .procedure-list-element{ class: ('active' if active == 'Informations') } Informations - %a{ :href => "#{url_for admin_procedure_accompagnateurs_path(@procedure)}", id: 'onglet-accompagnateurs' } + %a#onglet-accompagnateurs{ :href => "#{url_for admin_procedure_accompagnateurs_path(@procedure)}" } .procedure-list-element{ class: ('active' if active == 'Accompagnateurs') } = t('dynamics.admin.procedure.onglets.accompagnateurs') - %a{ :href => "#{url_for edit_admin_procedure_path(@procedure)}", id: 'onglet-description' } + %a#onglet-description{ :href => "#{url_for edit_admin_procedure_path(@procedure)}" } .procedure-list-element{ class: ('active' if active == 'Description') } Description - unless @procedure.locked? - %a{ :href => "#{url_for admin_procedure_types_de_champ_path(@procedure)}", id: 'onglet-champs' } + %a#onglet-champs{ :href => "#{url_for admin_procedure_types_de_champ_path(@procedure)}" } .procedure-list-element{ class: ('active' if active == 'Champs') } Champs - unless @procedure.locked? - %a{ :href => "#{url_for admin_procedure_pieces_justificatives_path(@procedure)}", id: 'onglet-pieces' } + %a#onglet-pieces{ :href => "#{url_for admin_procedure_pieces_justificatives_path(@procedure)}" } .procedure-list-element{ class: ('active' if active == 'Pieces') } Pièces jointes - unless @procedure.locked? - %a{ :href => "#{url_for admin_procedure_types_de_champ_private_path(@procedure)}", id: 'onglet-private-champs' } + %a#onglet-private-champs{ :href => "#{url_for admin_procedure_types_de_champ_private_path(@procedure)}" } .procedure-list-element{ class: ('active' if active == 'Champs privés') } Champs privés - %a{ :href => "#{url_for admin_procedure_mail_templates_path(@procedure)}", id: 'onglet-inemailsfos' } + %a#onglet-inemailsfos{ :href => "#{url_for admin_procedure_mail_templates_path(@procedure)}" } .procedure-list-element{ class: ('active' if active == 'E-mails') } E-mails - %a{ :href => "#{url_for admin_procedure_previsualisation_path(@procedure)}", id: 'onglet-preview' } + %a#onglet-preview{ :href => "#{url_for admin_procedure_previsualisation_path(@procedure)}" } .procedure-list-element{ class: ('active' if active == 'Prévisualisation') } Prévisualisation diff --git a/app/views/layouts/left_panels/_left_panel_users_dossierscontroller_index.html.haml b/app/views/layouts/left_panels/_left_panel_users_dossierscontroller_index.html.haml index 86a67577b..9a6fff7a1 100644 --- a/app/views/layouts/left_panels/_left_panel_users_dossierscontroller_index.html.haml +++ b/app/views/layouts/left_panels/_left_panel_users_dossierscontroller_index.html.haml @@ -12,31 +12,31 @@ #procedure-list - unless current_user.dossiers.count == 0 %a{ :href => "#{url_for users_dossiers_path(liste: 'brouillon')}", 'data-toggle' => :tooltip, title: 'Les dossiers jamais proposés à la relecture.' } - .procedure-list-element{ class: ('active' if @liste == 'brouillon'), id: 'brouillon' } + .procedure-list-element#brouillon{ class: ('active' if @liste == 'brouillon') } Brouillons .badge.progress-bar-default = @user_dossiers.brouillon.count %a{ :href => "#{url_for users_dossiers_path(liste: 'a_traiter')}", 'data-toggle' => :tooltip, title: 'Les dossiers qui requièrent une action de votre part.' } - .procedure-list-element{ class: ('active' if @liste == 'a_traiter'), id: 'a_traiter' } + .procedure-list-element#a_traiter{ class: ('active' if @liste == 'a_traiter') } En construction .badge.progress-bar-danger = @user_dossiers.en_construction.count %a{ :href => "#{url_for users_dossiers_path(liste: 'en_instruction')}", 'data-toggle' => :tooltip, title: 'Les dossiers en cours d\'examen par l\'administration compétante.' } - .procedure-list-element{ class: ('active' if @liste == 'en_instruction'), id: 'en_instruction' } + .procedure-list-element#en_instruction{ class: ('active' if @liste == 'en_instruction') } En instruction .badge.progress-bar-default = @user_dossiers.en_instruction.count %a{ :href => "#{url_for users_dossiers_path(liste: 'termine')}", 'data-toggle' => :tooltip, title: 'Les dossiers cloturés qui peuvent être "Accepté", "Refusé" ou "Sans suite".' } - .procedure-list-element{ class: ('active' if @liste == 'termine'), id: 'termine' } + .procedure-list-element#termine{ class: ('active' if @liste == 'termine') } Terminé .badge.progress-bar-success = @user_dossiers.termine.count %a{ :href => "#{url_for users_dossiers_path(liste: 'invite')}" } - .procedure-list-element{ class: ('active' if @liste == 'invite'), id: 'invite' } + .procedure-list-element#invite{ class: ('active' if @liste == 'invite') } Invitation .badge.progress-bar-warning = current_user.invites.count diff --git a/app/views/layouts/left_panels/_search_area.html.haml b/app/views/layouts/left_panels/_search_area.html.haml index 6532566e1..c957bb425 100644 --- a/app/views/layouts/left_panels/_search_area.html.haml +++ b/app/views/layouts/left_panels/_search_area.html.haml @@ -3,5 +3,5 @@ .input-group = text_field_tag('q', "#{@search_terms unless @search_terms.nil?}", id: 'q', placeholder: "Recherchez parmi tous vos dossiers", class: 'form-control') %span.input-group-btn - %button.btn.btn-default{ id: 'search-button' } + %button.btn.btn-default#search-button %i.fa.fa-search diff --git a/app/views/users/_login_banner.html.haml b/app/views/users/_login_banner.html.haml index c002f3c99..640533925 100644 --- a/app/views/users/_login_banner.html.haml +++ b/app/views/users/_login_banner.html.haml @@ -1,5 +1,5 @@ - if current_user.loged_in_with_france_connect? - %div{ id: "fconnect-profile", "data-fc-logout-url" => '/users/sign_out" data-method="delete' } + #fconnect-profile{ "data-fc-logout-url" => '/users/sign_out" data-method="delete' } %a.text-info{ href: "#" } = "#{current_user.given_name} #{current_user.family_name}" = link_to "", "/users/sign_out", method: :delete, class: "btn fa fa-power-off off-fc-link" diff --git a/app/views/users/carte/show.html.haml b/app/views/users/carte/show.html.haml index db8d0115e..609611335 100644 --- a/app/views/users/carte/show.html.haml +++ b/app/views/users/carte/show.html.haml @@ -20,9 +20,9 @@ = form_tag(url_for({ controller: :carte, action: :save, dossier_id: @dossier.id }), class: 'form-inline', method: 'POST') do %br - %input{ type: 'hidden', value: "#{@dossier.json_latlngs}", name: 'json_latlngs', id: 'json_latlngs' } - %input{ id: 'quartier_prioritaires', type: 'hidden', value: "#{@dossier.quartier_prioritaires.to_json}" } - %input{ id: 'cadastres', type: 'hidden', value: "#{@dossier.cadastres.to_json}" } + %input#json_latlngs{ type: 'hidden', value: "#{@dossier.json_latlngs}", name: 'json_latlngs' } + %input#quartier_prioritaires{ type: 'hidden', value: "#{@dossier.quartier_prioritaires.to_json}" } + %input#cadastres{ type: 'hidden', value: "#{@dossier.cadastres.to_json}" } - if @dossier.draft? = render partial: '/layouts/etape_suivante' diff --git a/app/views/users/description/_pieces_justificatives.html.haml b/app/views/users/description/_pieces_justificatives.html.haml index bb6604478..d480fdbf8 100644 --- a/app/views/users/description/_pieces_justificatives.html.haml +++ b/app/views/users/description/_pieces_justificatives.html.haml @@ -8,15 +8,15 @@ %em 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 - -# %a{ id: 'lien_cerfa', href: "#{dossier.procedure.lien_demarche}", target: '_blank' } Télécharger + -# %a#lien_cerfa{ href: "#{dossier.procedure.lien_demarche}", target: '_blank' } Télécharger %td - 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 } + %input#cerfa_pdf{ type: 'file', name: '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 } + %input#cerfa_pdf{ type: 'file', name: 'cerfa_pdf', accept: PieceJustificative.accept_format, :max_file_size => 6.megabytes } - dossier.types_de_piece_justificative.order('order_place ASC').each do |tpj| %tr diff --git a/app/views/users/siret/_pro.html.haml b/app/views/users/siret/_pro.html.haml index b5686009e..523992984 100644 --- a/app/views/users/siret/_pro.html.haml +++ b/app/views/users/siret/_pro.html.haml @@ -1,4 +1,4 @@ -%p.lead{ id: 'pro_section' } +%p.lead#pro_section .flag = image_tag(image_url(LOGO_NAME)) %br From f310f672b687dbce716c76a35a2b24bb0710076e Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 26 Apr 2017 14:58:48 +0200 Subject: [PATCH 4/5] Extract class attributes from HAML tag attributes --- app/views/admin/procedures/_list.html.haml | 2 +- app/views/layouts/_new_header.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/procedures/_list.html.haml b/app/views/admin/procedures/_list.html.haml index 5cf85a729..b437aa603 100644 --- a/app/views/admin/procedures/_list.html.haml +++ b/app/views/admin/procedures/_list.html.haml @@ -15,7 +15,7 @@ %td.col-xs-6 = procedure.libelle - if @active_class - %td= link_to procedure.lien, procedure.lien, class: 'procedure-lien', 'data-method' => :get + %td.procedure-lien= link_to procedure.lien, procedure.lien, 'data-method' => :get %td = procedure.created_at_fr %td diff --git a/app/views/layouts/_new_header.haml b/app/views/layouts/_new_header.haml index 1f9049ce7..73f1946c6 100644 --- a/app/views/layouts/_new_header.haml +++ b/app/views/layouts/_new_header.haml @@ -1,6 +1,6 @@ .new-header .header-inner-content - %img{ src: image_url("header/logo-tps.svg"), class: "header-logo pull-left" } + %img.header-logo.pull-left{ src: image_url("header/logo-tps.svg") } = link_to "Connexion", new_user_session_path, :class => "header-login-button pull-right" From eff9e556e9ca8f9d707efdc63370f9242937b133 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Tue, 2 May 2017 15:58:21 +0200 Subject: [PATCH 5/5] [Fix #162] Deny dossier access for an unauthorized accompagnateur --- app/controllers/backoffice/dossiers_controller.rb | 10 ++++++++++ spec/features/backoffice/add_commentaire_spec.rb | 4 +++- .../features/backoffice/flux_de_commentaires_spec.rb | 8 +++++--- spec/features/backoffice/navigate_to_dossier_spec.rb | 12 ++++++++++++ 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/app/controllers/backoffice/dossiers_controller.rb b/app/controllers/backoffice/dossiers_controller.rb index 4a27784ad..1c421a6de 100644 --- a/app/controllers/backoffice/dossiers_controller.rb +++ b/app/controllers/backoffice/dossiers_controller.rb @@ -1,6 +1,8 @@ class Backoffice::DossiersController < Backoffice::DossiersListController respond_to :html, :xlsx, :ods, :csv + before_action :ensure_gestionnaire_is_authorized, only: :show + def index procedure = current_gestionnaire.procedure_filter @@ -185,6 +187,14 @@ class Backoffice::DossiersController < Backoffice::DossiersListController private + def ensure_gestionnaire_is_authorized + current_gestionnaire.dossiers.find(params[:id]) + + rescue ActiveRecord::RecordNotFound + flash.alert = t('errors.messages.dossier_not_found') + redirect_to url_for(controller: '/backoffice') + end + def create_dossier_facade dossier_id @facade = DossierFacades.new dossier_id, current_gestionnaire.email diff --git a/spec/features/backoffice/add_commentaire_spec.rb b/spec/features/backoffice/add_commentaire_spec.rb index 723f2e416..4a02c93c8 100644 --- a/spec/features/backoffice/add_commentaire_spec.rb +++ b/spec/features/backoffice/add_commentaire_spec.rb @@ -1,7 +1,8 @@ require 'spec_helper' feature 'add commentaire on backoffice' do - let(:dossier) { create(:dossier, :with_entreprise) } + let(:procedure) { create(:procedure) } + let(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'updated') } let(:dossier_id) { dossier.id } let!(:commentaire) { create(:commentaire, dossier: dossier, email: 'toto@toto.com') } let(:email_commentaire) { 'test@test.com' } @@ -10,6 +11,7 @@ feature 'add commentaire on backoffice' do let(:body) { 'Commentaire de test' } before do + create :assign_to, gestionnaire: gestionnaire, procedure: procedure login_as gestionnaire, scope: :gestionnaire visit backoffice_dossier_path(dossier) end diff --git a/spec/features/backoffice/flux_de_commentaires_spec.rb b/spec/features/backoffice/flux_de_commentaires_spec.rb index cb01618cd..f2eef84f0 100644 --- a/spec/features/backoffice/flux_de_commentaires_spec.rb +++ b/spec/features/backoffice/flux_de_commentaires_spec.rb @@ -1,12 +1,13 @@ require 'spec_helper' feature 'backoffice: flux de commentaires' do + let(:procedure) { create(:procedure) } let(:gestionnaire) { create(:gestionnaire) } - let(:dossier) { create(:dossier, :with_entreprise) } + let(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'updated') } let(:dossier_id) { dossier.id } - let(:champ1) { dossier.champs.first } - let(:champ2) { create(:champ, dossier: dossier, type_de_champ: create(:type_de_champ_public, libelle: "subtitle")) } + let(:champ1) { create(:champ, dossier: dossier, type_de_champ: create(:type_de_champ_public, libelle: "subtitle1")) } + let(:champ2) { create(:champ, dossier: dossier, type_de_champ: create(:type_de_champ_public, libelle: "subtitle2")) } let!(:commentaire1) { create(:commentaire, dossier: dossier, champ: champ1) } let!(:commentaire2) { create(:commentaire, dossier: dossier) } @@ -14,6 +15,7 @@ feature 'backoffice: flux de commentaires' do let!(:commentaire4) { create(:commentaire, dossier: dossier, champ: champ1) } before do + create :assign_to, gestionnaire: gestionnaire, procedure: procedure login_as gestionnaire, scope: :gestionnaire visit backoffice_dossier_path(dossier) end diff --git a/spec/features/backoffice/navigate_to_dossier_spec.rb b/spec/features/backoffice/navigate_to_dossier_spec.rb index b9c2222fa..8dcd90533 100644 --- a/spec/features/backoffice/navigate_to_dossier_spec.rb +++ b/spec/features/backoffice/navigate_to_dossier_spec.rb @@ -32,6 +32,18 @@ feature 'on backoffice page', js: true do expect(page).to have_css('#backoffice-dossier-show') end end + + context "and goes to the page of a dossier he hasn't access to" do + let!(:unauthorized_dossier) { create(:dossier, :with_entreprise, state: 'updated') } + + before do + visit backoffice_dossier_path(unauthorized_dossier) + end + + scenario "it shows an error message" do + expect(page).to have_content("Le dossier n'existe pas ou vous n'y avez pas accès.") + end + end end context 'when gestionnaire have enterprise and individual dossier in his inbox', js: true do