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
Kazuhiko Shiozaki
gitlab-ce
Commits
d7701a26
Commit
d7701a26
authored
Aug 11, 2014
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move calls to Gitlab::MarkdownHelper to application_helper
parent
99eb2831
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
13 deletions
+21
-13
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+8
-0
app/helpers/tree_helper.rb
app/helpers/tree_helper.rb
+3
-4
app/models/tree.rb
app/models/tree.rb
+3
-2
app/views/projects/blob/_text.html.haml
app/views/projects/blob/_text.html.haml
+2
-2
app/views/projects/edit_tree/preview.html.haml
app/views/projects/edit_tree/preview.html.haml
+3
-3
app/views/shared/snippets/_blob.html.haml
app/views/shared/snippets/_blob.html.haml
+2
-2
No files found.
app/helpers/application_helper.rb
View file @
d7701a26
...
...
@@ -226,6 +226,14 @@ module ApplicationHelper
simple_format
(
file_content
)
end
def
markup?
(
filename
)
Gitlab
::
MarkdownHelper
.
markup?
(
filename
)
end
def
gitlab_markdown?
(
filename
)
Gitlab
::
MarkdownHelper
.
gitlab_markdown?
(
filename
)
end
def
spinner
(
text
=
nil
,
visible
=
false
)
css_class
=
"loading"
css_class
<<
" hide"
unless
visible
...
...
app/helpers/tree_helper.rb
View file @
d7701a26
...
...
@@ -22,9 +22,9 @@ module TreeHelper
end
def
render_readme
(
readme
)
if
Gitlab
::
MarkdownHelper
.
gitlab_markdown?
(
readme
.
name
)
if
gitlab_markdown?
(
readme
.
name
)
preserve
(
markdown
(
readme
.
data
))
elsif
Gitlab
::
MarkdownHelper
.
markup?
(
readme
.
name
)
elsif
markup?
(
readme
.
name
)
render_markup
(
readme
.
name
,
readme
.
data
)
else
simple_format
(
readme
.
data
)
...
...
@@ -90,8 +90,7 @@ module TreeHelper
end
def
editing_preview_title
(
filename
)
if
Gitlab
::
MarkdownHelper
.
gitlab_markdown?
(
filename
)
||
Gitlab
::
MarkdownHelper
.
markup?
(
filename
)
if
gitlab_markdown?
(
filename
)
||
markup?
(
filename
)
'Preview'
else
'Diff'
...
...
app/models/tree.rb
View file @
d7701a26
class
Tree
include
Gitlab
::
MarkdownHelper
attr_accessor
:entries
,
:readme
,
:contribution_guide
def
initialize
(
repository
,
sha
,
path
=
'/'
)
...
...
@@ -13,8 +15,7 @@ class Tree
# by markup renderer.
if
available_readmes
.
length
>
1
supported_readmes
=
available_readmes
.
select
do
|
readme
|
Gitlab
::
MarkdownHelper
.
gitlab_markdown?
(
readme
.
name
)
||
Gitlab
::
MarkdownHelper
.
markup?
(
readme
.
name
)
gitlab_markdown?
(
readme
.
name
)
||
markup?
(
readme
.
name
)
end
# Take the first supported readme, or the first available readme, if we
...
...
app/views/projects/blob/_text.html.haml
View file @
d7701a26
-
if
Gitlab
::
MarkdownHelper
.
gitlab_markdown?
(
blob
.
name
)
-
if
gitlab_markdown?
(
blob
.
name
)
.file-content.wiki
=
preserve
do
=
markdown
(
blob
.
data
)
-
elsif
Gitlab
::
MarkdownHelper
.
markup?
(
blob
.
name
)
-
elsif
markup?
(
blob
.
name
)
.file-content.wiki
=
render_markup
(
blob
.
name
,
blob
.
data
)
-
else
...
...
app/views/projects/edit_tree/preview.html.haml
View file @
d7701a26
.diff-file
.diff-content
-
if
Gitlab
::
MarkdownHelper
.
gitlab_markdown?
(
@blob
.
name
)
-
if
gitlab_markdown?
(
@blob
.
name
)
.file-content.wiki
=
preserve
do
=
markdown
(
@content
)
-
elsif
Gitlab
::
MarkdownHelper
.
markup?
(
@blob
.
name
)
-
elsif
markup?
(
@blob
.
name
)
.file-content.wiki
=
raw
GitHub
::
Markup
.
render
(
@blob
.
name
,
@content
)
=
raw
render_markup
(
@blob
.
name
,
@content
)
-
else
.file-content.code
-
unless
@diff
.
empty?
...
...
app/views/shared/snippets/_blob.html.haml
View file @
d7701a26
-
unless
@snippet
.
content
.
empty?
-
if
Gitlab
::
MarkdownHelper
.
gitlab_markdown?
(
@snippet
.
file_name
)
-
if
gitlab_markdown?
(
@snippet
.
file_name
)
.file-content.wiki
=
preserve
do
=
markdown
(
@snippet
.
data
)
-
elsif
Gitlab
::
MarkdownHelper
.
markup?
(
@snippet
.
file_name
)
-
elsif
markup?
(
@snippet
.
file_name
)
.file-content.wiki
=
render_markup
(
@snippet
.
file_name
,
@snippet
.
data
)
-
else
...
...
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