summaryrefslogtreecommitdiffstats
path: root/app/views/common
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-09-12 09:13:13 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-09-12 09:13:13 +0000
commitede9960444ed7c93e1561f004ee8682a0458f295 (patch)
tree95d8f61844d3f2c62e86d40add17b5b5f4120781 /app/views/common
parentd4ed5ec30b470ecb48b1bd9b36a66d837d33461b (diff)
downloadredmine-ede9960444ed7c93e1561f004ee8682a0458f295.tar.gz
redmine-ede9960444ed7c93e1561f004ee8682a0458f295.zip
Refactoring of tabs rendering.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2871 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views/common')
-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 -%>