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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
7bcd6f79
Commit
7bcd6f79
authored
Oct 07, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7963 from cirosantilli/factor-previewable
Factor markup? || gitlab_markdown? into new method
parents
d790b2cb
07e9cb6b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
2 deletions
+6
-2
app/helpers/tree_helper.rb
app/helpers/tree_helper.rb
+1
-1
app/models/tree.rb
app/models/tree.rb
+1
-1
lib/gitlab/markdown_helper.rb
lib/gitlab/markdown_helper.rb
+4
-0
No files found.
app/helpers/tree_helper.rb
View file @
7bcd6f79
...
@@ -90,7 +90,7 @@ module TreeHelper
...
@@ -90,7 +90,7 @@ module TreeHelper
end
end
def
editing_preview_title
(
filename
)
def
editing_preview_title
(
filename
)
if
gitlab_markdown?
(
filename
)
||
markup
?
(
filename
)
if
Gitlab
::
MarkdownHelper
.
previewable
?
(
filename
)
'Preview'
'Preview'
else
else
'Diff'
'Diff'
...
...
app/models/tree.rb
View file @
7bcd6f79
...
@@ -15,7 +15,7 @@ class Tree
...
@@ -15,7 +15,7 @@ class Tree
# by markup renderer.
# by markup renderer.
if
available_readmes
.
length
>
1
if
available_readmes
.
length
>
1
supported_readmes
=
available_readmes
.
select
do
|
readme
|
supported_readmes
=
available_readmes
.
select
do
|
readme
|
gitlab_markdown?
(
readme
.
name
)
||
markup
?
(
readme
.
name
)
previewable
?
(
readme
.
name
)
end
end
# Take the first supported readme, or the first available readme, if we
# Take the first supported readme, or the first available readme, if we
...
...
lib/gitlab/markdown_helper.rb
View file @
7bcd6f79
...
@@ -21,5 +21,9 @@ module Gitlab
...
@@ -21,5 +21,9 @@ module Gitlab
def
gitlab_markdown?
(
filename
)
def
gitlab_markdown?
(
filename
)
filename
.
downcase
.
end_with?
(
*
%w(.mdown .md .markdown)
)
filename
.
downcase
.
end_with?
(
*
%w(.mdown .md .markdown)
)
end
end
def
previewable?
(
filename
)
gitlab_markdown?
(
filename
)
||
markup?
(
filename
)
end
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