summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2018-09-26 07:27:30 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2018-09-26 07:27:30 +0000
commitb9fa262165601a3b348d22ca1d8da53bda99e55b (patch)
tree21bd632e051addfee01ab7a568b01f5b6428051a /app/controllers
parentc171797673f549e434dd6b94f7262fd31a77b533 (diff)
Adds preview option to the wiki toolbar (#27758).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@17521 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/messages_controller.rb2
-rw-r--r--app/controllers/previews_controller.rb23
-rw-r--r--app/controllers/wiki_controller.rb2
3 files changed, 13 insertions, 14 deletions
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb
index 76bc19cf6..0ba360e9a 100644
--- a/app/controllers/messages_controller.rb
+++ b/app/controllers/messages_controller.rb
@@ -118,7 +118,7 @@ class MessagesController < ApplicationController
def preview
message = @board.messages.find_by_id(params[:id])
- @text = (params[:message] || params[:reply])[:content]
+ @text = params[:text] ? params[:text] : nil
@previewed = message
render :partial => 'common/preview'
end
diff --git a/app/controllers/previews_controller.rb b/app/controllers/previews_controller.rb
index 37cdc4668..41e6941f9 100644
--- a/app/controllers/previews_controller.rb
+++ b/app/controllers/previews_controller.rb
@@ -16,31 +16,30 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class PreviewsController < ApplicationController
- before_action :find_project, :find_attachments
+ before_action :find_project, :except => :text
+ before_action :find_attachments
def issue
- @issue = Issue.visible.find_by_id(params[:id]) unless params[:id].blank?
+ @issue = Issue.visible.find_by_id(params[:issue_id]) unless params[:issue_id].blank?
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
- @notes = params[:journal] ? params[:journal][:notes] : nil
- @notes ||= params[:issue] ? params[:issue][:notes] : nil
- else
- @description = (params[:issue] ? params[:issue][:description] : nil)
+ @previewed = @issue
end
- render :layout => false
+ @text = params[:text] ? params[:text] : nil
+ render :partial => 'common/preview'
end
def news
if params[:id].present? && news = News.visible.find_by_id(params[:id])
@previewed = news
end
- @text = (params[:news] ? params[:news][:description] : nil)
+ @text = params[:text] ? params[:text] : nil
render :partial => 'common/preview'
end
+ def text
+ @text = params[:text] ? params[:text] : nil
+ render :partial => 'common/preview'
+ end
private
def find_project
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb
index b43b933cd..c5f7cdc0c 100644
--- a/app/controllers/wiki_controller.rb
+++ b/app/controllers/wiki_controller.rb
@@ -321,7 +321,7 @@ class WikiController < ApplicationController
@attachments += page.attachments
@previewed = page.content
end
- @text = params[:content][:text]
+ @text = params[:content].present? ? params[:content][:text] : params[:text]
render :partial => 'common/preview'
end