Patch #2931 » tracker_templates_redmine_1.2-stable.diff
app/controllers/issues_controller.rb | ||
---|---|---|
304 | 304 |
@issue.project = @project |
305 | 305 |
@issue.author = User.current |
306 | 306 |
# Tracker must be set before custom field values |
307 |
@issue.tracker ||= @project.trackers.find((params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id] || :first)
|
|
307 |
@issue.tracker = @project.trackers.find((params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id] || :first) |
|
308 | 308 |
if @issue.tracker.nil? |
309 | 309 |
render_error l(:error_no_tracker_in_project) |
310 | 310 |
return false |
311 |
else |
|
312 |
params[:issue].delete :tracker_id if params[:issue] # tracker has been set, prevent #safe_attributes= to set it again |
|
313 |
_prev_tracker = nil |
|
314 |
unless params[:prev_tracker_id] && params[:issue] && |
|
315 |
(_prev_tracker = @project.trackers.find(params[:prev_tracker_id])) && # previous tracker (+ template) |
|
316 |
(params[:issue][:description].gsub(/\r|\n/, '') != _prev_tracker.template.gsub(/\r|\n/, '')) # description changed |
|
317 |
params[:issue] ||= {} |
|
318 |
params[:issue][:description] = @issue.tracker.template |
|
319 |
end |
|
311 | 320 |
end |
312 | 321 |
@issue.start_date ||= Date.today |
313 | 322 |
if params[:issue].is_a?(Hash) |
app/views/issues/_attributes.rhtml | ||
---|---|---|
1 |
<%= hidden_field_tag :prev_tracker_id, @issue.tracker.id %> |
|
2 | ||
1 | 3 |
<% fields_for :issue, @issue, :builder => TabularFormBuilder do |f| %> |
2 | 4 | |
5 |
<p><%= f.text_area :description, |
|
6 |
:cols => 60, |
|
7 |
:rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min), |
|
8 |
:accesskey => accesskey(:edit), |
|
9 |
:class => 'wiki-edit' %></p> |
|
10 | ||
3 | 11 |
<div class="splitcontentleft"> |
4 | 12 |
<% if @issue.new_record? || @allowed_statuses.any? %> |
5 | 13 |
<p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), :required => true %></p> |
... | ... | |
48 | 56 |
<%= render :partial => 'issues/form_custom_fields' %> |
49 | 57 | |
50 | 58 |
<% end %> |
59 | ||
60 |
<%= wikitoolbar_for 'issue_description' %> |
app/views/issues/_form.rhtml | ||
---|---|---|
12 | 12 |
:with => "Form.serialize('issue-form')" %> |
13 | 13 | |
14 | 14 |
<p><%= f.text_field :subject, :size => 80, :required => true %></p> |
15 |
<p><%= f.text_area :description, |
|
16 |
:cols => 60, |
|
17 |
:rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min), |
|
18 |
:accesskey => accesskey(:edit), |
|
19 |
:class => 'wiki-edit' %></p> |
|
20 | 15 |
</div> |
21 | ||
16 |
|
|
22 | 17 |
<div id="attributes" class="attributes"> |
23 | 18 |
<%= render :partial => 'issues/attributes' %> |
24 | 19 |
</div> |
... | ... | |
37 | 32 | |
38 | 33 |
<%= call_hook(:view_issues_form_details_bottom, { :issue => @issue, :form => f }) %> |
39 | 34 | |
40 |
<%= wikitoolbar_for 'issue_description' %> |
- « Previous
- 1
- …
- 3
- 4
- 5
- Next »