##// END OF EJS Templates
Introduce virtual MenuNodes (#15880)....
Introduce virtual MenuNodes (#15880). They are characterized by having a blank url. they will only be rendered if the user is authorized to see at least one of its children. they render as links which do nothing when clicked. Patch by Jan Schulz-Hofen. git-svn-id: http://svn.redmine.org/redmine/trunk@15501 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r14856:cda9c63d9c21
r15119:53710d80fc88
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
Updates copyright for 2016....
r14856 # Copyright (C) 2006-2016 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