dynamic_tab_item now handles url arrays

This commit is contained in:
gregoirenovel 2018-09-07 11:28:32 +02:00
parent 59e809f029
commit ee4d71a3f4

View file

@ -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