@@ -0,0 +1,11 | |||||
|
1 | <% if @notes %> | |||
|
2 | <fieldset class="preview"><legend><%= l(:field_notes) %></legend> | |||
|
3 | <%= textilizable @notes, :attachments => @attachements, :object => @issue %> | |||
|
4 | </fieldset> | |||
|
5 | <% end %> | |||
|
6 | ||||
|
7 | <% if @description %> | |||
|
8 | <fieldset class="preview"><legend><%= l(:field_description) %></legend> | |||
|
9 | <%= textilizable @description, :attachments => @attachements, :object => @issue %> | |||
|
10 | </fieldset> | |||
|
11 | <% end %> |
@@ -453,9 +453,17 class IssuesController < ApplicationController | |||||
453 |
|
453 | |||
454 | def preview |
|
454 | def preview | |
455 | @issue = @project.issues.find_by_id(params[:id]) unless params[:id].blank? |
|
455 | @issue = @project.issues.find_by_id(params[:id]) unless params[:id].blank? | |
456 | @attachements = @issue.attachments if @issue |
|
456 | if @issue | |
457 | @text = params[:notes] || (params[:issue] ? params[:issue][:description] : nil) |
|
457 | @attachements = @issue.attachments | |
458 | render :partial => 'common/preview' |
|
458 | @description = params[:issue] && params[:issue][:description] | |
|
459 | if @description && @description.gsub(/(\r?\n|\n\r?)/, "\n") == @issue.description.to_s.gsub(/(\r?\n|\n\r?)/, "\n") | |||
|
460 | @description = nil | |||
|
461 | end | |||
|
462 | @notes = params[:notes] | |||
|
463 | else | |||
|
464 | @description = (params[:issue] ? params[:issue][:description] : nil) | |||
|
465 | end | |||
|
466 | render :layout => false | |||
459 | end |
|
467 | end | |
460 |
|
468 | |||
461 | def auto_complete |
|
469 | def auto_complete |
@@ -1271,6 +1271,22 class IssuesControllerTest < ActionController::TestCase | |||||
1271 | :attributes => { :href => '#', |
|
1271 | :attributes => { :href => '#', | |
1272 | :class => 'icon-del disabled' } |
|
1272 | :class => 'icon-del disabled' } | |
1273 | end |
|
1273 | end | |
|
1274 | ||||
|
1275 | def test_preview_new_issue | |||
|
1276 | @request.session[:user_id] = 2 | |||
|
1277 | post :preview, :project_id => '1', :issue => {:description => 'Foo'} | |||
|
1278 | assert_response :success | |||
|
1279 | assert_template 'preview' | |||
|
1280 | assert_not_nil assigns(:description) | |||
|
1281 | end | |||
|
1282 | ||||
|
1283 | def test_preview_notes | |||
|
1284 | @request.session[:user_id] = 2 | |||
|
1285 | post :preview, :project_id => '1', :id => 1, :issue => {:description => Issue.find(1).description}, :notes => 'Foo' | |||
|
1286 | assert_response :success | |||
|
1287 | assert_template 'preview' | |||
|
1288 | assert_not_nil assigns(:notes) | |||
|
1289 | end | |||
1274 |
|
1290 | |||
1275 | def test_auto_complete_routing |
|
1291 | def test_auto_complete_routing | |
1276 | assert_routing( |
|
1292 | assert_routing( |
General Comments 0
You need to be logged in to leave comments.
Login now