##// END OF EJS Templates
tagged version 3.0.0...
tagged version 3.0.0 git-svn-id: http://svn.redmine.org/redmine/tags/3.0.0@14042 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r13490:000124f44f53
r13660:0ab75f945d74 3.0.0
Show More
previews_controller.rb
53 lines | 1.9 KiB | text/x-ruby | RubyLexer
/ app / controllers / previews_controller.rb
Jean-Philippe Lang
Adds support for preview when editing an issue note (#5520)....
r5126 # Redmine - project management software
Jean-Philippe Lang
Copyright update....
r13490 # Copyright (C) 2006-2015 Jean-Philippe Lang
Jean-Philippe Lang
Adds support for preview when editing an issue note (#5520)....
r5126 #
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/previews_controller.rb....
r6688 #
Jean-Philippe Lang
Adds support for preview when editing an issue note (#5520)....
r5126 # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/previews_controller.rb....
r6688 #
Jean-Philippe Lang
Adds support for preview when editing an issue note (#5520)....
r5126 # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Eric Davis
Refactor: move IssuesController#preview to a new controller....
r3832 class PreviewsController < ApplicationController
Jean-Philippe Lang
Merged ajax_upload branch (#3957)....
r10748 before_filter :find_project, :find_attachments
Eric Davis
Refactor: move IssuesController#preview to a new controller....
r3832
def issue
Jean-Philippe Lang
Fixed that preview doesn't show notes when issue project is changed (#17959)....
r13064 @issue = Issue.visible.find_by_id(params[:id]) unless params[:id].blank?
Eric Davis
Refactor: move IssuesController#preview to a new controller....
r3832 if @issue
@description = params[:issue] && params[:issue][:description]
if @description && @description.gsub(/(\r?\n|\n\r?)/, "\n") == @issue.description.to_s.gsub(/(\r?\n|\n\r?)/, "\n")
@description = nil
end
Etienne Massip
Fixed notes preview in issue history broken and hidden by a broken test....
r10747 # params[:notes] is useful for preview of notes in issue history
@notes = params[:notes] || (params[:issue] ? params[:issue][:notes] : nil)
Eric Davis
Refactor: move IssuesController#preview to a new controller....
r3832 else
@description = (params[:issue] ? params[:issue][:description] : nil)
end
render :layout => false
end
Eric Davis
Refactor: move NewsController#preview to PreviewsController#news...
r4060 def news
Jean-Philippe Lang
Attachments should be available to the text formatter when previewing an existing news....
r10217 if params[:id].present? && news = News.visible.find_by_id(params[:id])
@previewed = news
end
Eric Davis
Refactor: move NewsController#preview to PreviewsController#news...
r4060 @text = (params[:news] ? params[:news][:description] : nil)
render :partial => 'common/preview'
end
Eric Davis
Refactor: move IssuesController#preview to a new controller....
r3832 private
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/previews_controller.rb....
r6688
Eric Davis
Refactor: move IssuesController#preview to a new controller....
r3832 def find_project
project_id = (params[:issue] && params[:issue][:project_id]) || params[:project_id]
Jean-Philippe Lang
Reverts change in r13428, project can't be found by identifier (#17959)....
r13065 @project = Project.find(project_id)
Eric Davis
Refactor: move IssuesController#preview to a new controller....
r3832 rescue ActiveRecord::RecordNotFound
render_404
end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/previews_controller.rb....
r6688
Eric Davis
Refactor: move IssuesController#preview to a new controller....
r3832 end