Commit 42814500 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'dm-contributing-viewer' into 'master'

Add auxiliary blob viewer for CONTRIBUTING

See merge request !11364
parents 433070dc 7844fa1f
...@@ -278,4 +278,19 @@ module BlobHelper ...@@ -278,4 +278,19 @@ module BlobHelper
options options
end 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 end
...@@ -39,7 +39,9 @@ class Blob < SimpleDelegator ...@@ -39,7 +39,9 @@ class Blob < SimpleDelegator
AUXILIARY_VIEWERS = [ AUXILIARY_VIEWERS = [
BlobViewer::GitlabCiYml, BlobViewer::GitlabCiYml,
BlobViewer::RouteMap, BlobViewer::RouteMap,
BlobViewer::License
BlobViewer::License,
BlobViewer::Contributing
].freeze ].freeze
attr_reader :project attr_reader :project
......
module BlobViewer
class Contributing < Base
include Auxiliary
include Static
self.partial_name = 'contributing'
self.file_types = %i(contributing)
self.binary = false
end
end
= 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.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment