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
Léo-Paul Géneau
gitlab-ce
Commits
3d2b663e
Commit
3d2b663e
authored
Apr 28, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dm-pull-preserve-into-render-helpers' into 'master'
Pull preserve into render helpers See merge request !10986
parents
bb3870ea
0be3187a
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
26 additions
and
39 deletions
+26
-39
app/helpers/markup_helper.rb
app/helpers/markup_helper.rb
+9
-8
app/views/help/index.html.haml
app/views/help/index.html.haml
+1
-2
app/views/projects/_wiki.html.haml
app/views/projects/_wiki.html.haml
+1
-2
app/views/projects/issues/show.html.haml
app/views/projects/issues/show.html.haml
+1
-2
app/views/projects/merge_requests/show/_mr_box.html.haml
app/views/projects/merge_requests/show/_mr_box.html.haml
+1
-2
app/views/projects/milestones/show.html.haml
app/views/projects/milestones/show.html.haml
+1
-2
app/views/projects/notes/_note.html.haml
app/views/projects/notes/_note.html.haml
+1
-2
app/views/projects/tags/_tag.html.haml
app/views/projects/tags/_tag.html.haml
+1
-2
app/views/projects/tags/show.html.haml
app/views/projects/tags/show.html.haml
+1
-2
app/views/projects/wikis/show.html.haml
app/views/projects/wikis/show.html.haml
+1
-2
app/views/search/results/_issue.html.haml
app/views/search/results/_issue.html.haml
+1
-2
app/views/search/results/_merge_request.html.haml
app/views/search/results/_merge_request.html.haml
+1
-2
app/views/search/results/_milestone.html.haml
app/views/search/results/_milestone.html.haml
+1
-2
app/views/search/results/_note.html.haml
app/views/search/results/_note.html.haml
+1
-2
app/views/shared/_service_settings.html.haml
app/views/shared/_service_settings.html.haml
+1
-2
features/steps/project/commits/commits.rb
features/steps/project/commits/commits.rb
+1
-1
spec/features/atom/users_spec.rb
spec/features/atom/users_spec.rb
+1
-1
spec/helpers/events_helper_spec.rb
spec/helpers/events_helper_spec.rb
+1
-1
No files found.
app/helpers/markup_helper.rb
View file @
3d2b663e
...
@@ -74,7 +74,7 @@ module MarkupHelper
...
@@ -74,7 +74,7 @@ module MarkupHelper
context
[
:project
]
||=
@project
context
[
:project
]
||=
@project
html
=
markdown_unsafe
(
text
,
context
)
html
=
markdown_unsafe
(
text
,
context
)
banzai_postprocess
(
html
,
context
)
prepare_for_rendering
(
html
,
context
)
end
end
def
markdown_field
(
object
,
field
)
def
markdown_field
(
object
,
field
)
...
@@ -82,13 +82,13 @@ module MarkupHelper
...
@@ -82,13 +82,13 @@ module MarkupHelper
return
''
unless
object
.
present?
return
''
unless
object
.
present?
html
=
Banzai
.
render_field
(
object
,
field
)
html
=
Banzai
.
render_field
(
object
,
field
)
banzai_postprocess
(
html
,
object
.
banzai_render_context
(
field
))
prepare_for_rendering
(
html
,
object
.
banzai_render_context
(
field
))
end
end
def
markup
(
file_name
,
text
,
context
=
{})
def
markup
(
file_name
,
text
,
context
=
{})
context
[
:project
]
||=
@project
context
[
:project
]
||=
@project
html
=
context
.
delete
(
:rendered
)
||
markup_unsafe
(
file_name
,
text
,
context
)
html
=
context
.
delete
(
:rendered
)
||
markup_unsafe
(
file_name
,
text
,
context
)
banzai_postprocess
(
html
,
context
)
prepare_for_rendering
(
html
,
context
)
end
end
def
render_wiki_content
(
wiki_page
)
def
render_wiki_content
(
wiki_page
)
...
@@ -107,14 +107,14 @@ module MarkupHelper
...
@@ -107,14 +107,14 @@ module MarkupHelper
wiki_page
.
formatted_content
.
html_safe
wiki_page
.
formatted_content
.
html_safe
end
end
banzai_postprocess
(
html
,
context
)
prepare_for_rendering
(
html
,
context
)
end
end
def
markup_unsafe
(
file_name
,
text
,
context
=
{})
def
markup_unsafe
(
file_name
,
text
,
context
=
{})
return
''
unless
text
.
present?
return
''
unless
text
.
present?
if
gitlab_markdown?
(
file_name
)
if
gitlab_markdown?
(
file_name
)
Hamlit
::
RailsHelpers
.
preserve
(
markdown_unsafe
(
text
,
context
)
)
markdown_unsafe
(
text
,
context
)
elsif
asciidoc?
(
file_name
)
elsif
asciidoc?
(
file_name
)
asciidoc_unsafe
(
text
)
asciidoc_unsafe
(
text
)
elsif
plain?
(
file_name
)
elsif
plain?
(
file_name
)
...
@@ -225,8 +225,7 @@ module MarkupHelper
...
@@ -225,8 +225,7 @@ module MarkupHelper
Gitlab
::
OtherMarkup
.
render
(
file_name
,
text
)
Gitlab
::
OtherMarkup
.
render
(
file_name
,
text
)
end
end
# Calls Banzai.post_process with some common context options
def
prepare_for_rendering
(
html
,
context
=
{})
def
banzai_postprocess
(
html
,
context
=
{})
return
''
unless
html
.
present?
return
''
unless
html
.
present?
context
.
merge!
(
context
.
merge!
(
...
@@ -239,7 +238,9 @@ module MarkupHelper
...
@@ -239,7 +238,9 @@ module MarkupHelper
requested_path:
@path
requested_path:
@path
)
)
Banzai
.
post_process
(
html
,
context
)
html
=
Banzai
.
post_process
(
html
,
context
)
Hamlit
::
RailsHelpers
.
preserve
(
html
)
end
end
extend
self
extend
self
...
...
app/views/help/index.html.haml
View file @
3d2b663e
...
@@ -27,8 +27,7 @@
...
@@ -27,8 +27,7 @@
.row
.row
.col-md-8
.col-md-8
.documentation-index
.documentation-index
=
preserve
do
=
markdown
(
@help_index
)
=
markdown
(
@help_index
)
.col-md-4
.col-md-4
.panel.panel-default
.panel.panel-default
.panel-heading
.panel-heading
...
...
app/views/projects/_wiki.html.haml
View file @
3d2b663e
...
@@ -2,8 +2,7 @@
...
@@ -2,8 +2,7 @@
%div
{
class:
container_class
}
%div
{
class:
container_class
}
.wiki-holder.prepend-top-default.append-bottom-default
.wiki-holder.prepend-top-default.append-bottom-default
.wiki
.wiki
=
preserve
do
=
render_wiki_content
(
@wiki_home
)
=
render_wiki_content
(
@wiki_home
)
-
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/issues/show.html.haml
View file @
3d2b663e
...
@@ -58,8 +58,7 @@
...
@@ -58,8 +58,7 @@
-
if
@issue
.
description
.
present?
-
if
@issue
.
description
.
present?
.description
{
class:
can?
(
current_user
,
:update_issue
,
@issue
)
?
'js-task-list-container'
:
''
}
.description
{
class:
can?
(
current_user
,
:update_issue
,
@issue
)
?
'js-task-list-container'
:
''
}
.wiki
.wiki
=
preserve
do
=
markdown_field
(
@issue
,
:description
)
=
markdown_field
(
@issue
,
:description
)
%textarea
.hidden.js-task-list-field
%textarea
.hidden.js-task-list-field
=
@issue
.
description
=
@issue
.
description
=
edited_time_ago_with_tooltip
(
@issue
,
placement:
'bottom'
,
html_class:
'issue_edited_ago'
)
=
edited_time_ago_with_tooltip
(
@issue
,
placement:
'bottom'
,
html_class:
'issue_edited_ago'
)
...
...
app/views/projects/merge_requests/show/_mr_box.html.haml
View file @
3d2b663e
...
@@ -6,8 +6,7 @@
...
@@ -6,8 +6,7 @@
-
if
@merge_request
.
description
.
present?
-
if
@merge_request
.
description
.
present?
.description
{
class:
can?
(
current_user
,
:update_merge_request
,
@merge_request
)
?
'js-task-list-container'
:
''
}
.description
{
class:
can?
(
current_user
,
:update_merge_request
,
@merge_request
)
?
'js-task-list-container'
:
''
}
.wiki
.wiki
=
preserve
do
=
markdown_field
(
@merge_request
,
:description
)
=
markdown_field
(
@merge_request
,
:description
)
%textarea
.hidden.js-task-list-field
%textarea
.hidden.js-task-list-field
=
@merge_request
.
description
=
@merge_request
.
description
...
...
app/views/projects/milestones/show.html.haml
View file @
3d2b663e
...
@@ -43,8 +43,7 @@
...
@@ -43,8 +43,7 @@
-
if
@milestone
.
description
.
present?
-
if
@milestone
.
description
.
present?
.description
.description
.wiki
.wiki
=
preserve
do
=
markdown_field
(
@milestone
,
:description
)
=
markdown_field
(
@milestone
,
:description
)
-
if
can?
(
current_user
,
:read_issue
,
@project
)
&&
@milestone
.
total_items_count
(
current_user
).
zero?
-
if
can?
(
current_user
,
:read_issue
,
@project
)
&&
@milestone
.
total_items_count
(
current_user
).
zero?
.alert.alert-success.prepend-top-default
.alert.alert-success.prepend-top-default
...
...
app/views/projects/notes/_note.html.haml
View file @
3d2b663e
...
@@ -75,8 +75,7 @@
...
@@ -75,8 +75,7 @@
=
icon
(
'trash-o'
,
class:
'danger-highlight'
)
=
icon
(
'trash-o'
,
class:
'danger-highlight'
)
.note-body
{
class:
note_editable
?
'js-task-list-container'
:
''
}
.note-body
{
class:
note_editable
?
'js-task-list-container'
:
''
}
.note-text.md
.note-text.md
=
preserve
do
=
note
.
redacted_note_html
=
note
.
redacted_note_html
=
edited_time_ago_with_tooltip
(
note
,
placement:
'bottom'
,
html_class:
'note_edited_ago'
,
include_author:
true
)
=
edited_time_ago_with_tooltip
(
note
,
placement:
'bottom'
,
html_class:
'note_edited_ago'
,
include_author:
true
)
-
if
note_editable
-
if
note_editable
.original-note-content.hidden
{
data:
{
post_url:
namespace_project_note_path
(
@project
.
namespace
,
@project
,
note
),
target_id:
note
.
noteable
.
id
,
target_type:
note
.
noteable
.
class
.
name
.
underscore
}
}
.original-note-content.hidden
{
data:
{
post_url:
namespace_project_note_path
(
@project
.
namespace
,
@project
,
note
),
target_id:
note
.
noteable
.
id
,
target_type:
note
.
noteable
.
class
.
name
.
underscore
}
}
...
...
app/views/projects/tags/_tag.html.haml
View file @
3d2b663e
...
@@ -24,8 +24,7 @@
...
@@ -24,8 +24,7 @@
-
if
release
&&
release
.
description
.
present?
-
if
release
&&
release
.
description
.
present?
.description.prepend-top-default
.description.prepend-top-default
.wiki
.wiki
=
preserve
do
=
markdown_field
(
release
,
:description
)
=
markdown_field
(
release
,
:description
)
.row-fixed-content.controls
.row-fixed-content.controls
=
render
'projects/buttons/download'
,
project:
@project
,
ref:
tag
.
name
,
pipeline:
@tags_pipelines
[
tag
.
name
]
=
render
'projects/buttons/download'
,
project:
@project
,
ref:
tag
.
name
,
pipeline:
@tags_pipelines
[
tag
.
name
]
...
...
app/views/projects/tags/show.html.haml
View file @
3d2b663e
...
@@ -38,7 +38,6 @@
...
@@ -38,7 +38,6 @@
-
if
@release
.
description
.
present?
-
if
@release
.
description
.
present?
.description
.description
.wiki
.wiki
=
preserve
do
=
markdown_field
(
@release
,
:description
)
=
markdown_field
(
@release
,
:description
)
-
else
-
else
This tag has no release notes.
This tag has no release notes.
app/views/projects/wikis/show.html.haml
View file @
3d2b663e
...
@@ -27,7 +27,6 @@
...
@@ -27,7 +27,6 @@
.wiki-holder.prepend-top-default.append-bottom-default
.wiki-holder.prepend-top-default.append-bottom-default
.wiki
.wiki
=
preserve
do
=
render_wiki_content
(
@page
)
=
render_wiki_content
(
@page
)
=
render
'sidebar'
=
render
'sidebar'
app/views/search/results/_issue.html.haml
View file @
3d2b663e
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
.pull-right
##{issue.iid}
.pull-right
##{issue.iid}
-
if
issue
.
description
.
present?
-
if
issue
.
description
.
present?
.description.term
.description.term
=
preserve
do
=
search_md_sanitize
(
issue
,
:description
)
=
search_md_sanitize
(
issue
,
:description
)
%span
.light
%span
.light
#{
issue
.
project
.
name_with_namespace
}
#{
issue
.
project
.
name_with_namespace
}
app/views/search/results/_merge_request.html.haml
View file @
3d2b663e
...
@@ -9,7 +9,6 @@
...
@@ -9,7 +9,6 @@
.pull-right
=
merge_request
.
to_reference
.pull-right
=
merge_request
.
to_reference
-
if
merge_request
.
description
.
present?
-
if
merge_request
.
description
.
present?
.description.term
.description.term
=
preserve
do
=
search_md_sanitize
(
merge_request
,
:description
)
=
search_md_sanitize
(
merge_request
,
:description
)
%span
.light
%span
.light
#{
merge_request
.
project
.
name_with_namespace
}
#{
merge_request
.
project
.
name_with_namespace
}
app/views/search/results/_milestone.html.haml
View file @
3d2b663e
...
@@ -5,5 +5,4 @@
...
@@ -5,5 +5,4 @@
-
if
milestone
.
description
.
present?
-
if
milestone
.
description
.
present?
.description.term
.description.term
=
preserve
do
=
search_md_sanitize
(
milestone
,
:description
)
=
search_md_sanitize
(
milestone
,
:description
)
app/views/search/results/_note.html.haml
View file @
3d2b663e
...
@@ -22,5 +22,4 @@
...
@@ -22,5 +22,4 @@
.note-search-result
.note-search-result
.term
.term
=
preserve
do
=
search_md_sanitize
(
note
,
:note
)
=
search_md_sanitize
(
note
,
:note
)
app/views/shared/_service_settings.html.haml
View file @
3d2b663e
...
@@ -4,8 +4,7 @@
...
@@ -4,8 +4,7 @@
=
render
"projects/services/
#{
@service
.
to_param
}
/help"
,
subject:
subject
=
render
"projects/services/
#{
@service
.
to_param
}
/help"
,
subject:
subject
-
elsif
@service
.
help
.
present?
-
elsif
@service
.
help
.
present?
.well
.well
=
preserve
do
=
markdown
@service
.
help
=
markdown
@service
.
help
.service-settings
.service-settings
.form-group
.form-group
...
...
features/steps/project/commits/commits.rb
View file @
3d2b663e
...
@@ -21,7 +21,7 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
...
@@ -21,7 +21,7 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
expect
(
response_headers
[
'Content-Type'
]).
to
have_content
(
"application/atom+xml"
)
expect
(
response_headers
[
'Content-Type'
]).
to
have_content
(
"application/atom+xml"
)
expect
(
body
).
to
have_selector
(
"title"
,
text:
"
#{
@project
.
name
}
:master commits"
)
expect
(
body
).
to
have_selector
(
"title"
,
text:
"
#{
@project
.
name
}
:master commits"
)
expect
(
body
).
to
have_selector
(
"author email"
,
text:
commit
.
author_email
)
expect
(
body
).
to
have_selector
(
"author email"
,
text:
commit
.
author_email
)
expect
(
body
).
to
have_selector
(
"entry summary"
,
text:
commit
.
description
[
0
..
10
].
delete
(
"
\r
"
))
expect
(
body
).
to
have_selector
(
"entry summary"
,
text:
commit
.
description
[
0
..
10
].
delete
(
"
\r
\n
"
))
end
end
step
'I click on tag link'
do
step
'I click on tag link'
do
...
...
spec/features/atom/users_spec.rb
View file @
3d2b663e
...
@@ -53,7 +53,7 @@ describe "User Feed", feature: true do
...
@@ -53,7 +53,7 @@ describe "User Feed", feature: true do
end
end
it
'has XHTML summaries in issue descriptions'
do
it
'has XHTML summaries in issue descriptions'
do
expect
(
body
).
to
match
/
we have a bug!<\/p>\n\n<hr ?\/>\n\n<p dir="auto">I guess
/
expect
(
body
).
to
match
/
<hr ?\/>
/
end
end
it
'has XHTML summaries in notes'
do
it
'has XHTML summaries in notes'
do
...
...
spec/helpers/events_helper_spec.rb
View file @
3d2b663e
...
@@ -56,7 +56,7 @@ describe EventsHelper do
...
@@ -56,7 +56,7 @@ describe EventsHelper do
it
'preserves code color scheme'
do
it
'preserves code color scheme'
do
input
=
"```ruby
\n
def test
\n
'hello world'
\n
end
\n
```"
input
=
"```ruby
\n
def test
\n
'hello world'
\n
end
\n
```"
expected
=
'<pre class="code highlight js-syntax-highlight ruby">'
\
expected
=
"
\n
<pre class=
\"
code highlight js-syntax-highlight ruby
\"
>"
\
"<code><span class=
\"
line
\"
><span class=
\"
k
\"
>def</span> <span class=
\"
nf
\"
>test</span>...</span>
\n
"
\
"<code><span class=
\"
line
\"
><span class=
\"
k
\"
>def</span> <span class=
\"
nf
\"
>test</span>...</span>
\n
"
\
"</code></pre>"
"</code></pre>"
expect
(
helper
.
event_note
(
input
)).
to
eq
(
expected
)
expect
(
helper
.
event_note
(
input
)).
to
eq
(
expected
)
...
...
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