diff --git a/app/controllers/experts/avis_controller.rb b/app/controllers/experts/avis_controller.rb index 2476eeeb4..f96dfd09f 100644 --- a/app/controllers/experts/avis_controller.rb +++ b/app/controllers/experts/avis_controller.rb @@ -142,7 +142,7 @@ module Experts extension = params[:format] render extension.to_sym => avis.dossier.etablissement.entreprise_bilans_bdf_to_sheet(extension) else - redirect_to instructeur_avis_path(avis) + redirect_to expert_avis_path(avis) end end diff --git a/app/views/experts/avis/index.html.haml b/app/views/experts/avis/index.html.haml index b3d2dd845..535c0e49d 100644 --- a/app/views/experts/avis/index.html.haml +++ b/app/views/experts/avis/index.html.haml @@ -13,12 +13,12 @@ .procedure-details %p.fr-mb-2w = procedure_badge(p) - = link_to(p.libelle, procedure_instructeur_avis_index_path(p), class: "fr-link fr-ml-1w") + = link_to(p.libelle, procedure_expert_avis_index_path(p), class: "fr-link fr-ml-1w") %ul.procedure-stats.flex %li %object - = link_to(procedure_instructeur_avis_index_path(p, statut: Instructeurs::AvisController::A_DONNER_STATUS)) do + = link_to(procedure_expert_avis_index_path(p, statut: Instructeurs::AvisController::A_DONNER_STATUS)) do - without_answer_count = procedure_avis.select { |a| a.answer.nil? }.size - if without_answer_count > 0 %span.notifications{ 'aria-label': "notifications" } @@ -28,7 +28,7 @@ avis à donner %li %object - = link_to(procedure_instructeur_avis_index_path(p, statut: Instructeurs::AvisController::DONNES_STATUS)) do + = link_to(procedure_expert_avis_index_path(p, statut: Instructeurs::AvisController::DONNES_STATUS)) do - with_answer_count = procedure_avis.select { |a| a.answer.present? }.size .stats-number= with_answer_count .stats-legend diff --git a/app/views/experts/avis/procedure.html.haml b/app/views/experts/avis/procedure.html.haml index 0e08e2ed4..547d633f9 100644 --- a/app/views/experts/avis/procedure.html.haml +++ b/app/views/experts/avis/procedure.html.haml @@ -36,11 +36,11 @@ - @avis.each do |avis| %tr %td.number-col - = link_to(instructeur_avis_path(avis.procedure, avis), class: 'cell-link') do + = link_to(expert_avis_path(avis.procedure, avis), class: 'cell-link') do %span.icon.folder #{avis.dossier.id} - %td= link_to(avis.dossier.user_email_for(:display), instructeur_avis_path(avis.procedure, avis), class: 'cell-link') - %td= link_to(avis.procedure.libelle, instructeur_avis_path(avis.procedure, avis), class: 'cell-link') + %td= link_to(avis.dossier.user_email_for(:display), expert_avis_path(avis.procedure, avis), class: 'cell-link') + %td= link_to(avis.procedure.libelle, expert_avis_path(avis.procedure, avis), class: 'cell-link') = paginate(@avis) - else %h2.empty-text Aucun avis diff --git a/app/views/instructeurs/avis/shared/_form.html.haml b/app/views/instructeurs/avis/_form.html.haml similarity index 100% rename from app/views/instructeurs/avis/shared/_form.html.haml rename to app/views/instructeurs/avis/_form.html.haml diff --git a/app/views/instructeurs/avis/_header.html.haml b/app/views/instructeurs/avis/_header.html.haml deleted file mode 100644 index 5e5adba89..000000000 --- a/app/views/instructeurs/avis/_header.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -.sub-header - .container - %ul.breadcrumbs - %li= link_to('Avis', instructeur_all_avis_path) - %li - = link_to(procedure.libelle, procedure_instructeur_avis_index_path(avis.procedure), class: "fr-link") - = procedure_badge(dossier.procedure) - %li= link_to("Dossier nº #{dossier.id}", instructeur_avis_path(avis.procedure, avis)) - - %nav.tabs - %ul - = dynamic_tab_item('Demande', instructeur_avis_path(avis.procedure, avis)) - = dynamic_tab_item('Avis', instruction_instructeur_avis_path(avis.procedure, avis), notification: avis.answer.blank?) - = dynamic_tab_item('Messagerie', messagerie_instructeur_avis_path(avis.procedure, avis)) diff --git a/app/views/instructeurs/avis/shared/_list.html.haml b/app/views/instructeurs/avis/_list.html.haml similarity index 100% rename from app/views/instructeurs/avis/shared/_list.html.haml rename to app/views/instructeurs/avis/_list.html.haml diff --git a/app/views/instructeurs/avis/index.html.haml b/app/views/instructeurs/avis/index.html.haml deleted file mode 100644 index 7b8838a3e..000000000 --- a/app/views/instructeurs/avis/index.html.haml +++ /dev/null @@ -1,41 +0,0 @@ -- content_for(:title, "Avis") - -.container - %h1.page-title Avis - - %ul.procedure-list - - @avis_by_procedure.each do |p, procedure_avis| - %li.procedure-item.flex.align-start - = link_to(procedure_instructeur_avis_index_path(p)) do - .flex - - .procedure-logo{ style: "background-image: url(#{p.logo_url})" } - - .procedure-details - %p.procedure-title - = procedure_libelle p - %ul.procedure-stats.flex - %li - %object - = link_to(procedure_instructeur_avis_index_path(p, statut: Instructeurs::AvisController::A_DONNER_STATUS)) do - - without_answer_count = procedure_avis.select { |a| a.answer.nil? }.size - - if without_answer_count > 0 - %span.notifications{ 'aria-label': "notifications" } - .stats-number - = without_answer_count - .stats-legend - avis à donner - %li - %object - = link_to(procedure_instructeur_avis_index_path(p, statut: Instructeurs::AvisController::DONNES_STATUS)) do - - with_answer_count = procedure_avis.select { |a| a.answer.present? }.size - .stats-number= with_answer_count - .stats-legend - = pluralize(with_answer_count, "avis donné") - - - if p.close? - .procedure-status - %span.label Close - - elsif p.depubliee? - .procedure-status - %span.label Dépubliée diff --git a/app/views/instructeurs/avis/messagerie.html.haml b/app/views/instructeurs/avis/messagerie.html.haml deleted file mode 100644 index 46e64e69a..000000000 --- a/app/views/instructeurs/avis/messagerie.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -- content_for(:title, "Messagerie · Dossier nº #{@dossier.id} (#{@dossier.owner_name})") - -= render partial: 'header', locals: { avis: @avis, dossier: @dossier } - -= render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, connected_user: current_instructeur, messagerie_seen_at: nil, new_commentaire: @commentaire, form_url: commentaire_instructeur_avis_path(@avis) } diff --git a/app/views/instructeurs/avis/procedure.html.haml b/app/views/instructeurs/avis/procedure.html.haml deleted file mode 100644 index 7334ecd96..000000000 --- a/app/views/instructeurs/avis/procedure.html.haml +++ /dev/null @@ -1,46 +0,0 @@ -- avis_statut = (@statut == Instructeurs::AvisController::A_DONNER_STATUS) ? 'à donner' : 'rendus' -- content_for(:title, "Avis #{avis_statut}") - -#procedure-show - .sub-header - .container.flex - - .procedure-logo{ style: "background-image: url(#{@procedure.logo_url})", - role: 'img', 'aria-label': "logo de la démarche #{@procedure.libelle}" } - - .procedure-header - %h1= procedure_libelle @procedure - - %nav.tabs - %ul - = tab_item('avis à donner', - procedure_instructeur_avis_index_path(statut: Instructeurs::AvisController::A_DONNER_STATUS), - active: @statut == Instructeurs::AvisController::A_DONNER_STATUS, - badge: @avis_a_donner.count, - notification: @avis_a_donner.any?) - - = tab_item("avis #{'donné'.pluralize(@avis_donnes.count)}", - procedure_instructeur_avis_index_path(statut: Instructeurs::AvisController::DONNES_STATUS), - active: @statut == Instructeurs::AvisController::DONNES_STATUS, - badge: @avis_donnes.count) - -.container - - if @avis.present? - %table.table.dossiers-table.hoverable - %thead - %tr - %th.number-col Nº dossier - %th Demandeur - %th Démarche - %tbody - - @avis.each do |avis| - %tr - %td.number-col - = link_to(instructeur_avis_path(avis.procedure, avis), class: 'cell-link') do - %span.icon.folder - #{avis.dossier.id} - %td= link_to(avis.dossier.user_email_for(:display), instructeur_avis_path(avis.procedure, avis), class: 'cell-link') - %td= link_to(avis.procedure.libelle, instructeur_avis_path(avis.procedure, avis), class: 'cell-link') - = paginate(@avis) - - else - %h2.empty-text Aucun avis diff --git a/app/views/instructeurs/avis/show.html.haml b/app/views/instructeurs/avis/show.html.haml deleted file mode 100644 index b2c53c6a8..000000000 --- a/app/views/instructeurs/avis/show.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -- content_for(:title, "Demande · Dossier nº #{@dossier.id} (#{@dossier.owner_name})") - -= render partial: 'header', locals: { avis: @avis, dossier: @dossier } - -= render partial: 'shared/dossiers/demande', locals: { dossier: @dossier, demande_seen_at: nil, profile: 'instructeur' } diff --git a/app/views/instructeurs/dossiers/avis.html.haml b/app/views/instructeurs/dossiers/avis.html.haml index 7866eb782..b5676c6b0 100644 --- a/app/views/instructeurs/dossiers/avis.html.haml +++ b/app/views/instructeurs/dossiers/avis.html.haml @@ -8,7 +8,7 @@ = render partial: 'instructeurs/avis/sidemenu' .fr-col - if @dossier.avis.present? - = render partial: 'instructeurs/avis/shared/list', locals: { avis: @dossier.avis, avis_seen_at: @avis_seen_at } + = render partial: 'instructeurs/avis/list', locals: { avis: @dossier.avis, avis_seen_at: @avis_seen_at } -else %h2.empty-text Aucun avis. diff --git a/app/views/instructeurs/dossiers/avis_new.html.haml b/app/views/instructeurs/dossiers/avis_new.html.haml index 790793db0..31fa08472 100644 --- a/app/views/instructeurs/dossiers/avis_new.html.haml +++ b/app/views/instructeurs/dossiers/avis_new.html.haml @@ -9,6 +9,6 @@ .fr-col - if !@dossier.termine? - if @dossier.procedure.allow_expert_review - = render partial: "instructeurs/avis/shared/form", locals: { url: avis_instructeur_dossier_path(@dossier.procedure, @dossier), linked_dossiers: @dossier.linked_dossiers_for(current_instructeur), must_be_confidentiel: false, avis: @avis } + = render partial: "instructeurs/avis/form", locals: { url: avis_instructeur_dossier_path(@dossier.procedure, @dossier), linked_dossiers: @dossier.linked_dossiers_for(current_instructeur), must_be_confidentiel: false, avis: @avis } - else %p Cette démarche n’autorise pas la demande d’avis à un expert. Veuillez contacter votre administrateur diff --git a/config/routes.rb b/config/routes.rb index 0dbed9948..687397261 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -392,8 +392,7 @@ Rails.application.routes.draw do end end - resources :avis, only: [:show, :update] do - get '', action: 'procedure', on: :collection, as: :procedure + resources :avis, only: [] do member do patch 'revoquer' get 'remind' diff --git a/spec/views/instructeur/avis/shared/list.html.haml_spec.rb b/spec/views/instructeur/avis/list.html.haml_spec.rb similarity index 89% rename from spec/views/instructeur/avis/shared/list.html.haml_spec.rb rename to spec/views/instructeur/avis/list.html.haml_spec.rb index db37921a2..e6057e033 100644 --- a/spec/views/instructeur/avis/shared/list.html.haml_spec.rb +++ b/spec/views/instructeur/avis/list.html.haml_spec.rb @@ -1,7 +1,7 @@ -describe 'instructeurs/avis/shared/_list.html.haml', type: :view do +describe 'instructeurs/avis/_list.html.haml', type: :view do before { view.extend DossierHelper } - subject { render 'instructeurs/avis/shared/list.html.haml', avis: avis, avis_seen_at: seen_at, current_instructeur: instructeur } + subject { render 'instructeurs/avis/list.html.haml', avis: avis, avis_seen_at: seen_at, current_instructeur: instructeur } let(:instructeur) { create(:instructeur) } let(:instructeur2) { create(:instructeur) }