diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-08-03 11:05:19 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-08-03 11:05:19 +0200 |
commit | cc4405db7d90cbb25778b335138b1401f9060db6 (patch) | |
tree | f44339d2eaa389c17c1b92902e1d3d331aafa381 /app | |
parent | c1c89500f39b0bc3a77e016a11a8041e63871c80 (diff) | |
parent | f71d67dda172a996b23b541b0e26c2c7edc06072 (diff) | |
download | gitlab-ce-cc4405db7d90cbb25778b335138b1401f9060db6.tar.gz |
Merge branch 'add-license'
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/stylesheets/pages/projects.scss | 9 | ||||
-rw-r--r-- | app/helpers/projects_helper.rb | 44 | ||||
-rw-r--r-- | app/views/projects/show.html.haml | 21 | ||||
-rw-r--r-- | app/views/shared/issuable/_form.html.haml | 2 |
4 files changed, 68 insertions, 8 deletions
diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss index 5f415f2d78f..21d958db80c 100644 --- a/app/assets/stylesheets/pages/projects.scss +++ b/app/assets/stylesheets/pages/projects.scss @@ -297,6 +297,15 @@ table.table.protected-branches-list tr.no-border { ul.nav-pills { display:inline-block; } li { display:inline; } a { float:left; } + + li.missing a { + color: #bbb; + border: 1px dashed #ccc; + + &:hover { + background-color: #FAFAFA; + } + } } pre.light-well { diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index a675a292432..f5b78533896 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -184,7 +184,43 @@ module ProjectsHelper end end - def contribution_guide_url(project) + def add_contribution_guide_path(project) + if project && !project.repository.contribution_guide + namespace_project_new_blob_path( + project.namespace, + project, + project.default_branch, + file_name: "CONTRIBUTING.md", + commit_message: "Add contribution guide" + ) + end + end + + def add_changelog_path(project) + if project && !project.repository.changelog + namespace_project_new_blob_path( + project.namespace, + project, + project.default_branch, + file_name: "CHANGELOG", + commit_message: "Add changelog" + ) + end + end + + def add_license_path(project) + if project && !project.repository.license + namespace_project_new_blob_path( + project.namespace, + project, + project.default_branch, + file_name: "LICENSE", + commit_message: "Add license" + ) + end + end + + def contribution_guide_path(project) if project && contribution_guide = project.repository.contribution_guide namespace_project_blob_path( project.namespace, @@ -195,7 +231,7 @@ module ProjectsHelper end end - def changelog_url(project) + def changelog_path(project) if project && changelog = project.repository.changelog namespace_project_blob_path( project.namespace, @@ -206,7 +242,7 @@ module ProjectsHelper end end - def license_url(project) + def license_path(project) if project && license = project.repository.license namespace_project_blob_path( project.namespace, @@ -217,7 +253,7 @@ module ProjectsHelper end end - def version_url(project) + def version_path(project) if project && version = project.repository.version namespace_project_blob_path( project.namespace, diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 769dd68f089..4577b84ab89 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -22,19 +22,34 @@ %li = link_to namespace_project_tags_path(@project.namespace, @project) do = pluralize(number_with_delimiter(@repository.tag_names.count), 'tag') + - if @repository.changelog %li - = link_to changelog_url(@project) do + = link_to changelog_path(@project) do Changelog - if @repository.license %li - = link_to license_url(@project) do + = link_to license_path(@project) do License - if @repository.contribution_guide %li - = link_to contribution_guide_url(@project) do + = link_to contribution_guide_path(@project) do Contribution guide + - if current_user && can_push_branch?(@project, @project.default_branch) + - unless @repository.changelog + %li.missing + = link_to add_changelog_path(@project) do + Add Changelog + - unless @repository.license + %li.missing + = link_to add_license_path(@project) do + Add License + - unless @repository.contribution_guide + %li.missing + = link_to add_contribution_guide_path(@project) do + Add Contribution guide + - if @project.archived? .text-warning.center.prepend-top-20 %p diff --git a/app/views/shared/issuable/_form.html.haml b/app/views/shared/issuable/_form.html.haml index 8cc0b517cd2..ac8c1936c9e 100644 --- a/app/views/shared/issuable/_form.html.haml +++ b/app/views/shared/issuable/_form.html.haml @@ -100,7 +100,7 @@ = link_to 'Change branches', mr_change_branches_path(@merge_request) .form-actions - - if !issuable.project.empty_repo? && (guide_url = contribution_guide_url(issuable.project)) && !issuable.persisted? + - if !issuable.project.empty_repo? && (guide_url = contribution_guide_path(issuable.project)) && !issuable.persisted? %p Please review the %strong #{link_to 'guidelines for contribution', guide_url} |