header: use active_link_to for setting the active class on links

This commit is contained in:
Pierre de La Morinerie 2018-06-20 16:02:41 +02:00
parent 8c680347dd
commit a569a566fc
3 changed files with 10 additions and 3 deletions

View file

@ -32,6 +32,9 @@ gem 'haml-rails'
# bootstrap saas
gem 'bootstrap-sass', '~> 3.3.5'
# Automatically set a class on active links
gem 'active_link_to'
# Pagination
gem 'kaminari'

View file

@ -44,6 +44,9 @@ GEM
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
active_link_to (1.0.5)
actionpack
addressable
active_model_serializers (0.10.7)
actionpack (>= 4.1, < 6)
activemodel (>= 4.1, < 6)
@ -785,6 +788,7 @@ PLATFORMS
DEPENDENCIES
aasm
active_link_to
active_model_serializers
administrate
apipie-rails
@ -877,4 +881,4 @@ DEPENDENCIES
xray-rails
BUNDLED WITH
1.16.1
1.16.2

View file

@ -13,10 +13,10 @@
%ul.header-tabs
- if current_gestionnaire.visible_procedures.count > 0
%li
= link_to "Procédures", gestionnaire_procedures_path, class: (controller_name != 'avis') ? "tab-link active" : 'tab-link'
= active_link_to "Procédures", gestionnaire_procedures_path, active: :inclusive, class: 'tab-link'
- if current_gestionnaire.avis.count > 0
%li
= link_to gestionnaire_avis_index_path, class: (controller_name == 'avis') ? "tab-link active" : 'tab-link' do
= active_link_to gestionnaire_avis_index_path, active: :inclusive, class: 'tab-link' do
Avis
- avis_counter = current_gestionnaire.avis.without_answer.count
- if avis_counter > 0