Project

General

Profile

Feature #3058 » 01_allow-tabs-to-have-a-custom-action_v2_fixed.patch

Andrey Lobanov (RedSoft), 2017-07-07 13:42

View differences:

app/views/common/_tabs.html.erb (revision )
<% default_action = false %>
<div class="tabs">
<ul>
<% tabs.each do |tab| -%>
<% action = tab[:onclick] ? tab[:onclick] : (tab[:partial] ? "showTab('#{tab[:name]}', this.href)" : nil) %>
<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 ? "#{action}; this.blur(); return false;" : nil %></li>
<% default_action = action if tab[:name] == selected_tab %>
<% end -%>
</ul>
<div class="tabs-buttons" style="display:none;">
......
:style => (tab[:name] != selected_tab ? 'display:none' : nil),
:class => 'tab-content') if tab[:partial] %>
<% end -%>
<%= javascript_tag default_action if default_action %>
(12-12/28)