You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_tabs.html.erb 1.2KB

123456789101112131415161718192021222324252627
  1. <% default_action = false %>
  2. <div class="tabs">
  3. <ul>
  4. <% tabs.each do |tab| -%>
  5. <% action = get_tab_action(tab) %>
  6. <li><%= link_to l(tab[:label]), (tab[:url] || { :tab => tab[:name] }),
  7. :id => "tab-#{tab[:name]}",
  8. :class => (tab[:name] != selected_tab ? nil : 'selected'),
  9. :onclick => (action.nil? ? nil : "#{ action }; return false;") %></li>
  10. <% default_action = action if tab[:name] == selected_tab %>
  11. <% end -%>
  12. </ul>
  13. <div class="tabs-buttons" style="display:none;">
  14. <button class="tab-left" type="button" onclick="moveTabLeft(this);"></button>
  15. <button class="tab-right" type="button" onclick="moveTabRight(this);"></button>
  16. </div>
  17. </div>
  18. <% tabs.each do |tab| -%>
  19. <%= content_tag('div', (render(:partial => tab[:partial], :locals => {:tab => tab}) if tab[:partial]) ,
  20. :id => "tab-content-#{tab[:name]}",
  21. :style => (tab[:name] != selected_tab ? 'display:none' : nil),
  22. :class => 'tab-content') if tab[:partial] || tab[:remote] %>
  23. <% end -%>
  24. <%= javascript_tag default_action if default_action %>