Commit 78d47775 authored by maeda's avatar maeda

Move custom field classes to a method (#30994).

Patch by Marius BALTEANU.


git-svn-id: https://svn.redmine.org/redmine/trunk@17937 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 55fff85f
......@@ -243,9 +243,8 @@ module IssuesHelper
half = (values.size / 2.0).ceil
issue_fields_rows do |rows|
values.each_with_index do |value, i|
css = "cf_#{value.custom_field.id}"
m = (i < half ? :left : :right)
rows.send m, custom_field_name_tag(value.custom_field), custom_field_value_tag(value), :class => css
rows.send m, custom_field_name_tag(value.custom_field), custom_field_value_tag(value), :class => value.custom_field.css_classes
end
end
end
......@@ -263,7 +262,7 @@ module IssuesHelper
content_tag('hr') +
content_tag('p', content_tag('strong', custom_field_name_tag(value.custom_field) )) +
content_tag('div', attr_value_tag, class: 'value')
s << content_tag('div', content, class: "cf_#{value.custom_field.id} attribute")
s << content_tag('div', content, class: "#{value.custom_field.css_classes} attribute")
end
s
end
......
......@@ -301,6 +301,10 @@ class CustomField < ActiveRecord::Base
super(attr_name, *args)
end
def css_classes
"cf_#{id}"
end
protected
# Removes multiple values for the custom field after setting the multiple attribute to false
......
......@@ -104,7 +104,7 @@
<% end %>
<% @options_by_custom_field.each do |field, options| %>
<li class="folder cf_<%= field.id %>">
<li class="folder <%= field.css_classes %>">
<a href="#" class="submenu"><%= field.name %></a>
<ul>
<% options.each do |text, value| %>
......
......@@ -22,7 +22,7 @@
<% end %>
<% @options_by_custom_field.each do |field, options| %>
<li class="folder cf_<%= field.id %>">
<li class="folder <%= field.css_classes %>">
<a href="#" class="submenu"><%= field.name %></a>
<ul>
<% options.each do |text, value| %>
......
......@@ -30,7 +30,7 @@
<li><span class="label"><%=l(:field_homepage)%>:</span> <%= link_to_if uri_with_safe_scheme?(@project.homepage), @project.homepage, @project.homepage %></li>
<% end %>
<% render_custom_field_values(@project) do |custom_field, formatted| %>
<li class="cf_<%= custom_field.id %>"><span class="label"><%= custom_field.name %>:</span> <%= formatted %></li>
<li class="<%= custom_field.css_classes %>"><span class="label"><%= custom_field.name %>:</span> <%= formatted %></li>
<% end %>
</ul>
<% end %>
......
......@@ -13,7 +13,7 @@
<% end %>
<% @user.visible_custom_field_values.each do |custom_value| %>
<% if !custom_value.value.blank? %>
<li class="cf_<%= custom_value.custom_field.id %>"><%= custom_value.custom_field.name %>: <%= show_value(custom_value) %></li>
<li class="<%= custom_value.custom_field.css_classes %>"><%= custom_value.custom_field.name %>: <%= show_value(custom_value) %></li>
<% end %>
<% end %>
<li><%=l(:label_registered_on)%>: <%= format_date(@user.created_on) %></li>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment