summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-12-02 19:10:36 +0000
committerRémy Coutable <remy@rymai.me>2016-12-02 19:10:36 +0000
commit739e21118795786fc023f9ef90e8107e9d072a22 (patch)
treefb4ff65942959b55ad6aff93dbd88a3646660469
parent44dc4173306235dd6afdd50b685c69eb3087166b (diff)
parent3ababa74c45af3a2fb2b34cd9dcd1a9efe319440 (diff)
downloadgitlab-ce-739e21118795786fc023f9ef90e8107e9d072a22.tar.gz
Merge branch 'mr-origin-7855' into 'master'
Adds a default commit message when adding a README (#25167) Closes #25167 See merge request !7903
-rw-r--r--app/helpers/projects_helper.rb16
-rw-r--r--app/views/projects/_readme.html.haml2
-rw-r--r--app/views/projects/empty.html.haml2
-rw-r--r--changelogs/unreleased/mr-origin-7855.yml4
4 files changed, 7 insertions, 17 deletions
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 898ce6a3af7..9cda3b78761 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -390,21 +390,7 @@ module ProjectsHelper
"success"
end
end
-
- def new_readme_path
- ref = @repository.root_ref if @repository
- ref ||= 'master'
-
- namespace_project_new_blob_path(@project.namespace, @project, tree_join(ref), file_name: 'README.md')
- end
-
- def new_license_path
- ref = @repository.root_ref if @repository
- ref ||= 'master'
-
- namespace_project_new_blob_path(@project.namespace, @project, tree_join(ref), file_name: 'LICENSE')
- end
-
+
def readme_cache_key
sha = @project.commit.try(:sha) || 'nil'
[@project.path_with_namespace, sha, "readme"].join('-')
diff --git a/app/views/projects/_readme.html.haml b/app/views/projects/_readme.html.haml
index 369a847e7d4..b6fb08b68e9 100644
--- a/app/views/projects/_readme.html.haml
+++ b/app/views/projects/_readme.html.haml
@@ -18,5 +18,5 @@
distributed with computer software, forming part of its documentation.
%p
We recommend you to
- = link_to "add a README", new_readme_path, class: 'underlined-link'
+ = link_to "add a README", add_special_file_path(@project, file_name: 'README.md'), class: 'underlined-link'
file to the repository and GitLab will render it here instead of this message.
diff --git a/app/views/projects/empty.html.haml b/app/views/projects/empty.html.haml
index 7a39064adc5..c0a83091c8c 100644
--- a/app/views/projects/empty.html.haml
+++ b/app/views/projects/empty.html.haml
@@ -16,7 +16,7 @@
%p
Otherwise you can start with adding a
= succeed ',' do
- = link_to "README", new_readme_path, class: 'underlined-link'
+ = link_to "README", add_special_file_path(@project, file_name: 'README.md'), class: 'underlined-link'
a
= succeed ',' do
= link_to "LICENSE", add_special_file_path(@project, file_name: 'LICENSE'), class: 'underlined-link'
diff --git a/changelogs/unreleased/mr-origin-7855.yml b/changelogs/unreleased/mr-origin-7855.yml
new file mode 100644
index 00000000000..0fdc6153d55
--- /dev/null
+++ b/changelogs/unreleased/mr-origin-7855.yml
@@ -0,0 +1,4 @@
+---
+title: Provides a sensible default message when adding a README to a project
+merge_request: 7903
+author: