@@ -25,7 +25,7 class AccountController < ApplicationController | |||||
25 | # Show user's account |
|
25 | # Show user's account | |
26 | def show |
|
26 | def show | |
27 | @user = User.find_active(params[:id]) |
|
27 | @user = User.find_active(params[:id]) | |
28 |
@custom_values = @user.custom_values |
|
28 | @custom_values = @user.custom_values | |
29 |
|
29 | |||
30 | # show only public projects and private projects that the logged in user is also a member of |
|
30 | # show only public projects and private projects that the logged in user is also a member of | |
31 | @memberships = @user.memberships.select do |membership| |
|
31 | @memberships = @user.memberships.select do |membership| |
@@ -66,7 +66,7 class CustomField < ActiveRecord::Base | |||||
66 |
|
66 | |||
67 | # to move in project_custom_field |
|
67 | # to move in project_custom_field | |
68 | def self.for_all |
|
68 | def self.for_all | |
69 | find(:all, :conditions => ["is_for_all=?", true]) |
|
69 | find(:all, :conditions => ["is_for_all=?", true], :order => 'position') | |
70 | end |
|
70 | end | |
71 |
|
71 | |||
72 | def type_name |
|
72 | def type_name |
@@ -198,7 +198,7 class Project < ActiveRecord::Base | |||||
198 | # Returns an array of all custom fields enabled for project issues |
|
198 | # Returns an array of all custom fields enabled for project issues | |
199 | # (explictly associated custom fields and custom fields enabled for all projects) |
|
199 | # (explictly associated custom fields and custom fields enabled for all projects) | |
200 | def all_issue_custom_fields |
|
200 | def all_issue_custom_fields | |
201 | @all_issue_custom_fields ||= (IssueCustomField.for_all + issue_custom_fields).uniq |
|
201 | @all_issue_custom_fields ||= (IssueCustomField.for_all + issue_custom_fields).uniq.sort | |
202 | end |
|
202 | end | |
203 |
|
203 | |||
204 | def project |
|
204 | def project |
@@ -42,7 +42,7 | |||||
42 | </div> |
|
42 | </div> | |
43 |
|
43 | |||
44 | <div style="clear:both;"> </div> |
|
44 | <div style="clear:both;"> </div> | |
45 |
<%= render :partial => 'form_custom_fields' |
|
45 | <%= render :partial => 'form_custom_fields' %> | |
46 |
|
46 | |||
47 | <% if @issue.new_record? %> |
|
47 | <% if @issue.new_record? %> | |
48 | <p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p> |
|
48 | <p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p> |
@@ -1,5 +1,5 | |||||
1 | <div class="splitcontentleft"> |
|
1 | <div class="splitcontentleft"> | |
2 |
<% i = |
|
2 | <% i = 0 %> | |
3 | <% split_on = @issue.custom_field_values.size / 2 %> |
|
3 | <% split_on = @issue.custom_field_values.size / 2 %> | |
4 | <% @issue.custom_field_values.each do |value| %> |
|
4 | <% @issue.custom_field_values.each do |value| %> | |
5 | <p><%= custom_field_tag_with_label :issue, value %></p> |
|
5 | <p><%= custom_field_tag_with_label :issue, value %></p> |
@@ -212,7 +212,7 class IssuesControllerTest < Test::Unit::TestCase | |||||
212 | assert_equal 2, issue.author_id |
|
212 | assert_equal 2, issue.author_id | |
213 | assert_equal 3, issue.tracker_id |
|
213 | assert_equal 3, issue.tracker_id | |
214 | assert_nil issue.estimated_hours |
|
214 | assert_nil issue.estimated_hours | |
215 |
v = issue.custom_values.find |
|
215 | v = issue.custom_values.find(:first, :conditions => {:custom_field_id => 2}) | |
216 | assert_not_nil v |
|
216 | assert_not_nil v | |
217 | assert_equal 'Value for field 2', v.value |
|
217 | assert_equal 'Value for field 2', v.value | |
218 | end |
|
218 | end |
@@ -27,7 +27,10 module Redmine | |||||
27 | return if self.included_modules.include?(Redmine::Acts::Customizable::InstanceMethods) |
|
27 | return if self.included_modules.include?(Redmine::Acts::Customizable::InstanceMethods) | |
28 | cattr_accessor :customizable_options |
|
28 | cattr_accessor :customizable_options | |
29 | self.customizable_options = options |
|
29 | self.customizable_options = options | |
30 |
has_many :custom_values |
|
30 | has_many :custom_values, :as => :customized, | |
|
31 | :include => :custom_field, | |||
|
32 | :order => "#{CustomField.table_name}.position", | |||
|
33 | :dependent => :delete_all | |||
31 | before_validation_on_create { |customized| customized.custom_field_values } |
|
34 | before_validation_on_create { |customized| customized.custom_field_values } | |
32 | # Trigger validation only if custom values were changed |
|
35 | # Trigger validation only if custom values were changed | |
33 | validates_associated :custom_values, :on => :update, :if => Proc.new { |customized| customized.custom_field_values_changed? } |
|
36 | validates_associated :custom_values, :on => :update, :if => Proc.new { |customized| customized.custom_field_values_changed? } |
General Comments 0
You need to be logged in to leave comments.
Login now