summaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-02-07 07:57:59 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-02-07 07:57:59 +0000
commit7b127ee489a134436ab457467c2da42e32aa652d (patch)
tree3b0437c386393ba8690998debd616a76a7f4b312 /app/helpers
parent09b95905dc2df3476ac46d2266bb6c9fd4bc2c93 (diff)
downloadredmine-7b127ee489a134436ab457467c2da42e32aa652d.tar.gz
redmine-7b127ee489a134436ab457467c2da42e32aa652d.zip
Show tabs for existing custom field types only and adds a view for choosing the type when adding a new custom field.
git-svn-id: http://svn.redmine.org/redmine/trunk@12849 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb8
-rw-r--r--app/helpers/custom_fields_helper.rb9
2 files changed, 13 insertions, 4 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
diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb
index 5447130a5..173e0d5f8 100644
--- a/app/helpers/custom_fields_helper.rb
+++ b/app/helpers/custom_fields_helper.rb
@@ -40,8 +40,13 @@ module CustomFieldsHelper
:label => DocumentCategory::OptionName}
]
- def custom_fields_tabs
- CUSTOM_FIELDS_TABS
+ def render_custom_fields_tabs(types)
+ tabs = CUSTOM_FIELDS_TABS.select {|h| types.include?(h[:name]) }
+ render_tabs tabs
+ end
+
+ def custom_field_type_options
+ CUSTOM_FIELDS_TABS.map {|h| [l(h[:label]), h[:name]]}
end
def render_custom_field_format_partial(form, custom_field)