summaryrefslogtreecommitdiff
path: root/app/controllers/projects_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/projects_controller.rb')
-rw-r--r--app/controllers/projects_controller.rb19
1 files changed, 5 insertions, 14 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 6807c37f972..9f6ee4826e6 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -1,6 +1,7 @@
class ProjectsController < Projects::ApplicationController
include IssuableCollections
include ExtractsPath
+ include MarkdownPreview
before_action :authenticate_user!, except: [:index, :show, :activity, :refs]
before_action :project, except: [:index, :new, :create]
@@ -216,20 +217,6 @@ class ProjectsController < Projects::ApplicationController
}
end
- def preview_markdown
- text = params[:text]
-
- ext = Gitlab::ReferenceExtractor.new(@project, current_user)
- ext.analyze(text, author: current_user)
-
- render json: {
- body: view_context.markdown(text),
- references: {
- users: ext.users.map(&:username)
- }
- }
- end
-
def refs
branches = BranchesFinder.new(@repository, params).execute.map(&:name)
@@ -252,6 +239,10 @@ class ProjectsController < Projects::ApplicationController
render json: options.to_json
end
+ def preview_markdown
+ render_markdown_preview(params[:text])
+ end
+
private
# Render project landing depending of which features are available