Patch #5119 » 001.1.group-list_custom_field.patch
| app/helpers/application_helper.rb | ||
|---|---|---|
| 56 | 56 |
end |
| 57 | 57 |
end |
| 58 | 58 | |
| 59 |
# Displays a link to the group |
|
| 60 |
def link_to_group(group, options={})
|
|
| 61 |
if group.is_a?(Group) |
|
| 62 |
link_to group.lastname, :controller => 'groups', :action => 'show', :id => group |
|
| 63 |
else |
|
| 64 |
h(group.to_s) |
|
| 65 |
end |
|
| 66 |
end |
|
| 67 | ||
| 59 | 68 |
# Displays a link to +issue+ with its subject. |
| 60 | 69 |
# Examples: |
| 61 | 70 |
# |
| app/helpers/custom_fields_helper.rb | ||
|---|---|---|
| 49 | 49 |
(custom_field.default_value.blank? ? "<option value=\"\">--- #{l(:actionview_instancetag_blank_option)} ---</option>" : '') :
|
| 50 | 50 |
'<option></option>' |
| 51 | 51 |
select_tag(field_name, blank_option + options_for_select(custom_field.possible_values, custom_value.value), :id => field_id) |
| 52 | ||
| 53 |
when 'group_list' |
|
| 54 |
groups = @project.principals |
|
| 55 |
groups.delete_if { |group| group.type != 'Group' }
|
|
| 56 | ||
| 57 |
custom_field.possible_values.clear() |
|
| 58 |
groups.each { |group| custom_field.possible_values << group if group.type == 'Group' }
|
|
| 59 | ||
| 60 |
blank_option = custom_field.is_required? ? |
|
| 61 |
(custom_field.default_value.blank? ? "<option value=\"\">--- #{l(:actionview_instancetag_blank_option)} ---</option>" : '') :
|
|
| 62 |
'<option></option>' |
|
| 63 | ||
| 64 |
select_tag(field_name, blank_option + options_for_select(groups.collect { |x| x.lastname }, custom_value.value), :id => field_id)
|
|
| 65 | ||
| 52 | 66 |
else |
| 53 | 67 |
text_field_tag(field_name, custom_value.value, :id => field_id) |
| 54 | 68 |
end |
| app/models/custom_field.rb | ||
|---|---|---|
| 25 | 25 |
"int" => { :name => :label_integer, :order => 3 },
|
| 26 | 26 |
"float" => { :name => :label_float, :order => 4 },
|
| 27 | 27 |
"list" => { :name => :label_list, :order => 5 },
|
| 28 |
"date" => { :name => :label_date, :order => 6 },
|
|
| 29 |
"bool" => { :name => :label_boolean, :order => 7 }
|
|
| 28 |
"date" => { :name => :label_date, :order => 6 },
|
|
| 29 |
"bool" => { :name => :label_boolean, :order => 7 },
|
|
| 30 |
"group_list" => { :name => :label_group_list, :order => 8 },
|
|
| 30 | 31 |
}.freeze |
| 31 | 32 | |
| 32 | 33 |
validates_presence_of :name, :field_format |
| ... | ... | |
| 71 | 72 |
casted = nil |
| 72 | 73 |
unless value.blank? |
| 73 | 74 |
case field_format |
| 74 |
when 'string', 'text', 'list' |
|
| 75 |
when 'string', 'text', 'list', 'group_list'
|
|
| 75 | 76 |
casted = value |
| 76 | 77 |
when 'date' |
| 77 | 78 |
casted = begin; value.to_date; rescue; nil end |
| ... | ... | |
| 91 | 92 |
# Returns false, if the custom field can not be used for sorting. |
| 92 | 93 |
def order_statement |
| 93 | 94 |
case field_format |
| 94 |
when 'string', 'text', 'list', 'date', 'bool' |
|
| 95 |
when 'string', 'text', 'list', 'date', 'bool', 'group_list'
|
|
| 95 | 96 |
# COALESCE is here to make sure that blank and NULL values are sorted equally |
| 96 | 97 |
"COALESCE((SELECT cv_sort.value FROM #{CustomValue.table_name} cv_sort" +
|
| 97 | 98 |
" WHERE cv_sort.customized_type='#{self.class.customized_class.name}'" +
|
| app/models/issue.rb | ||
|---|---|---|
| 387 | 387 |
# Author and assignee are always notified unless they have been locked |
| 388 | 388 |
notified << author if author && author.active? |
| 389 | 389 |
notified << assigned_to if assigned_to && assigned_to.active? |
| 390 | ||
| 391 |
## EEH: TODO: add Group-email addresses here at some point |
|
| 392 | ||
| 390 | 393 |
notified.uniq! |
| 391 | 394 |
# Remove users that can not view the issue |
| 392 | 395 |
notified.reject! {|user| !visible?(user)}
|
| app/views/custom_fields/_form.rhtml | ||
|---|---|---|
| 20 | 20 |
if (p_searchable) Element.show(p_searchable.parentNode); |
| 21 | 21 |
Element.show(p_values); |
| 22 | 22 |
break; |
| 23 | ||
| 24 |
case 'group_list': |
|
| 25 |
p_default.setAttribute('type','combolist');
|
|
| 26 |
Element.hide(p_length.parentNode); |
|
| 27 |
Element.hide(p_regexp.parentNode); |
|
| 28 |
if (p_searchable) Element.show(p_searchable.parentNode); |
|
| 29 |
Element.hide(p_values); |
|
| 30 |
break; |
|
| 31 | ||
| 23 | 32 |
case "bool": |
| 24 | 33 |
p_default.setAttribute('type','checkbox');
|
| 25 | 34 |
Element.hide(p_length.parentNode); |
| config/locales/en.yml | ||
|---|---|---|
| 478 | 478 |
label_and_its_subprojects: "{{value}} and its subprojects"
|
| 479 | 479 |
label_min_max_length: Min - Max length |
| 480 | 480 |
label_list: List |
| 481 | ||
| 482 |
## EEH: TODO: Translation |
|
| 483 |
label_group_list: Group List |
|
| 484 | ||
| 481 | 485 |
label_date: Date |
| 482 | 486 |
label_integer: Integer |
| 483 | 487 |
label_float: Float |
- « Previous
- 1
- 2
- Next »