From: Jean-Philippe Lang Date: Thu, 20 Jun 2019 07:06:47 +0000 (+0000) Subject: Allow tabs to have a custom action (#3058). X-Git-Tag: 4.1.0~797 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d4312d25656283d34202cede73e9e1fff61a7db6;p=redmine.git Allow tabs to have a custom action (#3058). Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@18271 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4ecb558b5..1b259b44b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -407,6 +407,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 1b880c9c7..df7513e42 100644 --- a/app/views/common/_tabs.html.erb +++ b/app/views/common/_tabs.html.erb @@ -1,10 +1,14 @@ +<% default_action = false %> +