diff app/controllers/previews_controller.rb @ 1338:25603efa57b5

Merge from live branch
author Chris Cannam
date Thu, 20 Jun 2013 13:14:14 +0100
parents 433d4f72a19b
children 622f24f53b42
line wrap: on
line diff
--- a/app/controllers/previews_controller.rb	Wed Jan 23 13:11:25 2013 +0000
+++ b/app/controllers/previews_controller.rb	Thu Jun 20 13:14:14 2013 +0100
@@ -1,5 +1,5 @@
 # Redmine - project management software
-# Copyright (C) 2006-2011  Jean-Philippe Lang
+# Copyright (C) 2006-2012  Jean-Philippe Lang
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -26,7 +26,8 @@
       if @description && @description.gsub(/(\r?\n|\n\r?)/, "\n") == @issue.description.to_s.gsub(/(\r?\n|\n\r?)/, "\n")
         @description = nil
       end
-      @notes = params[:notes]
+      # params[:notes] is useful for preview of notes in issue history
+      @notes = params[:notes] || (params[:issue] ? params[:issue][:notes] : nil)
     else
       @description = (params[:issue] ? params[:issue][:description] : nil)
     end
@@ -34,6 +35,10 @@
   end
 
   def news
+    if params[:id].present? && news = News.visible.find_by_id(params[:id])
+      @previewed = news
+      @attachments = news.attachments
+    end
     @text = (params[:news] ? params[:news][:description] : nil)
     render :partial => 'common/preview'
   end