Commit f1f506fc authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'add-readme-for-activity-feed-setting' into 'master'

Add README to list of files in project page if activity feed setting in use

Closes #2044

Screenshot:

![image](https://gitlab.com/gitlab-org/gitlab-ce/uploads/7da17d8d8172f86965af15fd563d181a/image.png)

See merge request !1021
parents aa0a0dc3 6a6697c3
......@@ -231,37 +231,20 @@ module ProjectsHelper
end
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)
)
def readme_path(project)
filename_path(project, :readme)
end
def changelog_path(project)
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
......@@ -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
......
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