summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-07-21 18:30:27 -0700
committerStan Hu <stanhu@gmail.com>2015-08-10 07:31:57 -0700
commit6a6697c393ee84114cf106fae572d1dc973411f8 (patch)
tree5551c23a6530a2652b04785c31045ee57c2ce674 /app
parent77f37fa9094443abe8e60ebd09a82e94d0a0047b (diff)
downloadgitlab-ce-6a6697c393ee84114cf106fae572d1dc973411f8.tar.gz
Add README to list of files in project page if activity feed setting in use
Closes #2044
Diffstat (limited to 'app')
-rw-r--r--app/helpers/projects_helper.rb44
-rw-r--r--app/views/projects/show.html.haml15
2 files changed, 29 insertions, 30 deletions
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 525a46291f6..ab9b068de05 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -231,37 +231,20 @@ module ProjectsHelper
end
end
+ def readme_path(project)
+ filename_path(project, :readme)
+ end
+
def changelog_path(project)
- if project && changelog = project.repository.changelog
- namespace_project_blob_path(
- project.namespace,
- project,
- tree_join(project.default_branch,
- changelog.name)
- )
- end
+ filename_path(project, :changelog)
end
def license_path(project)
- if project && license = project.repository.license
- namespace_project_blob_path(
- project.namespace,
- project,
- tree_join(project.default_branch,
- license.name)
- )
- end
+ filename_path(project, :license)
end
def version_path(project)
- if project && version = project.repository.version
- namespace_project_blob_path(
- project.namespace,
- project,
- tree_join(project.default_branch,
- version.name)
- )
- end
+ filename_path(project, :version)
end
def hidden_pass_url(original_url)
@@ -331,4 +314,17 @@ module ProjectsHelper
count
end
end
+
+ private
+
+ def filename_path(project, filename)
+ if project && blob = project.repository.send(filename)
+ namespace_project_blob_path(
+ project.namespace,
+ project,
+ tree_join(project.default_branch,
+ blob.name)
+ )
+ end
+ end
end
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 4577b84ab89..ebbd3e477fc 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -23,18 +23,21 @@
= link_to namespace_project_tags_path(@project.namespace, @project) do
= pluralize(number_with_delimiter(@repository.tag_names.count), 'tag')
+ - if !prefer_readme? && @repository.readme
+ %li
+ = link_to 'Readme', readme_path(@project)
+
- if @repository.changelog
%li
- = link_to changelog_path(@project) do
- Changelog
+ = link_to 'Changelog', changelog_path(@project)
+
- if @repository.license
%li
- = link_to license_path(@project) do
- License
+ = link_to 'License', license_path(@project)
+
- if @repository.contribution_guide
%li
- = link_to contribution_guide_path(@project) do
- Contribution guide
+ = link_to 'Contribution guide', contribution_guide_path(@project)
- if current_user && can_push_branch?(@project, @project.default_branch)
- unless @repository.changelog