diff options
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r-- | app/helpers/application_helper.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 25096a11d..363653cd8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -309,9 +309,13 @@ module ApplicationHelper end # Renders tabs and their content - def render_tabs(tabs) + def render_tabs(tabs, selected=params[:tab]) if tabs.any? - render :partial => 'common/tabs', :locals => {:tabs => tabs} + unless tabs.detect {|tab| tab[:name] == selected} + selected = nil + end + selected ||= tabs.first[:name] + render :partial => 'common/tabs', :locals => {:tabs => tabs, :selected_tab => selected} else content_tag 'p', l(:label_no_data), :class => "nodata" end |