Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarka Kadlecova <jarka@gitlab.com>2017-04-20 11:56:41 +0300
committerJarka Kadlecova <jarka@gitlab.com>2017-04-26 13:51:06 +0300
commit87327c5845a7feec92e546dc0da42282ac27de40 (patch)
tree87134624b3911bf49b2799fecd89f4a4334dc0c9 /app/controllers/projects/wikis_controller.rb
parenta9da37434af6d44c5f851affd4bd69b370760e8e (diff)
Support preview_markdown action for personal_snippets
Diffstat (limited to 'app/controllers/projects/wikis_controller.rb')
-rw-r--r--app/controllers/projects/wikis_controller.rb21
1 files changed, 7 insertions, 14 deletions
diff --git a/app/controllers/projects/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb
index c5e24b9e365..96125684da0 100644
--- a/app/controllers/projects/wikis_controller.rb
+++ b/app/controllers/projects/wikis_controller.rb
@@ -1,4 +1,6 @@
class Projects::WikisController < Projects::ApplicationController
+ include MarkdownPreview
+
before_action :authorize_read_wiki!
before_action :authorize_create_wiki!, only: [:edit, :create, :history]
before_action :authorize_admin_wiki!, only: :destroy
@@ -91,21 +93,13 @@ class Projects::WikisController < 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, pipeline: :wiki, project_wiki: @project_wiki, page_slug: params[:id]),
- references: {
- users: ext.users.map(&:username)
- }
- }
+ def git_access
end
- def git_access
+ def preview_markdown
+ context = { pipeline: :wiki, project_wiki: @project_wiki, page_slug: params[:id] }
+
+ render_markdown_preview(params[:text], context)
end
private
@@ -115,7 +109,6 @@ class Projects::WikisController < Projects::ApplicationController
# Call #wiki to make sure the Wiki Repo is initialized
@project_wiki.wiki
-
@sidebar_wiki_entries = WikiPage.group_by_directory(@project_wiki.pages.first(15))
rescue ProjectWiki::CouldNotCreateWikiError
flash[:notice] = "Could not create Wiki Repository at this time. Please try again later."