diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb
index 8792c8c6e..61c8d6b36 100644
--- a/app/helpers/custom_fields_helper.rb
+++ b/app/helpers/custom_fields_helper.rb
@@ -17,6 +17,13 @@
module CustomFieldsHelper
+ def custom_fields_tabs
+ tabs = [{:name => 'IssueCustomField', :label => :label_issue_plural},
+ {:name => 'ProjectCustomField', :label => :label_project_plural},
+ {:name => 'UserCustomField', :label => :label_user_plural}
+ ]
+ end
+
# Return custom field html tag corresponding to its format
def custom_field_tag(custom_value)
custom_field = custom_value.custom_field
diff --git a/app/views/custom_fields/list.rhtml b/app/views/custom_fields/list.rhtml
index 4fd381a17..43ddd99c8 100644
--- a/app/views/custom_fields/list.rhtml
+++ b/app/views/custom_fields/list.rhtml
@@ -1,21 +1,26 @@
+<% custom_fields_tabs.each do |tab| %>
+
| <%=l(:field_name)%> |
<%=l(:field_field_format)%> |
<%=l(:field_is_required)%> |
- <% if type == 'IssueCustomField' %>
+ <% if tab[:name] == 'IssueCustomField' %>
<%=l(:field_is_for_all)%> |
<%=l(:label_used_by)%> |
<% end %>
@@ -23,12 +28,12 @@
|
-<% for custom_field in (@custom_fields_by_type[type] || []).sort %>
+<% (@custom_fields_by_type[tab[:name]] || []).sort.each do |custom_field| -%>
">
| <%= link_to custom_field.name, :action => 'edit', :id => custom_field %> |
<%= l(CustomField::FIELD_FORMATS[custom_field.field_format][:name]) %> |
<%= image_tag 'true.png' if custom_field.is_required? %> |
- <% if type == 'IssueCustomField' %>
+ <% if tab[:name] == 'IssueCustomField' %>
<%= image_tag 'true.png' if custom_field.is_for_all? %> |
<%= custom_field.projects.count.to_s + ' ' + lwr(:label_project, custom_field.projects.count) if custom_field.is_a? IssueCustomField and !custom_field.is_for_all? %> |
<% end %>
@@ -45,11 +50,9 @@
<% end; reset_cycle %>
-
-<%= link_to l(:label_custom_field_new), {:action => 'new', :type => type}, :class => 'icon icon-add' %>
+
+
<%= link_to l(:label_custom_field_new), {:action => 'new', :type => tab[:name]}, :class => 'icon icon-add' %>
<% end %>
-<%= javascript_tag "showTab('#{@tab}');" %>
-
<% html_title(l(:label_custom_field_plural)) -%>
diff --git a/app/views/projects/settings.rhtml b/app/views/projects/settings.rhtml
index 5516623a3..c7b0f5006 100644
--- a/app/views/projects/settings.rhtml
+++ b/app/views/projects/settings.rhtml
@@ -1,18 +1,24 @@
<%=l(:label_settings)%>
+<% tabs = project_settings_tabs %>
+<% selected_tab = params[:tab] ? params[:tab].to_s : tabs.first[:name] %>
+
-<% project_settings_tabs.each do |tab| %>
- - <%= link_to l(tab[:label]), {}, :id => "tab-#{tab[:name]}", :onclick => "showTab('#{tab[:name]}'); this.blur(); return false;" %>
-<% end %>
+<% tabs.each do |tab| -%>
+ - <%= 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;" %>
+<% end -%>
-<% project_settings_tabs.each do |tab| %>
-<%= content_tag('div', render(:partial => tab[:partial]), :id => "tab-content-#{tab[:name]}", :class => 'tab-content') %>
-<% end %>
-
-<%= tab = params[:tab] ? h(params[:tab]) : project_settings_tabs.first[:name]
-javascript_tag "showTab('#{tab}');" %>
+<% tabs.each do |tab| -%>
+<%= content_tag('div', render(:partial => tab[:partial]),
+ :id => "tab-content-#{tab[:name]}",
+ :style => (tab[:name] != selected_tab ? 'display:none' : nil),
+ :class => 'tab-content') %>
+<% end -%>
<% html_title(l(:label_settings)) -%>
diff --git a/app/views/settings/edit.rhtml b/app/views/settings/edit.rhtml
index c7b47b6d0..c99a13960 100644
--- a/app/views/settings/edit.rhtml
+++ b/app/views/settings/edit.rhtml
@@ -1,18 +1,23 @@
<%= l(:label_settings) %>
+<% selected_tab = params[:tab] ? params[:tab].to_s : administration_settings_tabs.first[:name] %>
+
-
- <% administration_settings_tabs.each do |tab| -%>
- - <%= link_to l(tab[:label]), {}, :id => "tab-#{tab[:name]}", :onclick => "showTab('#{tab[:name]}'); this.blur(); return false;" %>
- <% end -%>
-
+
+<% administration_settings_tabs.each do |tab| -%>
+ - <%= 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;" %>
+<% end -%>
+
-<% administration_settings_tabs.each do |tab| %>
- <%= content_tag('div', render(:partial => tab[:partial]), :id => "tab-content-#{tab[:name]}", :class => 'tab-content') %>
-<% end %>
-
-<%= tab = params[:tab] ? h(params[:tab]) : administration_settings_tabs.first[:name]
-javascript_tag "showTab('#{tab}');" %>
+<% administration_settings_tabs.each do |tab| -%>
+<%= content_tag('div', render(:partial => tab[:partial]),
+ :id => "tab-content-#{tab[:name]}",
+ :style => (tab[:name] != selected_tab ? 'display:none' : nil),
+ :class => 'tab-content') %>
+<% end -%>
<% html_title(l(:label_settings), l(:label_administration)) -%>