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
7844fa1f
Commit
7844fa1f
authored
May 13, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add auxiliary viewer for CONTRIBUTING
parent
67312fce
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
1 deletion
+37
-1
app/helpers/blob_helper.rb
app/helpers/blob_helper.rb
+15
-0
app/models/blob.rb
app/models/blob.rb
+3
-1
app/models/blob_viewer/contributing.rb
app/models/blob_viewer/contributing.rb
+10
-0
app/views/projects/blob/viewers/_contributing.html.haml
app/views/projects/blob/viewers/_contributing.html.haml
+9
-0
No files found.
app/helpers/blob_helper.rb
View file @
7844fa1f
...
...
@@ -278,4 +278,19 @@ module BlobHelper
options
end
def
contribution_options
(
project
)
options
=
[]
if
can?
(
current_user
,
:create_issue
,
project
)
options
<<
link_to
(
"submit an issue"
,
new_namespace_project_issue_path
(
project
.
namespace
,
project
))
end
merge_project
=
can?
(
current_user
,
:create_merge_request
,
project
)
?
project
:
(
current_user
&&
current_user
.
fork_of
(
project
))
if
merge_project
options
<<
link_to
(
"create a merge request"
,
new_namespace_project_merge_request_path
(
project
.
namespace
,
project
))
end
options
end
end
app/models/blob.rb
View file @
7844fa1f
...
...
@@ -39,7 +39,9 @@ class Blob < SimpleDelegator
AUXILIARY_VIEWERS
=
[
BlobViewer
::
GitlabCiYml
,
BlobViewer
::
RouteMap
,
BlobViewer
::
License
BlobViewer
::
License
,
BlobViewer
::
Contributing
].
freeze
attr_reader
:project
...
...
app/models/blob_viewer/contributing.rb
0 → 100644
View file @
7844fa1f
module
BlobViewer
class
Contributing
<
Base
include
Auxiliary
include
Static
self
.
partial_name
=
'contributing'
self
.
file_types
=
%i(contributing)
self
.
binary
=
false
end
end
app/views/projects/blob/viewers/_contributing.html.haml
0 → 100644
View file @
7844fa1f
=
icon
(
'book fw'
)
After you've reviewed these contribution guidelines, you'll be all set to
-
options
=
contribution_options
(
viewer
.
project
)
-
if
options
.
any?
=
succeed
'.'
do
=
options
.
to_sentence
(
two_words_connector:
' or '
,
last_word_connector:
', or '
).
html_safe
-
else
contribute to this project.
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