From e2ec637e64e32fe9c1afc94a191976b709790942 Mon Sep 17 00:00:00 2001 From: Marius BALTEANU Date: Sun, 9 Sep 2018 11:05:02 +0000 Subject: [PATCH 1/7] allow tabs to have a custom action --- app/helpers/application_helper.rb | 11 +++++++++++ app/views/common/_tabs.html.erb | 8 +++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e250c20..732a9b7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -389,6 +389,17 @@ module ApplicationHelper end end + # Returns the tab action depending on the tab properties + def get_tab_action(tab) + if tab[:onclick] + return tab[:onclick] + elsif tab[:partial] + return "showTab('#{tab[:name]}', this.href)" + else + return nil + end + end + # Returns the default scope for the quick search form # Could be 'all', 'my_projects', 'subprojects' or nil (current project) def default_search_project_scope diff --git a/app/views/common/_tabs.html.erb b/app/views/common/_tabs.html.erb index 1b880c9..df7513e 100644 --- a/app/views/common/_tabs.html.erb +++ b/app/views/common/_tabs.html.erb @@ -1,10 +1,14 @@ +<% default_action = false %> +