diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2019-06-20 07:06:47 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2019-06-20 07:06:47 +0000 |
commit | d4312d25656283d34202cede73e9e1fff61a7db6 (patch) | |
tree | bf215761f9b40cbf1ab446992f3068b47c407f8c /app/views/common | |
parent | db3ee07a5530b69624d5a8d517c9301cc835edda (diff) | |
download | redmine-d4312d25656283d34202cede73e9e1fff61a7db6.tar.gz redmine-d4312d25656283d34202cede73e9e1fff61a7db6.zip |
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
Diffstat (limited to 'app/views/common')
-rw-r--r-- | app/views/common/_tabs.html.erb | 8 |
1 files changed, 7 insertions, 1 deletions
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 %> + <div class="tabs"> <ul> <% tabs.each do |tab| -%> + <% action = get_tab_action(tab) %> <li><%= link_to l(tab[:label]), (tab[:url] || { :tab => tab[:name] }), :id => "tab-#{tab[:name]}", :class => (tab[:name] != selected_tab ? nil : 'selected'), - :onclick => tab[:partial] ? "showTab('#{tab[:name]}', this.href); this.blur(); return false;" : nil %></li> + :onclick => (action.nil? ? nil : "#{ action }; return false;") %></li> + <% default_action = action if tab[:name] == selected_tab %> <% end -%> </ul> <div class="tabs-buttons" style="display:none;"> @@ -19,3 +23,5 @@ :style => (tab[:name] != selected_tab ? 'display:none' : nil), :class => 'tab-content') if tab[:partial] %> <% end -%> + +<%= javascript_tag default_action if default_action %> |