##// END OF EJS Templates
Allows user to clear dates and text fields when bulk editing issues (#2199)....
Jean-Philippe Lang -
r11962:e35640f3e82c
parent child
Show More

The requested changes are too big and content was truncated. Show full diff

@@ -1,170 +1,182
1 # encoding: utf-8
1 # encoding: utf-8
2 #
2 #
3 # Redmine - project management software
3 # Redmine - project management software
4 # Copyright (C) 2006-2013 Jean-Philippe Lang
4 # Copyright (C) 2006-2013 Jean-Philippe Lang
5 #
5 #
6 # This program is free software; you can redistribute it and/or
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
9 # of the License, or (at your option) any later version.
10 #
10 #
11 # This program is distributed in the hope that it will be useful,
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
14 # GNU General Public License for more details.
15 #
15 #
16 # You should have received a copy of the GNU General Public License
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
19
20 module CustomFieldsHelper
20 module CustomFieldsHelper
21
21
22 CUSTOM_FIELDS_TABS = [
22 CUSTOM_FIELDS_TABS = [
23 {:name => 'IssueCustomField', :partial => 'custom_fields/index',
23 {:name => 'IssueCustomField', :partial => 'custom_fields/index',
24 :label => :label_issue_plural},
24 :label => :label_issue_plural},
25 {:name => 'TimeEntryCustomField', :partial => 'custom_fields/index',
25 {:name => 'TimeEntryCustomField', :partial => 'custom_fields/index',
26 :label => :label_spent_time},
26 :label => :label_spent_time},
27 {:name => 'ProjectCustomField', :partial => 'custom_fields/index',
27 {:name => 'ProjectCustomField', :partial => 'custom_fields/index',
28 :label => :label_project_plural},
28 :label => :label_project_plural},
29 {:name => 'VersionCustomField', :partial => 'custom_fields/index',
29 {:name => 'VersionCustomField', :partial => 'custom_fields/index',
30 :label => :label_version_plural},
30 :label => :label_version_plural},
31 {:name => 'UserCustomField', :partial => 'custom_fields/index',
31 {:name => 'UserCustomField', :partial => 'custom_fields/index',
32 :label => :label_user_plural},
32 :label => :label_user_plural},
33 {:name => 'GroupCustomField', :partial => 'custom_fields/index',
33 {:name => 'GroupCustomField', :partial => 'custom_fields/index',
34 :label => :label_group_plural},
34 :label => :label_group_plural},
35 {:name => 'TimeEntryActivityCustomField', :partial => 'custom_fields/index',
35 {:name => 'TimeEntryActivityCustomField', :partial => 'custom_fields/index',
36 :label => TimeEntryActivity::OptionName},
36 :label => TimeEntryActivity::OptionName},
37 {:name => 'IssuePriorityCustomField', :partial => 'custom_fields/index',
37 {:name => 'IssuePriorityCustomField', :partial => 'custom_fields/index',
38 :label => IssuePriority::OptionName},
38 :label => IssuePriority::OptionName},
39 {:name => 'DocumentCategoryCustomField', :partial => 'custom_fields/index',
39 {:name => 'DocumentCategoryCustomField', :partial => 'custom_fields/index',
40 :label => DocumentCategory::OptionName}
40 :label => DocumentCategory::OptionName}
41 ]
41 ]
42
42
43 def custom_fields_tabs
43 def custom_fields_tabs
44 CUSTOM_FIELDS_TABS
44 CUSTOM_FIELDS_TABS
45 end
45 end
46
46
47 # Return custom field html tag corresponding to its format
47 # Return custom field html tag corresponding to its format
48 def custom_field_tag(name, custom_value)
48 def custom_field_tag(name, custom_value)
49 custom_field = custom_value.custom_field
49 custom_field = custom_value.custom_field
50 field_name = "#{name}[custom_field_values][#{custom_field.id}]"
50 field_name = "#{name}[custom_field_values][#{custom_field.id}]"
51 field_name << "[]" if custom_field.multiple?
51 field_name << "[]" if custom_field.multiple?
52 field_id = "#{name}_custom_field_values_#{custom_field.id}"
52 field_id = "#{name}_custom_field_values_#{custom_field.id}"
53
53
54 tag_options = {:id => field_id, :class => "#{custom_field.field_format}_cf"}
54 tag_options = {:id => field_id, :class => "#{custom_field.field_format}_cf"}
55
55
56 field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format)
56 field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format)
57 case field_format.try(:edit_as)
57 case field_format.try(:edit_as)
58 when "date"
58 when "date"
59 text_field_tag(field_name, custom_value.value, tag_options.merge(:size => 10)) +
59 text_field_tag(field_name, custom_value.value, tag_options.merge(:size => 10)) +
60 calendar_for(field_id)
60 calendar_for(field_id)
61 when "text"
61 when "text"
62 text_area_tag(field_name, custom_value.value, tag_options.merge(:rows => 3))
62 text_area_tag(field_name, custom_value.value, tag_options.merge(:rows => 3))
63 when "bool"
63 when "bool"
64 hidden_field_tag(field_name, '0') + check_box_tag(field_name, '1', custom_value.true?, tag_options)
64 hidden_field_tag(field_name, '0') + check_box_tag(field_name, '1', custom_value.true?, tag_options)
65 when "list"
65 when "list"
66 blank_option = ''.html_safe
66 blank_option = ''.html_safe
67 unless custom_field.multiple?
67 unless custom_field.multiple?
68 if custom_field.is_required?
68 if custom_field.is_required?
69 unless custom_field.default_value.present?
69 unless custom_field.default_value.present?
70 blank_option = content_tag('option', "--- #{l(:actionview_instancetag_blank_option)} ---", :value => '')
70 blank_option = content_tag('option', "--- #{l(:actionview_instancetag_blank_option)} ---", :value => '')
71 end
71 end
72 else
72 else
73 blank_option = content_tag('option')
73 blank_option = content_tag('option')
74 end
74 end
75 end
75 end
76 s = select_tag(field_name, blank_option + options_for_select(custom_field.possible_values_options(custom_value.customized), custom_value.value),
76 s = select_tag(field_name, blank_option + options_for_select(custom_field.possible_values_options(custom_value.customized), custom_value.value),
77 tag_options.merge(:multiple => custom_field.multiple?))
77 tag_options.merge(:multiple => custom_field.multiple?))
78 if custom_field.multiple?
78 if custom_field.multiple?
79 s << hidden_field_tag(field_name, '')
79 s << hidden_field_tag(field_name, '')
80 end
80 end
81 s
81 s
82 else
82 else
83 text_field_tag(field_name, custom_value.value, tag_options)
83 text_field_tag(field_name, custom_value.value, tag_options)
84 end
84 end
85 end
85 end
86
86
87 # Return custom field label tag
87 # Return custom field label tag
88 def custom_field_label_tag(name, custom_value, options={})
88 def custom_field_label_tag(name, custom_value, options={})
89 required = options[:required] || custom_value.custom_field.is_required?
89 required = options[:required] || custom_value.custom_field.is_required?
90
90
91 content_tag "label", h(custom_value.custom_field.name) +
91 content_tag "label", h(custom_value.custom_field.name) +
92 (required ? " <span class=\"required\">*</span>".html_safe : ""),
92 (required ? " <span class=\"required\">*</span>".html_safe : ""),
93 :for => "#{name}_custom_field_values_#{custom_value.custom_field.id}"
93 :for => "#{name}_custom_field_values_#{custom_value.custom_field.id}"
94 end
94 end
95
95
96 # Return custom field tag with its label tag
96 # Return custom field tag with its label tag
97 def custom_field_tag_with_label(name, custom_value, options={})
97 def custom_field_tag_with_label(name, custom_value, options={})
98 custom_field_label_tag(name, custom_value, options) + custom_field_tag(name, custom_value)
98 custom_field_label_tag(name, custom_value, options) + custom_field_tag(name, custom_value)
99 end
99 end
100
100
101 def custom_field_tag_for_bulk_edit(name, custom_field, projects=nil, value='')
101 def custom_field_tag_for_bulk_edit(name, custom_field, projects=nil, value='')
102 field_name = "#{name}[custom_field_values][#{custom_field.id}]"
102 field_name = "#{name}[custom_field_values][#{custom_field.id}]"
103 field_name << "[]" if custom_field.multiple?
103 field_name << "[]" if custom_field.multiple?
104 field_id = "#{name}_custom_field_values_#{custom_field.id}"
104 field_id = "#{name}_custom_field_values_#{custom_field.id}"
105
105
106 tag_options = {:id => field_id, :class => "#{custom_field.field_format}_cf"}
106 tag_options = {:id => field_id, :class => "#{custom_field.field_format}_cf"}
107
107
108 unset_tag = ''
109 unless custom_field.is_required?
110 unset_tag = content_tag('label',
111 check_box_tag(field_name, '__none__', (value == '__none__'), :id => nil, :data => {:disables => "##{field_id}"}) + l(:button_clear),
112 :class => 'inline'
113 )
114 end
115
108 field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format)
116 field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format)
109 case field_format.try(:edit_as)
117 case field_format.try(:edit_as)
110 when "date"
118 when "date"
111 text_field_tag(field_name, value, tag_options.merge(:size => 10)) +
119 text_field_tag(field_name, value, tag_options.merge(:size => 10)) +
112 calendar_for(field_id)
120 calendar_for(field_id) +
121 unset_tag
113 when "text"
122 when "text"
114 text_area_tag(field_name, value, tag_options.merge(:rows => 3))
123 text_area_tag(field_name, value, tag_options.merge(:rows => 3)) +
124 '<br />'.html_safe +
125 unset_tag
115 when "bool"
126 when "bool"
116 select_tag(field_name, options_for_select([[l(:label_no_change_option), ''],
127 select_tag(field_name, options_for_select([[l(:label_no_change_option), ''],
117 [l(:general_text_yes), '1'],
128 [l(:general_text_yes), '1'],
118 [l(:general_text_no), '0']], value), tag_options)
129 [l(:general_text_no), '0']], value), tag_options)
119 when "list"
130 when "list"
120 options = []
131 options = []
121 options << [l(:label_no_change_option), ''] unless custom_field.multiple?
132 options << [l(:label_no_change_option), ''] unless custom_field.multiple?
122 options << [l(:label_none), '__none__'] unless custom_field.is_required?
133 options << [l(:label_none), '__none__'] unless custom_field.is_required?
123 options += custom_field.possible_values_options(projects)
134 options += custom_field.possible_values_options(projects)
124 select_tag(field_name, options_for_select(options, value), tag_options.merge(:multiple => custom_field.multiple?))
135 select_tag(field_name, options_for_select(options, value), tag_options.merge(:multiple => custom_field.multiple?))
125 else
136 else
126 text_field_tag(field_name, value, tag_options)
137 text_field_tag(field_name, value, tag_options) +
138 unset_tag
127 end
139 end
128 end
140 end
129
141
130 # Return a string used to display a custom value
142 # Return a string used to display a custom value
131 def show_value(custom_value)
143 def show_value(custom_value)
132 return "" unless custom_value
144 return "" unless custom_value
133 format_value(custom_value.value, custom_value.custom_field.field_format)
145 format_value(custom_value.value, custom_value.custom_field.field_format)
134 end
146 end
135
147
136 # Return a string used to display a custom value
148 # Return a string used to display a custom value
137 def format_value(value, field_format)
149 def format_value(value, field_format)
138 if value.is_a?(Array)
150 if value.is_a?(Array)
139 value.collect {|v| format_value(v, field_format)}.compact.sort.join(', ')
151 value.collect {|v| format_value(v, field_format)}.compact.sort.join(', ')
140 else
152 else
141 Redmine::CustomFieldFormat.format_value(value, field_format)
153 Redmine::CustomFieldFormat.format_value(value, field_format)
142 end
154 end
143 end
155 end
144
156
145 # Return an array of custom field formats which can be used in select_tag
157 # Return an array of custom field formats which can be used in select_tag
146 def custom_field_formats_for_select(custom_field)
158 def custom_field_formats_for_select(custom_field)
147 Redmine::CustomFieldFormat.as_select(custom_field.class.customized_class.name)
159 Redmine::CustomFieldFormat.as_select(custom_field.class.customized_class.name)
148 end
160 end
149
161
150 # Renders the custom_values in api views
162 # Renders the custom_values in api views
151 def render_api_custom_values(custom_values, api)
163 def render_api_custom_values(custom_values, api)
152 api.array :custom_fields do
164 api.array :custom_fields do
153 custom_values.each do |custom_value|
165 custom_values.each do |custom_value|
154 attrs = {:id => custom_value.custom_field_id, :name => custom_value.custom_field.name}
166 attrs = {:id => custom_value.custom_field_id, :name => custom_value.custom_field.name}
155 attrs.merge!(:multiple => true) if custom_value.custom_field.multiple?
167 attrs.merge!(:multiple => true) if custom_value.custom_field.multiple?
156 api.custom_field attrs do
168 api.custom_field attrs do
157 if custom_value.value.is_a?(Array)
169 if custom_value.value.is_a?(Array)
158 api.array :value do
170 api.array :value do
159 custom_value.value.each do |value|
171 custom_value.value.each do |value|
160 api.value value unless value.blank?
172 api.value value unless value.blank?
161 end
173 end
162 end
174 end
163 else
175 else
164 api.value custom_value.value
176 api.value custom_value.value
165 end
177 end
166 end
178 end
167 end
179 end
168 end unless custom_values.empty?
180 end unless custom_values.empty?
169 end
181 end
170 end
182 end
@@ -1,180 +1,198
1 <h2><%= @copy ? l(:button_copy) : l(:label_bulk_edit_selected_issues) %></h2>
1 <h2><%= @copy ? l(:button_copy) : l(:label_bulk_edit_selected_issues) %></h2>
2
2
3 <% if @saved_issues && @unsaved_issues.present? %>
3 <% if @saved_issues && @unsaved_issues.present? %>
4 <div id="errorExplanation">
4 <div id="errorExplanation">
5 <span>
5 <span>
6 <%= l(:notice_failed_to_save_issues,
6 <%= l(:notice_failed_to_save_issues,
7 :count => @unsaved_issues.size,
7 :count => @unsaved_issues.size,
8 :total => @saved_issues.size,
8 :total => @saved_issues.size,
9 :ids => @unsaved_issues.map {|i| "##{i.id}"}.join(', ')) %>
9 :ids => @unsaved_issues.map {|i| "##{i.id}"}.join(', ')) %>
10 </span>
10 </span>
11 <ul>
11 <ul>
12 <% bulk_edit_error_messages(@unsaved_issues).each do |message| %>
12 <% bulk_edit_error_messages(@unsaved_issues).each do |message| %>
13 <li><%= message %></li>
13 <li><%= message %></li>
14 <% end %>
14 <% end %>
15 </ul>
15 </ul>
16 </div>
16 </div>
17 <% end %>
17 <% end %>
18
18
19 <ul id="bulk-selection">
19 <ul id="bulk-selection">
20 <% @issues.each do |issue| %>
20 <% @issues.each do |issue| %>
21 <%= content_tag 'li', link_to_issue(issue) %>
21 <%= content_tag 'li', link_to_issue(issue) %>
22 <% end %>
22 <% end %>
23 </ul>
23 </ul>
24
24
25 <%= form_tag(bulk_update_issues_path, :id => 'bulk_edit_form') do %>
25 <%= form_tag(bulk_update_issues_path, :id => 'bulk_edit_form') do %>
26 <%= @issues.collect {|i| hidden_field_tag('ids[]', i.id)}.join("\n").html_safe %>
26 <%= @issues.collect {|i| hidden_field_tag('ids[]', i.id)}.join("\n").html_safe %>
27 <div class="box tabular">
27 <div class="box tabular">
28 <fieldset class="attributes">
28 <fieldset class="attributes">
29 <legend><%= l(:label_change_properties) %></legend>
29 <legend><%= l(:label_change_properties) %></legend>
30
30
31 <div class="splitcontentleft">
31 <div class="splitcontentleft">
32 <% if @allowed_projects.present? %>
32 <% if @allowed_projects.present? %>
33 <p>
33 <p>
34 <label for="issue_project_id"><%= l(:field_project) %></label>
34 <label for="issue_project_id"><%= l(:field_project) %></label>
35 <%= select_tag('issue[project_id]',
35 <%= select_tag('issue[project_id]',
36 content_tag('option', l(:label_no_change_option), :value => '') +
36 content_tag('option', l(:label_no_change_option), :value => '') +
37 project_tree_options_for_select(@allowed_projects, :selected => @target_project),
37 project_tree_options_for_select(@allowed_projects, :selected => @target_project),
38 :onchange => "updateBulkEditFrom('#{escape_javascript url_for(:action => 'bulk_edit', :format => 'js')}')") %>
38 :onchange => "updateBulkEditFrom('#{escape_javascript url_for(:action => 'bulk_edit', :format => 'js')}')") %>
39 </p>
39 </p>
40 <% end %>
40 <% end %>
41 <p>
41 <p>
42 <label for="issue_tracker_id"><%= l(:field_tracker) %></label>
42 <label for="issue_tracker_id"><%= l(:field_tracker) %></label>
43 <%= select_tag('issue[tracker_id]',
43 <%= select_tag('issue[tracker_id]',
44 content_tag('option', l(:label_no_change_option), :value => '') +
44 content_tag('option', l(:label_no_change_option), :value => '') +
45 options_from_collection_for_select(@trackers, :id, :name, @issue_params[:tracker_id])) %>
45 options_from_collection_for_select(@trackers, :id, :name, @issue_params[:tracker_id])) %>
46 </p>
46 </p>
47 <% if @available_statuses.any? %>
47 <% if @available_statuses.any? %>
48 <p>
48 <p>
49 <label for='issue_status_id'><%= l(:field_status) %></label>
49 <label for='issue_status_id'><%= l(:field_status) %></label>
50 <%= select_tag('issue[status_id]',
50 <%= select_tag('issue[status_id]',
51 content_tag('option', l(:label_no_change_option), :value => '') +
51 content_tag('option', l(:label_no_change_option), :value => '') +
52 options_from_collection_for_select(@available_statuses, :id, :name, @issue_params[:status_id])) %>
52 options_from_collection_for_select(@available_statuses, :id, :name, @issue_params[:status_id])) %>
53 </p>
53 </p>
54 <% end %>
54 <% end %>
55
55
56 <% if @safe_attributes.include?('priority_id') -%>
56 <% if @safe_attributes.include?('priority_id') -%>
57 <p>
57 <p>
58 <label for='issue_priority_id'><%= l(:field_priority) %></label>
58 <label for='issue_priority_id'><%= l(:field_priority) %></label>
59 <%= select_tag('issue[priority_id]',
59 <%= select_tag('issue[priority_id]',
60 content_tag('option', l(:label_no_change_option), :value => '') +
60 content_tag('option', l(:label_no_change_option), :value => '') +
61 options_from_collection_for_select(IssuePriority.active, :id, :name, @issue_params[:priority_id])) %>
61 options_from_collection_for_select(IssuePriority.active, :id, :name, @issue_params[:priority_id])) %>
62 </p>
62 </p>
63 <% end %>
63 <% end %>
64
64
65 <% if @safe_attributes.include?('assigned_to_id') -%>
65 <% if @safe_attributes.include?('assigned_to_id') -%>
66 <p>
66 <p>
67 <label for='issue_assigned_to_id'><%= l(:field_assigned_to) %></label>
67 <label for='issue_assigned_to_id'><%= l(:field_assigned_to) %></label>
68 <%= select_tag('issue[assigned_to_id]',
68 <%= select_tag('issue[assigned_to_id]',
69 content_tag('option', l(:label_no_change_option), :value => '') +
69 content_tag('option', l(:label_no_change_option), :value => '') +
70 content_tag('option', l(:label_nobody), :value => 'none', :selected => (@issue_params[:assigned_to_id] == 'none')) +
70 content_tag('option', l(:label_nobody), :value => 'none', :selected => (@issue_params[:assigned_to_id] == 'none')) +
71 principals_options_for_select(@assignables, @issue_params[:assigned_to_id])) %>
71 principals_options_for_select(@assignables, @issue_params[:assigned_to_id])) %>
72 </p>
72 </p>
73 <% end %>
73 <% end %>
74
74
75 <% if @safe_attributes.include?('category_id') -%>
75 <% if @safe_attributes.include?('category_id') -%>
76 <p>
76 <p>
77 <label for='issue_category_id'><%= l(:field_category) %></label>
77 <label for='issue_category_id'><%= l(:field_category) %></label>
78 <%= select_tag('issue[category_id]', content_tag('option', l(:label_no_change_option), :value => '') +
78 <%= select_tag('issue[category_id]', content_tag('option', l(:label_no_change_option), :value => '') +
79 content_tag('option', l(:label_none), :value => 'none', :selected => (@issue_params[:category_id] == 'none')) +
79 content_tag('option', l(:label_none), :value => 'none', :selected => (@issue_params[:category_id] == 'none')) +
80 options_from_collection_for_select(@categories, :id, :name, @issue_params[:category_id])) %>
80 options_from_collection_for_select(@categories, :id, :name, @issue_params[:category_id])) %>
81 </p>
81 </p>
82 <% end %>
82 <% end %>
83
83
84 <% if @safe_attributes.include?('fixed_version_id') -%>
84 <% if @safe_attributes.include?('fixed_version_id') -%>
85 <p>
85 <p>
86 <label for='issue_fixed_version_id'><%= l(:field_fixed_version) %></label>
86 <label for='issue_fixed_version_id'><%= l(:field_fixed_version) %></label>
87 <%= select_tag('issue[fixed_version_id]', content_tag('option', l(:label_no_change_option), :value => '') +
87 <%= select_tag('issue[fixed_version_id]', content_tag('option', l(:label_no_change_option), :value => '') +
88 content_tag('option', l(:label_none), :value => 'none', :selected => (@issue_params[:fixed_version_id] == 'none')) +
88 content_tag('option', l(:label_none), :value => 'none', :selected => (@issue_params[:fixed_version_id] == 'none')) +
89 version_options_for_select(@versions.sort, @issue_params[:fixed_version_id])) %>
89 version_options_for_select(@versions.sort, @issue_params[:fixed_version_id])) %>
90 </p>
90 </p>
91 <% end %>
91 <% end %>
92
92
93 <% @custom_fields.each do |custom_field| %>
93 <% @custom_fields.each do |custom_field| %>
94 <p>
94 <p>
95 <label><%= h(custom_field.name) %></label>
95 <label><%= h(custom_field.name) %></label>
96 <%= custom_field_tag_for_bulk_edit('issue', custom_field, @projects, @issue_params[:custom_field_values][custom_field.id.to_s]) %>
96 <%= custom_field_tag_for_bulk_edit('issue', custom_field, @projects, @issue_params[:custom_field_values][custom_field.id.to_s]) %>
97 </p>
97 </p>
98 <% end %>
98 <% end %>
99
99
100 <% if @copy && @attachments_present %>
100 <% if @copy && @attachments_present %>
101 <%= hidden_field_tag 'copy_attachments', '0' %>
101 <%= hidden_field_tag 'copy_attachments', '0' %>
102 <p>
102 <p>
103 <label for='copy_attachments'><%= l(:label_copy_attachments) %></label>
103 <label for='copy_attachments'><%= l(:label_copy_attachments) %></label>
104 <%= check_box_tag 'copy_attachments', '1', params[:copy_attachments] != '0' %>
104 <%= check_box_tag 'copy_attachments', '1', params[:copy_attachments] != '0' %>
105 </p>
105 </p>
106 <% end %>
106 <% end %>
107
107
108 <% if @copy && @subtasks_present %>
108 <% if @copy && @subtasks_present %>
109 <%= hidden_field_tag 'copy_subtasks', '0' %>
109 <%= hidden_field_tag 'copy_subtasks', '0' %>
110 <p>
110 <p>
111 <label for='copy_subtasks'><%= l(:label_copy_subtasks) %></label>
111 <label for='copy_subtasks'><%= l(:label_copy_subtasks) %></label>
112 <%= check_box_tag 'copy_subtasks', '1', params[:copy_subtasks] != '0' %>
112 <%= check_box_tag 'copy_subtasks', '1', params[:copy_subtasks] != '0' %>
113 </p>
113 </p>
114 <% end %>
114 <% end %>
115
115
116 <%= call_hook(:view_issues_bulk_edit_details_bottom, { :issues => @issues }) %>
116 <%= call_hook(:view_issues_bulk_edit_details_bottom, { :issues => @issues }) %>
117 </div>
117 </div>
118
118
119 <div class="splitcontentright">
119 <div class="splitcontentright">
120 <% if @safe_attributes.include?('is_private') %>
120 <% if @safe_attributes.include?('is_private') %>
121 <p>
121 <p>
122 <label for='issue_is_private'><%= l(:field_is_private) %></label>
122 <label for='issue_is_private'><%= l(:field_is_private) %></label>
123 <%= select_tag('issue[is_private]', content_tag('option', l(:label_no_change_option), :value => '') +
123 <%= select_tag('issue[is_private]', content_tag('option', l(:label_no_change_option), :value => '') +
124 content_tag('option', l(:general_text_Yes), :value => '1', :selected => (@issue_params[:is_private] == '1')) +
124 content_tag('option', l(:general_text_Yes), :value => '1', :selected => (@issue_params[:is_private] == '1')) +
125 content_tag('option', l(:general_text_No), :value => '0', :selected => (@issue_params[:is_private] == '0'))) %>
125 content_tag('option', l(:general_text_No), :value => '0', :selected => (@issue_params[:is_private] == '0'))) %>
126 </p>
126 </p>
127 <% end %>
127 <% end %>
128
128
129 <% if @safe_attributes.include?('parent_issue_id') && @project %>
129 <% if @safe_attributes.include?('parent_issue_id') && @project %>
130 <p>
130 <p>
131 <label for='issue_parent_issue_id'><%= l(:field_parent_issue) %></label>
131 <label for='issue_parent_issue_id'><%= l(:field_parent_issue) %></label>
132 <%= text_field_tag 'issue[parent_issue_id]', '', :size => 10, :value => @issue_params[:parent_issue_id] %>
132 <%= text_field_tag 'issue[parent_issue_id]', '', :size => 10, :value => @issue_params[:parent_issue_id] %>
133 <label class="inline"><%= check_box_tag 'issue[parent_issue_id]', 'none', (@issue_params[:parent_issue_id] == 'none'), :id => nil, :data => {:disables => '#issue_parent_issue_id'} %><%= l(:button_clear) %></label>
133 </p>
134 </p>
134 <%= javascript_tag "observeAutocompleteField('issue_parent_issue_id', '#{escape_javascript auto_complete_issues_path(:project_id => @project)}')" %>
135 <%= javascript_tag "observeAutocompleteField('issue_parent_issue_id', '#{escape_javascript auto_complete_issues_path(:project_id => @project)}')" %>
135 <% end %>
136 <% end %>
136
137
137 <% if @safe_attributes.include?('start_date') %>
138 <% if @safe_attributes.include?('start_date') %>
138 <p>
139 <p>
139 <label for='issue_start_date'><%= l(:field_start_date) %></label>
140 <label for='issue_start_date'><%= l(:field_start_date) %></label>
140 <%= text_field_tag 'issue[start_date]', '', :value => @issue_params[:start_date], :size => 10 %><%= calendar_for('issue_start_date') %>
141 <%= text_field_tag 'issue[start_date]', '', :value => @issue_params[:start_date], :size => 10 %><%= calendar_for('issue_start_date') %>
142 <label class="inline"><%= check_box_tag 'issue[start_date]', 'none', (@issue_params[:start_date] == 'none'), :id => nil, :data => {:disables => '#issue_start_date'} %><%= l(:button_clear) %></label>
141 </p>
143 </p>
142 <% end %>
144 <% end %>
143
145
144 <% if @safe_attributes.include?('due_date') %>
146 <% if @safe_attributes.include?('due_date') %>
145 <p>
147 <p>
146 <label for='issue_due_date'><%= l(:field_due_date) %></label>
148 <label for='issue_due_date'><%= l(:field_due_date) %></label>
147 <%= text_field_tag 'issue[due_date]', '', :value => @issue_params[:due_date], :size => 10 %><%= calendar_for('issue_due_date') %>
149 <%= text_field_tag 'issue[due_date]', '', :value => @issue_params[:due_date], :size => 10 %><%= calendar_for('issue_due_date') %>
150 <label class="inline"><%= check_box_tag 'issue[due_date]', 'none', (@issue_params[:due_date] == 'none'), :id => nil, :data => {:disables => '#issue_due_date'} %><%= l(:button_clear) %></label>
148 </p>
151 </p>
149 <% end %>
152 <% end %>
150
153
151 <% if @safe_attributes.include?('done_ratio') && Issue.use_field_for_done_ratio? %>
154 <% if @safe_attributes.include?('done_ratio') && Issue.use_field_for_done_ratio? %>
152 <p>
155 <p>
153 <label for='issue_done_ratio'><%= l(:field_done_ratio) %></label>
156 <label for='issue_done_ratio'><%= l(:field_done_ratio) %></label>
154 <%= select_tag 'issue[done_ratio]', options_for_select([[l(:label_no_change_option), '']] + (0..10).to_a.collect {|r| ["#{r*10} %", r*10] }, @issue_params[:done_ratio]) %>
157 <%= select_tag 'issue[done_ratio]', options_for_select([[l(:label_no_change_option), '']] + (0..10).to_a.collect {|r| ["#{r*10} %", r*10] }, @issue_params[:done_ratio]) %>
155 </p>
158 </p>
156 <% end %>
159 <% end %>
157 </div>
160 </div>
158 </fieldset>
161 </fieldset>
159
162
160 <fieldset>
163 <fieldset>
161 <legend><%= l(:field_notes) %></legend>
164 <legend><%= l(:field_notes) %></legend>
162 <%= text_area_tag 'notes', @notes, :cols => 60, :rows => 10, :class => 'wiki-edit' %>
165 <%= text_area_tag 'notes', @notes, :cols => 60, :rows => 10, :class => 'wiki-edit' %>
163 <%= wikitoolbar_for 'notes' %>
166 <%= wikitoolbar_for 'notes' %>
164 </fieldset>
167 </fieldset>
165 </div>
168 </div>
166
169
167 <p>
170 <p>
168 <% if @copy %>
171 <% if @copy %>
169 <%= hidden_field_tag 'copy', '1' %>
172 <%= hidden_field_tag 'copy', '1' %>
170 <%= submit_tag l(:button_copy) %>
173 <%= submit_tag l(:button_copy) %>
171 <%= submit_tag l(:button_copy_and_follow), :name => 'follow' %>
174 <%= submit_tag l(:button_copy_and_follow), :name => 'follow' %>
172 <% elsif @target_project %>
175 <% elsif @target_project %>
173 <%= submit_tag l(:button_move) %>
176 <%= submit_tag l(:button_move) %>
174 <%= submit_tag l(:button_move_and_follow), :name => 'follow' %>
177 <%= submit_tag l(:button_move_and_follow), :name => 'follow' %>
175 <% else %>
178 <% else %>
176 <%= submit_tag l(:button_submit) %>
179 <%= submit_tag l(:button_submit) %>
177 <% end %>
180 <% end %>
178 </p>
181 </p>
179
182
180 <% end %>
183 <% end %>
184
185 <%= javascript_tag do %>
186 $(window).load(function(){
187 $(document).on('change', 'input[data-disables]', function(){
188 if ($(this).attr('checked')){
189 $($(this).data('disables')).attr('disabled', true).val('');
190 } else {
191 $($(this).data('disables')).attr('disabled', false);
192 }
193 });
194 });
195 $(document).ready(function(){
196 $('input[data-disables]').trigger('change');
197 });
198 <% end %>
1 NO CONTENT: modified file
NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
General Comments 0
You need to be logged in to leave comments. Login now