Feature #2096 » group-field.patch
| app/helpers/custom_fields_helper.rb (working copy) | ||
|---|---|---|
|
(custom_field.default_value.blank? ? "<option value=\"\">--- #{l(:actionview_instancetag_blank_option)} ---</option>" : '') :
|
||
|
'<option></option>'
|
||
|
select_tag(field_name, blank_option + options_for_select(custom_field.possible_values, custom_value.value), :id => field_id)
|
||
|
when 'group_list'
|
||
|
groups = @project.principals
|
||
|
groups.delete_if { |group| group.type != 'Group' }
|
||
|
custom_field.possible_values.clear()
|
||
|
groups.each { |group| custom_field.possible_values << group if group.type == 'Group' }
|
||
|
blank_option = custom_field.is_required? ?
|
||
|
(custom_field.default_value.blank? ? "<option value=\"\">--- #{l(:actionview_instancetag_blank_option)} ---</option>" : '') :
|
||
|
'<option></option>'
|
||
|
select_tag(field_name, blank_option + options_for_select(groups.collect { |x| x.lastname }, custom_value.value), :id => field_id)
|
||
|
else
|
||
|
text_field_tag(field_name, custom_value.value, :id => field_id)
|
||
|
end
|
||
| app/helpers/application_helper.rb (working copy) | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
# Displays a link to the group
|
||
|
def link_to_group(group, options={})
|
||
|
if group.is_a?(Group)
|
||
|
link_to group.lastname, :controller => 'groups', :action => 'show', :id => group
|
||
|
else
|
||
|
h(group.to_s)
|
||
|
end
|
||
|
end
|
||
|
# Displays a link to +issue+ with its subject.
|
||
|
# Examples:
|
||
|
#
|
||
| app/models/issue.rb (working copy) | ||
|---|---|---|
|
# Author and assignee are always notified unless they have been locked
|
||
|
notified << author if author && author.active?
|
||
|
notified << assigned_to if assigned_to && assigned_to.active?
|
||
|
## EEH: TODO: add Group-email addresses here at some point
|
||
|
notified.uniq!
|
||
|
# Remove users that can not view the issue
|
||
|
notified.reject! {|user| !visible?(user)}
|
||
| app/models/custom_field.rb (working copy) | ||
|---|---|---|
|
"int" => { :name => :label_integer, :order => 3 },
|
||
|
"float" => { :name => :label_float, :order => 4 },
|
||
|
"list" => { :name => :label_list, :order => 5 },
|
||
|
"date" => { :name => :label_date, :order => 6 },
|
||
|
"bool" => { :name => :label_boolean, :order => 7 }
|
||
|
"date" => { :name => :label_date, :order => 6 },
|
||
|
"bool" => { :name => :label_boolean, :order => 7 },
|
||
|
"group_list" => { :name => :label_group_list, :order => 8 },
|
||
|
}.freeze
|
||
|
validates_presence_of :name, :field_format
|
||
| ... | ... | |
|
casted = nil
|
||
|
unless value.blank?
|
||
|
case field_format
|
||
|
when 'string', 'text', 'list'
|
||
|
when 'string', 'text', 'list', 'group_list'
|
||
|
casted = value
|
||
|
when 'date'
|
||
|
casted = begin; value.to_date; rescue; nil end
|
||
| ... | ... | |
|
# Returns false, if the custom field can not be used for sorting.
|
||
|
def order_statement
|
||
|
case field_format
|
||
|
when 'string', 'text', 'list', 'date', 'bool'
|
||
|
when 'string', 'text', 'list', 'date', 'bool', 'group_list'
|
||
|
# COALESCE is here to make sure that blank and NULL values are sorted equally
|
||
|
"COALESCE((SELECT cv_sort.value FROM #{CustomValue.table_name} cv_sort" +
|
||
|
" WHERE cv_sort.customized_type='#{self.class.customized_class.name}'" +
|
||
| app/views/custom_fields/_form.rhtml (working copy) | ||
|---|---|---|
|
if (p_searchable) Element.show(p_searchable.parentNode);
|
||
|
Element.show(p_values);
|
||
|
break;
|
||
|
case 'group_list':
|
||
|
p_default.setAttribute('type','combolist');
|
||
|
Element.hide(p_length.parentNode);
|
||
|
Element.hide(p_regexp.parentNode);
|
||
|
if (p_searchable) Element.show(p_searchable.parentNode);
|
||
|
Element.hide(p_values);
|
||
|
break;
|
||
|
case "bool":
|
||
|
p_default.setAttribute('type','checkbox');
|
||
|
Element.hide(p_length.parentNode);
|
||
| config/locales/en.yml (working copy) | ||
|---|---|---|
|
label_and_its_subprojects: "{{value}} and its subprojects"
|
||
|
label_min_max_length: Min - Max length
|
||
|
label_list: List
|
||
|
## EEH: TODO: Translation
|
||
|
label_group_list: Group List
|
||
|
label_date: Date
|
||
|
label_integer: Integer
|
||
|
label_float: Float
|
||