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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
589776fc
Commit
589776fc
authored
Sep 04, 2018
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move logic into legacy_render_context helper method
parent
a963721f
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
25 additions
and
16 deletions
+25
-16
app/helpers/markup_helper.rb
app/helpers/markup_helper.rb
+2
-2
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+4
-0
app/views/projects/_wiki.html.haml
app/views/projects/_wiki.html.haml
+1
-2
app/views/projects/blob/preview.html.haml
app/views/projects/blob/preview.html.haml
+1
-2
app/views/projects/blob/viewers/_markup.html.haml
app/views/projects/blob/viewers/_markup.html.haml
+2
-4
app/views/projects/wikis/_sidebar.html.haml
app/views/projects/wikis/_sidebar.html.haml
+1
-2
app/views/projects/wikis/show.html.haml
app/views/projects/wikis/show.html.haml
+1
-2
app/views/search/results/_snippet_blob.html.haml
app/views/search/results/_snippet_blob.html.haml
+1
-2
spec/helpers/projects_helper_spec.rb
spec/helpers/projects_helper_spec.rb
+12
-0
No files found.
app/helpers/markup_helper.rb
View file @
589776fc
...
@@ -115,13 +115,13 @@ module MarkupHelper
...
@@ -115,13 +115,13 @@ module MarkupHelper
text
=
wiki_page
.
content
text
=
wiki_page
.
content
return
''
unless
text
.
present?
return
''
unless
text
.
present?
context
.
merge!
(
{
context
.
merge!
(
pipeline: :wiki
,
pipeline: :wiki
,
project:
@project
,
project:
@project
,
project_wiki:
@project_wiki
,
project_wiki:
@project_wiki
,
page_slug:
wiki_page
.
slug
,
page_slug:
wiki_page
.
slug
,
issuable_state_filter_enabled:
true
issuable_state_filter_enabled:
true
}
)
)
html
=
html
=
case
wiki_page
.
format
case
wiki_page
.
format
...
...
app/helpers/projects_helper.rb
View file @
589776fc
...
@@ -252,6 +252,10 @@ module ProjectsHelper
...
@@ -252,6 +252,10 @@ module ProjectsHelper
"xcode://clone?repo=
#{
CGI
.
escape
(
default_url_to_repo
(
project
))
}
"
"xcode://clone?repo=
#{
CGI
.
escape
(
default_url_to_repo
(
project
))
}
"
end
end
def
legacy_render_context
(
params
)
params
[
:legacy_render
]
?
{
markdown_engine: :redcarpet
}
:
{}
end
private
private
def
get_project_nav_tabs
(
project
,
current_user
)
def
get_project_nav_tabs
(
project
,
current_user
)
...
...
app/views/projects/_wiki.html.haml
View file @
589776fc
...
@@ -2,8 +2,7 @@
...
@@ -2,8 +2,7 @@
%div
{
class:
container_class
}
%div
{
class:
container_class
}
.prepend-top-default.append-bottom-default
.prepend-top-default.append-bottom-default
.wiki
.wiki
-
context
=
params
[
:legacy_render
]
?
{
markdown_engine: :redcarpet
}
:
{}
=
render_wiki_content
(
@wiki_home
,
legacy_render_context
(
params
))
=
render_wiki_content
(
@wiki_home
,
context
)
-
else
-
else
-
can_create_wiki
=
can?
(
current_user
,
:create_wiki
,
@project
)
-
can_create_wiki
=
can?
(
current_user
,
:create_wiki
,
@project
)
.project-home-empty
{
class:
[(
'row-content-block'
if
can_create_wiki
),
(
'content-block'
unless
can_create_wiki
)]
}
.project-home-empty
{
class:
[(
'row-content-block'
if
can_create_wiki
),
(
'content-block'
unless
can_create_wiki
)]
}
...
...
app/views/projects/blob/preview.html.haml
View file @
589776fc
...
@@ -2,8 +2,7 @@
...
@@ -2,8 +2,7 @@
.diff-content
.diff-content
-
if
markup?
(
@blob
.
name
)
-
if
markup?
(
@blob
.
name
)
.file-content.wiki
.file-content.wiki
-
context
=
params
[
:legacy_render
]
?
{
markdown_engine: :redcarpet
}
:
{}
=
markup
(
@blob
.
name
,
@content
,
legacy_render_context
(
params
))
=
markup
(
@blob
.
name
,
@content
,
context
)
-
else
-
else
.file-content.code.js-syntax-highlight
.file-content.code.js-syntax-highlight
-
unless
@diff_lines
.
empty?
-
unless
@diff_lines
.
empty?
...
...
app/views/projects/blob/viewers/_markup.html.haml
View file @
589776fc
-
blob
=
viewer
.
blob
-
blob
=
viewer
.
blob
-
context
=
{}
-
context
=
legacy_render_context
(
params
)
-
if
params
[
:legacy_render
]
-
unless
context
[
:markdown_engine
]
==
:redcarpet
-
context
[
:markdown_engine
]
=
:redcarpet
-
else
-
context
[
:rendered
]
=
blob
.
rendered_markup
if
blob
.
respond_to?
(
:rendered_markup
)
-
context
[
:rendered
]
=
blob
.
rendered_markup
if
blob
.
respond_to?
(
:rendered_markup
)
.file-content.wiki
.file-content.wiki
=
markup
(
blob
.
name
,
blob
.
data
,
context
)
=
markup
(
blob
.
name
,
blob
.
data
,
context
)
app/views/projects/wikis/_sidebar.html.haml
View file @
589776fc
...
@@ -12,8 +12,7 @@
...
@@ -12,8 +12,7 @@
.blocks-container
.blocks-container
.block.block-first
.block.block-first
-
if
@sidebar_page
-
if
@sidebar_page
-
context
=
params
[
:legacy_render
]
?
{
markdown_engine: :redcarpet
}
:
{}
=
render_wiki_content
(
@sidebar_page
,
legacy_render_context
(
params
))
=
render_wiki_content
(
@sidebar_page
,
context
)
-
else
-
else
%ul
.wiki-pages
%ul
.wiki-pages
=
render
@sidebar_wiki_entries
,
context:
'sidebar'
=
render
@sidebar_wiki_entries
,
context:
'sidebar'
...
...
app/views/projects/wikis/show.html.haml
View file @
589776fc
...
@@ -26,7 +26,6 @@
...
@@ -26,7 +26,6 @@
.prepend-top-default.append-bottom-default
.prepend-top-default.append-bottom-default
.wiki
.wiki
-
context
=
params
[
:legacy_render
]
?
{
markdown_engine: :redcarpet
}
:
{}
=
render_wiki_content
(
@page
,
legacy_render_context
(
params
))
=
render_wiki_content
(
@page
,
context
)
=
render
'sidebar'
=
render
'sidebar'
app/views/search/results/_snippet_blob.html.haml
View file @
589776fc
...
@@ -21,8 +21,7 @@
...
@@ -21,8 +21,7 @@
.file-content.wiki
.file-content.wiki
-
snippet_chunks
.
each
do
|
chunk
|
-
snippet_chunks
.
each
do
|
chunk
|
-
unless
chunk
[
:data
].
empty?
-
unless
chunk
[
:data
].
empty?
-
context
=
params
[
:legacy_render
]
?
{
markdown_engine: :redcarpet
}
:
{}
=
markup
(
snippet
.
file_name
,
chunk
[
:data
],
legacy_render_context
(
params
))
=
markup
(
snippet
.
file_name
,
chunk
[
:data
],
context
)
-
else
-
else
.file-content.code
.file-content.code
.nothing-here-block
Empty file
.nothing-here-block
Empty file
...
...
spec/helpers/projects_helper_spec.rb
View file @
589776fc
...
@@ -470,4 +470,16 @@ describe ProjectsHelper do
...
@@ -470,4 +470,16 @@ describe ProjectsHelper do
end
end
end
end
end
end
describe
'#legacy_render_context'
do
it
'returns the redcarpet engine'
do
params
=
{
legacy_render:
'1'
}
expect
(
helper
.
legacy_render_context
(
params
)).
to
include
(
markdown_engine: :redcarpet
)
end
it
'returns nothing'
do
expect
(
helper
.
legacy_render_context
({})).
to
be_empty
end
end
end
end
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