Selaa lähdekoodia

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

Patch by Marius BALTEANU.


git-svn-id: http://svn.redmine.org/redmine/trunk@17937 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/4.1.0
Go MAEDA 5 vuotta sitten
vanhempi
commit
1fbb2fa33a

+ 2
- 3
app/helpers/issues_helper.rb Näytä tiedosto

@@ -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

+ 4
- 0
app/models/custom_field.rb Näytä tiedosto

@@ -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

+ 1
- 1
app/views/context_menus/issues.html.erb Näytä tiedosto

@@ -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| %>

+ 1
- 1
app/views/context_menus/time_entries.html.erb Näytä tiedosto

@@ -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| %>

+ 1
- 1
app/views/projects/show.html.erb Näytä tiedosto

@@ -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 %>

+ 1
- 1
app/views/users/show.html.erb Näytä tiedosto

@@ -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>

Loading…
Peruuta
Tallenna