about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-09-23 20:42:13 +0200
committerEugen Rochko <eugen@zeonfederated.com>2018-09-23 20:42:13 +0200
commitc39183cc628ea9556db53af5059656d6b63609ba (patch)
tree27e79ae58e4f5e1192a9ec638220f44fd71587fa /app
parentd0d65b5a2899546c4134d1fca60aef2c23c4932d (diff)
Refactor active_nav_class for use with multiple paths (#8757)
Diffstat (limited to 'app')
-rw-r--r--app/helpers/application_helper.rb4
-rw-r--r--app/views/accounts/_header.html.haml2
2 files changed, 3 insertions, 3 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 758f864d7..f8e2c0e11 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -7,8 +7,8 @@ module ApplicationHelper
     follow
   ).freeze
 
-  def active_nav_class(path)
-    current_page?(path) ? 'active' : ''
+  def active_nav_class(*paths)
+    paths.any? { |path| current_page?(path) } ? 'active' : ''
   end
 
   def active_link_to(label, path, **options)
diff --git a/app/views/accounts/_header.html.haml b/app/views/accounts/_header.html.haml
index 3da270d27..9ceae007d 100644
--- a/app/views/accounts/_header.html.haml
+++ b/app/views/accounts/_header.html.haml
@@ -16,7 +16,7 @@
             = fa_icon('lock') if account.locked?
       .public-account-header__tabs__tabs
         .details-counters
-          .counter{ class: active_nav_class(short_account_url(account)) + active_nav_class(short_account_with_replies_url(account)) + active_nav_class(short_account_media_url(account)) }
+          .counter{ class: active_nav_class(short_account_url(account), short_account_with_replies_url(account), short_account_media_url(account)) }
             = link_to short_account_url(account), class: 'u-url u-uid', title: number_with_delimiter(account.statuses_count) do
               %span.counter-number= number_to_human account.statuses_count, strip_insignificant_zeros: true
               %span.counter-label= t('accounts.posts', count: account.statuses_count)