summaryrefslogtreecommitdiffstats
path: root/app/views/common/_tabs.rhtml
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/common/_tabs.rhtml')
-rw-r--r--app/views/common/_tabs.rhtml19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/views/common/_tabs.rhtml b/app/views/common/_tabs.rhtml
new file mode 100644
index 000000000..f9ef5dd35
--- /dev/null
+++ b/app/views/common/_tabs.rhtml
@@ -0,0 +1,19 @@
+<% selected_tab = params[:tab] ? params[:tab].to_s : tabs.first[:name] %>
+
+<div class="tabs">
+ <ul>
+ <% tabs.each do |tab| -%>
+ <li><%= link_to l(tab[:label]), { :tab => tab[:name] },
+ :id => "tab-#{tab[:name]}",
+ :class => (tab[:name] != selected_tab ? nil : 'selected'),
+ :onclick => "showTab('#{tab[:name]}'); this.blur(); return false;" %></li>
+ <% end -%>
+ </ul>
+</div>
+
+<% tabs.each do |tab| -%>
+ <%= content_tag('div', render(:partial => tab[:partial], :locals => {:tab => tab} ),
+ :id => "tab-content-#{tab[:name]}",
+ :style => (tab[:name] != selected_tab ? 'display:none' : nil),
+ :class => 'tab-content') %>
+<% end -%>