summaryrefslogtreecommitdiff
path: root/app/controllers/snippets_controller.rb
diff options
context:
space:
mode:
authorRares Sfirlogea <rrr.junior@gmail.com>2016-11-16 12:09:09 +0100
committerAdam Niedzielski <adamsunday@gmail.com>2017-05-04 17:02:25 +0200
commit45e4c665653cd511b0d96119d3973652c43238bb (patch)
treeb614bb895b59dfb2f27d1408d0ed7594c4182c73 /app/controllers/snippets_controller.rb
parent2d43f8a2f4b1352067755609c9e3110d382d06c6 (diff)
downloadgitlab-ce-adam-separate-slash-commands.tar.gz
Display slash commands outcome when previewing Markdownadam-separate-slash-commands
Remove slash commands from Markdown preview and display their outcome next to the text field. Introduce new "explanation" block to our slash commands DSL. Introduce optional "parse_params" block to slash commands DSL that allows to process a parameter before it is passed to "explanation" or "command" blocks. Pass path for previewing Markdown as "data" attribute instead of setting a variable on "window".
Diffstat (limited to 'app/controllers/snippets_controller.rb')
-rw-r--r--app/controllers/snippets_controller.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb
index da1ae9a34d9..afed27a41d1 100644
--- a/app/controllers/snippets_controller.rb
+++ b/app/controllers/snippets_controller.rb
@@ -3,7 +3,6 @@ class SnippetsController < ApplicationController
include ToggleAwardEmoji
include SpammableActions
include SnippetsActions
- include MarkdownPreview
include RendersBlob
before_action :snippet, only: [:show, :edit, :destroy, :update, :raw]
@@ -90,7 +89,14 @@ class SnippetsController < ApplicationController
end
def preview_markdown
- render_markdown_preview(params[:text], skip_project_check: true)
+ result = PreviewMarkdownService.new(@project, current_user, params).execute
+
+ render json: {
+ body: view_context.markdown(result[:text], skip_project_check: true),
+ references: {
+ users: result[:users]
+ }
+ }
end
protected