Custom fields refactoring: most of code moved from controllers to models (using new module ActsAsCustomizable).

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1592 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2008-06-27 20:13:56 +00:00
parent a4a8b6381e
commit ce6cf66f6c
24 changed files with 321 additions and 113 deletions
+2 -2
View File
@@ -27,8 +27,8 @@
<p><label for="user_language"><%=l(:field_language)%></label>
<%= select("user", "language", lang_options_for_select) %></p>
<% for @custom_value in @custom_values %>
<p><%= custom_field_tag_with_label @custom_value %></p>
<% @user.custom_field_values.each do |value| %>
<p><%= custom_field_tag_with_label :user, value %></p>
<% end %>
<!--[eoform:user]-->
</div>
+7 -6
View File
@@ -1,11 +1,12 @@
<div class="splitcontentleft">
<% i = 1 %>
<% for @custom_value in values %>
<p><%= custom_field_tag_with_label @custom_value %></p>
<% if i == values.size / 2 %>
<% split_on = @issue.custom_field_values.size / 2 %>
<% @issue.custom_field_values.each do |value| %>
<p><%= custom_field_tag_with_label :issue, value %></p>
<% if i == split_on -%>
</div><div class="splitcontentright">
<% end %>
<% i += 1 %>
<% end %>
<% end -%>
<% i += 1 -%>
<% end -%>
</div>
<div style="clear:both;"> </div>
+3 -3
View File
@@ -43,9 +43,9 @@
<% end %>
</tr>
<tr>
<% n = 0
for custom_value in @custom_values %>
<td valign="top"><b><%= custom_value.custom_field.name %>:</b></td><td valign="top"><%= simple_format(h(show_value(custom_value))) %></td>
<% n = 0 -%>
<% @issue.custom_values.each do |value| -%>
<td valign="top"><b><%=h value.custom_field.name %>:</b></td><td valign="top"><%= simple_format(h(show_value(value))) %></td>
<% n = n + 1
if (n > 1)
n = 0 %>
+6 -6
View File
@@ -17,8 +17,8 @@
<p><%= f.check_box :is_public %></p>
<%= wikitoolbar_for 'project_description' %>
<% for @custom_value in @custom_values %>
<p><%= custom_field_tag_with_label @custom_value %></p>
<% @project.custom_field_values.each do |value| %>
<p><%= custom_field_tag_with_label :project, value %></p>
<% end %>
</div>
@@ -34,15 +34,15 @@
</fieldset>
<% end %>
<% unless @custom_fields.empty? %>
<% unless @issue_custom_fields.empty? %>
<fieldset class="box"><legend><%=l(:label_custom_field_plural)%></legend>
<% for custom_field in @custom_fields %>
<% @issue_custom_fields.each do |custom_field| %>
<label class="floating">
<%= check_box_tag 'project[custom_field_ids][]', custom_field.id, ((@project.custom_fields.include? custom_field) or custom_field.is_for_all?), (custom_field.is_for_all? ? {:disabled => "disabled"} : {}) %>
<%= check_box_tag 'project[issue_custom_field_ids][]', custom_field.id, (@project.all_issue_custom_fields.include? custom_field), (custom_field.is_for_all? ? {:disabled => "disabled"} : {}) %>
<%= custom_field.name %>
</label>
<% end %>
<%= hidden_field_tag 'project[custom_field_ids][]', '' %>
<%= hidden_field_tag 'project[issue_custom_field_ids][]', '' %>
</fieldset>
<% end %>
<!--[eoform:project]-->
+1 -1
View File
@@ -10,7 +10,7 @@
<% if @project.parent %>
<li><%=l(:field_parent)%>: <%= link_to h(@project.parent.name), :controller => 'projects', :action => 'show', :id => @project.parent %></li>
<% end %>
<% for custom_value in @custom_values %>
<% @project.custom_values.each do |custom_value| %>
<% if !custom_value.value.empty? %>
<li><%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %></li>
<% end %>
+3 -3
View File
@@ -8,9 +8,9 @@
<p><%= f.text_field :mail, :required => true %></p>
<p><%= f.select :language, lang_options_for_select %></p>
<% for @custom_value in @custom_values %>
<p><%= custom_field_tag_with_label @custom_value %></p>
<% end if @custom_values%>
<% @user.custom_field_values.each do |value| %>
<p><%= custom_field_tag_with_label :user, value %></p>
<% end %>
<p><%= f.check_box :admin, :disabled => (@user == User.current) %></p>
</div>