@@ -273,7 +273,7 class IssuesController < ApplicationController | |||||
273 | return |
|
273 | return | |
274 | end |
|
274 | end | |
275 | @available_statuses = Workflow.available_statuses(@project) |
|
275 | @available_statuses = Workflow.available_statuses(@project) | |
276 |
@custom_fields = @project.issue_custom_fields |
|
276 | @custom_fields = @project.all_issue_custom_fields | |
277 | end |
|
277 | end | |
278 |
|
278 | |||
279 | def move |
|
279 | def move |
@@ -66,6 +66,26 module CustomFieldsHelper | |||||
66 | def custom_field_tag_with_label(name, custom_value) |
|
66 | def custom_field_tag_with_label(name, custom_value) | |
67 | custom_field_label_tag(name, custom_value) + custom_field_tag(name, custom_value) |
|
67 | custom_field_label_tag(name, custom_value) + custom_field_tag(name, custom_value) | |
68 | end |
|
68 | end | |
|
69 | ||||
|
70 | def custom_field_tag_for_bulk_edit(custom_field) | |||
|
71 | field_name = "custom_field_values[#{custom_field.id}]" | |||
|
72 | field_id = "custom_field_values_#{custom_field.id}" | |||
|
73 | case custom_field.field_format | |||
|
74 | when "date" | |||
|
75 | text_field_tag(field_name, '', :id => field_id, :size => 10) + | |||
|
76 | calendar_for(field_id) | |||
|
77 | when "text" | |||
|
78 | text_area_tag(field_name, '', :id => field_id, :rows => 3, :style => 'width:90%') | |||
|
79 | when "bool" | |||
|
80 | select_tag(field_name, options_for_select([[l(:label_no_change_option), ''], | |||
|
81 | [l(:general_text_yes), '1'], | |||
|
82 | [l(:general_text_no), '0']]), :id => field_id) | |||
|
83 | when "list" | |||
|
84 | select_tag(field_name, options_for_select([[l(:label_no_change_option), '']] + custom_field.possible_values), :id => field_id) | |||
|
85 | else | |||
|
86 | text_field_tag(field_name, '', :id => field_id) | |||
|
87 | end | |||
|
88 | end | |||
69 |
|
89 | |||
70 | # Return a string used to display a custom value |
|
90 | # Return a string used to display a custom value | |
71 | def show_value(custom_value) |
|
91 | def show_value(custom_value) |
@@ -4,54 +4,68 | |||||
4 |
|
4 | |||
5 | <% form_tag() do %> |
|
5 | <% form_tag() do %> | |
6 | <%= @issues.collect {|i| hidden_field_tag('ids[]', i.id)}.join %> |
|
6 | <%= @issues.collect {|i| hidden_field_tag('ids[]', i.id)}.join %> | |
7 | <div class="box"> |
|
7 | <div class="box tabular"> | |
8 | <fieldset> |
|
8 | <fieldset> | |
9 | <legend><%= l(:label_change_properties) %></legend> |
|
9 | <legend><%= l(:label_change_properties) %></legend> | |
|
10 | ||||
|
11 | <div class="splitcontentleft"> | |||
10 | <p> |
|
12 | <p> | |
11 |
<label><%= l(:field_tracker) %> |
|
13 | <label><%= l(:field_tracker) %></label> | |
12 |
<%= select_tag('tracker_id', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(@project.trackers, :id, :name)) %> |
|
14 | <%= select_tag('tracker_id', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(@project.trackers, :id, :name)) %> | |
|
15 | </p> | |||
13 | <% if @available_statuses.any? %> |
|
16 | <% if @available_statuses.any? %> | |
14 | <label><%= l(:field_status) %>: |
|
17 | <p> | |
15 | <%= select_tag('status_id', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(@available_statuses, :id, :name)) %></label> |
|
18 | <label><%= l(:field_status) %></label> | |
|
19 | <%= select_tag('status_id', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(@available_statuses, :id, :name)) %> | |||
|
20 | </p> | |||
16 | <% end %> |
|
21 | <% end %> | |
|
22 | <p> | |||
|
23 | <label><%= l(:field_priority) %></label> | |||
|
24 | <%= select_tag('priority_id', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(IssuePriority.all, :id, :name)) %> | |||
17 | </p> |
|
25 | </p> | |
18 | <p> |
|
26 | <p> | |
19 |
<label><%= l(:field_ |
|
27 | <label><%= l(:field_assigned_to) %></label> | |
20 | <%= select_tag('priority_id', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(IssuePriority.all, :id, :name)) %></label> |
|
28 | <%= select_tag('assigned_to_id', content_tag('option', l(:label_no_change_option), :value => '') + | |
21 | <label><%= l(:field_category) %>: |
|
29 | content_tag('option', l(:label_nobody), :value => 'none') + | |
22 | <%= select_tag('category_id', content_tag('option', l(:label_no_change_option), :value => '') + |
|
30 | options_from_collection_for_select(@project.assignable_users, :id, :name)) %> | |
|
31 | </p> | |||
|
32 | <p> | |||
|
33 | <label><%= l(:field_category) %></label> | |||
|
34 | <%= select_tag('category_id', content_tag('option', l(:label_no_change_option), :value => '') + | |||
23 | content_tag('option', l(:label_none), :value => 'none') + |
|
35 | content_tag('option', l(:label_none), :value => 'none') + | |
24 |
options_from_collection_for_select(@project.issue_categories, :id, :name)) %> |
|
36 | options_from_collection_for_select(@project.issue_categories, :id, :name)) %> | |
25 | </p> |
|
37 | </p> | |
26 | <p> |
|
38 | <p> | |
27 |
<label><%= l(:field_ |
|
39 | <label><%= l(:field_fixed_version) %></label> | |
28 |
<%= select_tag(' |
|
40 | <%= select_tag('fixed_version_id', content_tag('option', l(:label_no_change_option), :value => '') + | |
29 | content_tag('option', l(:label_nobody), :value => 'none') + |
|
|||
30 | options_from_collection_for_select(@project.assignable_users, :id, :name)) %></label> |
|
|||
31 | <label><%= l(:field_fixed_version) %>: |
|
|||
32 | <%= select_tag('fixed_version_id', content_tag('option', l(:label_no_change_option), :value => '') + |
|
|||
33 | content_tag('option', l(:label_none), :value => 'none') + |
|
41 | content_tag('option', l(:label_none), :value => 'none') + | |
34 |
version_options_for_select(@project.shared_versions.open)) %> |
|
42 | version_options_for_select(@project.shared_versions.open)) %> | |
35 | </p> |
|
43 | </p> | |
36 |
|
44 | |||
37 | <p> |
|
45 | <% @custom_fields.each do |custom_field| %> | |
38 | <label><%= l(:field_start_date) %>: |
|
46 | <p><label><%= h(custom_field.name) %></label> <%= custom_field_tag_for_bulk_edit(custom_field) %></p> | |
39 | <%= text_field_tag 'start_date', '', :size => 10 %><%= calendar_for('start_date') %></label> |
|
|||
40 | <label><%= l(:field_due_date) %>: |
|
|||
41 | <%= text_field_tag 'due_date', '', :size => 10 %><%= calendar_for('due_date') %></label> |
|
|||
42 | <% if Issue.use_field_for_done_ratio? %> |
|
|||
43 | <label><%= l(:field_done_ratio) %>: |
|
|||
44 | <%= select_tag 'done_ratio', options_for_select([[l(:label_no_change_option), '']] + (0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %></label> |
|
|||
45 | <% end %> |
|
47 | <% end %> | |
46 | </p> |
|
|||
47 |
|
48 | |||
48 | <% @custom_fields.each do |custom_field| %> |
|
49 | <%= call_hook(:view_issues_bulk_edit_details_bottom, { :issues => @issues }) %> | |
49 | <p><label><%= h(custom_field.name) %></label> |
|
50 | </div> | |
50 | <%= select_tag "custom_field_values[#{custom_field.id}]", options_for_select([[l(:label_no_change_option), '']] + custom_field.possible_values) %></label> |
|
51 | ||
|
52 | <div class="splitcontentright"> | |||
|
53 | <p> | |||
|
54 | <label><%= l(:field_start_date) %></label> | |||
|
55 | <%= text_field_tag 'start_date', '', :size => 10 %><%= calendar_for('start_date') %> | |||
|
56 | </p> | |||
|
57 | <p> | |||
|
58 | <label><%= l(:field_due_date) %></label> | |||
|
59 | <%= text_field_tag 'due_date', '', :size => 10 %><%= calendar_for('due_date') %> | |||
|
60 | </p> | |||
|
61 | <% if Issue.use_field_for_done_ratio? %> | |||
|
62 | <p> | |||
|
63 | <label><%= l(:field_done_ratio) %></label> | |||
|
64 | <%= select_tag 'done_ratio', options_for_select([[l(:label_no_change_option), '']] + (0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %> | |||
51 | </p> |
|
65 | </p> | |
52 | <% end %> |
|
66 | <% end %> | |
|
67 | </div> | |||
53 |
|
68 | |||
54 | <%= call_hook(:view_issues_bulk_edit_details_bottom, { :issues => @issues }) %> |
|
|||
55 | </fieldset> |
|
69 | </fieldset> | |
56 |
|
70 | |||
57 | <fieldset><legend><%= l(:field_notes) %></legend> |
|
71 | <fieldset><legend><%= l(:field_notes) %></legend> | |
@@ -60,5 +74,5 | |||||
60 | </fieldset> |
|
74 | </fieldset> | |
61 | </div> |
|
75 | </div> | |
62 |
|
76 | |||
63 | <p><%= submit_tag l(:button_submit) %> |
|
77 | <p><%= submit_tag l(:button_submit) %></p> | |
64 | <% end %> |
|
78 | <% end %> |
@@ -115,3 +115,17 custom_fields_008: | |||||
115 | field_format: date |
|
115 | field_format: date | |
116 | default_value: "" |
|
116 | default_value: "" | |
117 | editable: true |
|
117 | editable: true | |
|
118 | custom_fields_009: | |||
|
119 | name: Project 1 cf | |||
|
120 | min_length: 0 | |||
|
121 | regexp: "" | |||
|
122 | is_for_all: false | |||
|
123 | is_filter: true | |||
|
124 | type: IssueCustomField | |||
|
125 | max_length: 0 | |||
|
126 | possible_values: "" | |||
|
127 | id: 9 | |||
|
128 | is_required: false | |||
|
129 | field_format: date | |||
|
130 | default_value: "" | |||
|
131 | editable: true |
@@ -946,6 +946,16 class IssuesControllerTest < ActionController::TestCase | |||||
946 | get :bulk_edit, :ids => [1, 2] |
|
946 | get :bulk_edit, :ids => [1, 2] | |
947 | assert_response :success |
|
947 | assert_response :success | |
948 | assert_template 'bulk_edit' |
|
948 | assert_template 'bulk_edit' | |
|
949 | ||||
|
950 | # Project specific custom field, date type | |||
|
951 | field = CustomField.find(9) | |||
|
952 | assert !field.is_for_all? | |||
|
953 | assert_equal 'date', field.field_format | |||
|
954 | assert_tag :input, :attributes => {:name => 'custom_field_values[9]'} | |||
|
955 | ||||
|
956 | # System wide custom field | |||
|
957 | assert CustomField.find(1).is_for_all? | |||
|
958 | assert_tag :select, :attributes => {:name => 'custom_field_values[1]'} | |||
949 | end |
|
959 | end | |
950 |
|
960 | |||
951 | def test_bulk_edit |
|
961 | def test_bulk_edit |
General Comments 0
You need to be logged in to leave comments.
Login now