commit
3f113fd170
6 changed files with 20 additions and 16 deletions
|
@ -9,7 +9,11 @@ module TabsHelper
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def active_tab_item(label, url, badge: nil, notification: false)
|
def dynamic_tab_item(label, url_or_urls, badge: nil, notification: false)
|
||||||
tab_item(label, url, active: current_page?(url), badge: badge, notification: notification)
|
urls = [url_or_urls].flatten
|
||||||
|
url = urls.first
|
||||||
|
active = urls.any? { |u| current_page?(u) }
|
||||||
|
|
||||||
|
tab_item(label, url, active: active, badge: badge, notification: notification)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
%li= "#{dossier.procedure.libelle}, dossier nº #{dossier.id}"
|
%li= "#{dossier.procedure.libelle}, dossier nº #{dossier.id}"
|
||||||
|
|
||||||
%ul.tabs
|
%ul.tabs
|
||||||
= active_tab_item('Demande', gestionnaire_avis_path(avis))
|
= dynamic_tab_item('Demande', gestionnaire_avis_path(avis))
|
||||||
= active_tab_item('Avis', instruction_gestionnaire_avis_path(avis), notification: avis.answer.blank?)
|
= dynamic_tab_item('Avis', instruction_gestionnaire_avis_path(avis), notification: avis.answer.blank?)
|
||||||
= active_tab_item('Messagerie', messagerie_gestionnaire_avis_path(avis))
|
= dynamic_tab_item('Messagerie', messagerie_gestionnaire_avis_path(avis))
|
||||||
|
|
|
@ -21,23 +21,23 @@
|
||||||
%ul.tabs
|
%ul.tabs
|
||||||
- notifications_summary = current_gestionnaire.notifications_for_dossier(dossier)
|
- notifications_summary = current_gestionnaire.notifications_for_dossier(dossier)
|
||||||
|
|
||||||
= active_tab_item('Demande',
|
= dynamic_tab_item('Demande',
|
||||||
gestionnaire_dossier_path(dossier.procedure, dossier),
|
gestionnaire_dossier_path(dossier.procedure, dossier),
|
||||||
notification: notifications_summary[:demande])
|
notification: notifications_summary[:demande])
|
||||||
|
|
||||||
= active_tab_item('Annotations privées',
|
= dynamic_tab_item('Annotations privées',
|
||||||
annotations_privees_gestionnaire_dossier_path(dossier.procedure, dossier),
|
annotations_privees_gestionnaire_dossier_path(dossier.procedure, dossier),
|
||||||
notification: notifications_summary[:annotations_privees])
|
notification: notifications_summary[:annotations_privees])
|
||||||
|
|
||||||
= active_tab_item('Avis externes',
|
= dynamic_tab_item('Avis externes',
|
||||||
avis_gestionnaire_dossier_path(dossier.procedure, dossier),
|
avis_gestionnaire_dossier_path(dossier.procedure, dossier),
|
||||||
notification: notifications_summary[:avis])
|
notification: notifications_summary[:avis])
|
||||||
|
|
||||||
= active_tab_item('Messagerie',
|
= dynamic_tab_item('Messagerie',
|
||||||
messagerie_gestionnaire_dossier_path(dossier.procedure, dossier),
|
messagerie_gestionnaire_dossier_path(dossier.procedure, dossier),
|
||||||
notification: notifications_summary[:messagerie])
|
notification: notifications_summary[:messagerie])
|
||||||
|
|
||||||
= active_tab_item('Personnes impliquées',
|
= dynamic_tab_item('Personnes impliquées',
|
||||||
personnes_impliquees_gestionnaire_dossier_path(dossier.procedure, dossier))
|
personnes_impliquees_gestionnaire_dossier_path(dossier.procedure, dossier))
|
||||||
|
|
||||||
.container
|
.container
|
||||||
|
|
|
@ -8,6 +8,6 @@
|
||||||
%h2 Dossier nº #{dossier.id}
|
%h2 Dossier nº #{dossier.id}
|
||||||
|
|
||||||
%ul.tabs
|
%ul.tabs
|
||||||
= active_tab_item('Résumé', dossier_path(dossier))
|
= dynamic_tab_item('Résumé', dossier_path(dossier))
|
||||||
= active_tab_item('Demande', demande_dossier_path(dossier))
|
= dynamic_tab_item('Demande', [demande_dossier_path(dossier), modifier_dossier_path(dossier)])
|
||||||
= active_tab_item('Messagerie', messagerie_dossier_path(dossier))
|
= dynamic_tab_item('Messagerie', messagerie_dossier_path(dossier))
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
- elsif dossier.brouillon?
|
- elsif dossier.brouillon?
|
||||||
- form_options = { url: brouillon_dossier_url(dossier), method: :patch, html: { class: 'form', multipart: true } }
|
- form_options = { url: brouillon_dossier_url(dossier), method: :patch, html: { class: 'form', multipart: true } }
|
||||||
- else
|
- else
|
||||||
- form_options = { url: dossier_url(dossier), method: :patch, html: { class: 'form', multipart: true } }
|
- form_options = { url: modifier_dossier_url(dossier), method: :patch, html: { class: 'form', multipart: true } }
|
||||||
|
|
||||||
= form_for dossier, form_options do |f|
|
= form_for dossier, form_options do |f|
|
||||||
|
|
||||||
|
|
|
@ -271,14 +271,14 @@ Rails.application.routes.draw do
|
||||||
#
|
#
|
||||||
|
|
||||||
scope module: 'new_user' do
|
scope module: 'new_user' do
|
||||||
resources :dossiers, only: [:index, :show, :update] do
|
resources :dossiers, only: [:index, :show] do
|
||||||
member do
|
member do
|
||||||
get 'identite'
|
get 'identite'
|
||||||
patch 'update_identite'
|
patch 'update_identite'
|
||||||
get 'brouillon'
|
get 'brouillon'
|
||||||
patch 'brouillon', to: 'dossiers#update_brouillon'
|
patch 'brouillon', to: 'dossiers#update_brouillon'
|
||||||
get 'modifier', to: 'dossiers#modifier'
|
get 'modifier', to: 'dossiers#modifier'
|
||||||
patch ':id', to: 'dossiers#update'
|
patch 'modifier', to: 'dossiers#update'
|
||||||
get 'merci'
|
get 'merci'
|
||||||
get 'demande'
|
get 'demande'
|
||||||
get 'messagerie'
|
get 'messagerie'
|
||||||
|
|
Loading…
Reference in a new issue