From ee4d71a3f491db2697d41fc04bf3ec5de213ff0c Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Fri, 7 Sep 2018 11:28:32 +0200 Subject: [PATCH] dynamic_tab_item now handles url arrays --- app/helpers/tabs_helper.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/helpers/tabs_helper.rb b/app/helpers/tabs_helper.rb index de31d48c9..6080aa2ad 100644 --- a/app/helpers/tabs_helper.rb +++ b/app/helpers/tabs_helper.rb @@ -9,7 +9,11 @@ module TabsHelper } end - def dynamic_tab_item(label, url, badge: nil, notification: false) - tab_item(label, url, active: current_page?(url), badge: badge, notification: notification) + def dynamic_tab_item(label, url_or_urls, badge: nil, notification: false) + 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