Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
b69f8a62
Commit
b69f8a62
authored
Mar 30, 2016
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specific markdown_preview route for Wikis
parent
4a01b5e2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
1 deletion
+20
-1
app/controllers/projects/wikis_controller.rb
app/controllers/projects/wikis_controller.rb
+14
-0
app/views/layouts/project.html.haml
app/views/layouts/project.html.haml
+5
-1
config/routes.rb
config/routes.rb
+1
-0
No files found.
app/controllers/projects/wikis_controller.rb
View file @
b69f8a62
...
...
@@ -88,6 +88,20 @@ class Projects::WikisController < Projects::ApplicationController
)
end
def
markdown_preview
text
=
params
[
:text
]
ext
=
Gitlab
::
ReferenceExtractor
.
new
(
@project
,
current_user
,
current_user
)
ext
.
analyze
(
text
)
render
json:
{
body:
view_context
.
markdown
(
text
,
pipeline: :wiki
,
project_wiki:
@project_wiki
),
references:
{
users:
ext
.
users
.
map
(
&
:username
)
}
}
end
def
git_access
end
...
...
app/views/layouts/project.html.haml
View file @
b69f8a62
...
...
@@ -5,10 +5,14 @@
-
content_for
:scripts_body_top
do
-
project
=
@target_project
||
@project
-
if
@project_wiki
-
markdown_preview_path
=
namespace_project_wikis_markdown_preview_path
(
project
.
namespace
,
project
)
-
else
-
markdown_preview_path
=
markdown_preview_namespace_project_path
(
project
.
namespace
,
project
)
-
if
current_user
:javascript
window
.
project_uploads_path
=
"
#{
namespace_project_uploads_path
project
.
namespace
,
project
}
"
;
window
.
markdown_preview_path
=
"
#{
markdown_preview_
namespace_project_path
(
project
.
namespace
,
project
)
}
"
;
window
.
markdown_preview_path
=
"
#{
markdown_preview_
path
}
"
;
-
content_for
:scripts_body
do
=
render
"layouts/init_auto_complete"
if
current_user
...
...
config/routes.rb
View file @
b69f8a62
...
...
@@ -575,6 +575,7 @@ Rails.application.routes.draw do
# Order matters to give priority to these matches
get
'/wikis/git_access'
,
to:
'wikis#git_access'
get
'/wikis/pages'
,
to:
'wikis#pages'
,
as:
'wiki_pages'
post
'/wikis/markdown_preview'
,
to
:'wikis#markdown_preview'
post
'/wikis'
,
to:
'wikis#create'
get
'/wikis/*id/history'
,
to:
'wikis#history'
,
as:
'wiki_history'
,
constraints:
WIKI_SLUG_ID
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment