diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 15:44:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 15:44:42 +0000 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /app/presenters/project_presenter.rb | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) | |
download | gitlab-ce-4555e1b21c365ed8303ffb7a3325d773c9b8bf31.tar.gz |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'app/presenters/project_presenter.rb')
-rw-r--r-- | app/presenters/project_presenter.rb | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/app/presenters/project_presenter.rb b/app/presenters/project_presenter.rb index aad1c816cf1..4f803ba34f4 100644 --- a/app/presenters/project_presenter.rb +++ b/app/presenters/project_presenter.rb @@ -108,7 +108,7 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated end def add_license_ide_path - ide_edit_path(project, default_branch_or_master, 'LICENSE') + ide_edit_path(project, default_branch_or_main, 'LICENSE') end def add_changelog_path @@ -116,7 +116,7 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated end def add_changelog_ide_path - ide_edit_path(project, default_branch_or_master, 'CHANGELOG') + ide_edit_path(project, default_branch_or_main, 'CHANGELOG') end def add_contribution_guide_path @@ -124,7 +124,7 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated end def add_contribution_guide_ide_path - ide_edit_path(project, default_branch_or_master, 'CONTRIBUTING.md') + ide_edit_path(project, default_branch_or_main, 'CONTRIBUTING.md') end def add_readme_path @@ -132,13 +132,24 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated end def add_readme_ide_path - ide_edit_path(project, default_branch_or_master, 'README.md') + ide_edit_path(project, default_branch_or_main, 'README.md') end def add_ci_yml_path add_special_file_path(file_name: ci_config_path_or_default) end + def add_code_quality_ci_yml_path + add_special_file_path( + file_name: ci_config_path_or_default, + commit_message: s_("CommitMessage|Add %{file_name} and create a code quality job") % { file_name: ci_config_path_or_default }, + additional_params: { + template: 'Code-Quality', + code_quality_walkthrough: true + } + ) + end + def license_short_name license = repository.license license&.nickname || license&.name || 'LICENSE' @@ -210,7 +221,7 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated strong_start: '<strong class="project-stat-value">'.html_safe, strong_end: '</strong>'.html_safe }, - empty_repo? ? nil : project_commits_path(project, repository.root_ref)) + empty_repo? ? nil : project_commits_path(project, default_branch_or_main)) end def branches_anchor_data @@ -249,10 +260,10 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated nil, nil, { - 'target_branch' => default_branch_or_master, - 'original_branch' => default_branch_or_master, + 'target_branch' => default_branch_or_main, + 'original_branch' => default_branch_or_main, 'can_push_code' => 'true', - 'path' => project_create_blob_path(project, default_branch_or_master), + 'path' => project_create_blob_path(project, default_branch_or_main), 'project_path' => project.path } ) @@ -268,7 +279,7 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated def new_file_anchor_data if can_current_user_push_to_default_branch? - new_file_path = empty_repo? ? ide_edit_path(project, default_branch_or_master) : project_new_blob_path(project, default_branch_or_master) + new_file_path = empty_repo? ? ide_edit_path(project, default_branch_or_main) : project_new_blob_path(project, default_branch_or_main) AnchorData.new(false, statistic_icon + _('New file'), @@ -390,16 +401,16 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated end def topics_to_show - project.tag_list.take(MAX_TOPICS_TO_SHOW) # rubocop: disable CodeReuse/ActiveRecord + project.topic_list.take(MAX_TOPICS_TO_SHOW) # rubocop: disable CodeReuse/ActiveRecord end def topics_not_shown - project.tag_list - topics_to_show + project.topic_list - topics_to_show end def count_of_extra_topics_not_shown - if project.tag_list.count > MAX_TOPICS_TO_SHOW - project.tag_list.count - MAX_TOPICS_TO_SHOW + if project.topic_list.count > MAX_TOPICS_TO_SHOW + project.topic_list.count - MAX_TOPICS_TO_SHOW else 0 end @@ -468,16 +479,17 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated end end - def add_special_file_path(file_name:, commit_message: nil, branch_name: nil) + def add_special_file_path(file_name:, commit_message: nil, branch_name: nil, additional_params: {}) commit_message ||= s_("CommitMessage|Add %{file_name}") % { file_name: file_name } project_new_blob_path( project, - default_branch_or_master, + default_branch_or_main, file_name: file_name, commit_message: commit_message, - branch_name: branch_name + branch_name: branch_name, + **additional_params ) end end -ProjectPresenter.prepend_if_ee('EE::ProjectPresenter') +ProjectPresenter.prepend_mod_with('ProjectPresenter') |