Commit 36c12693 authored by Mike Greiling's avatar Mike Greiling

Merge branch 'remove-unused-partial' into 'master'

Remove unused partial

See merge request gitlab-org/gitlab!76262
parents 8e4fed9e 7eb7aba5
- can_create_issue = show_new_issue_link?(@project)
- can_create_project_snippet = can?(current_user, :create_snippet, @project)
- can_push_code = can?(current_user, :push_code, @project)
- create_mr_from_new_fork = can?(current_user, :fork_project, @project) && can?(current_user, :create_merge_request_in, @project)
- merge_project = merge_request_source_project_for_project(@project)
- show_menu = can_create_issue || can_create_project_snippet || can_push_code || create_mr_from_new_fork || merge_project
- if show_menu
.project-action-button.dropdown.inline<
%a.btn.btn-default.gl-button.dropdown-toggle.has-tooltip.qa-create-new-dropdown{ href: '#', title: _('Create new...'), 'data-toggle' => 'dropdown', 'data-container' => 'body', 'aria-label' => _('Create new...'), 'data-display' => 'static' }
= sprite_icon('plus', css_class: 'gl-icon')
= sprite_icon("chevron-down", css_class: 'gl-icon')
%ul.dropdown-menu.dropdown-menu-right.project-home-dropdown
- if can_create_issue || merge_project || can_create_project_snippet
%li.dropdown-header= _('This project')
- if can_create_issue
%li= link_to _('New issue'), new_project_issue_path(@project)
- if merge_project
%li= link_to _('New merge request'), project_new_merge_request_path(merge_project)
- if can_create_project_snippet
%li= link_to _('New snippet'), new_project_snippet_path(@project)
- if can_push_code
%li.dropdown-header= _('This repository')
- if can_push_code
%li.qa-new-file-option= link_to _('New file'), project_new_blob_path(@project, @project.default_branch_or_main)
- unless @project.empty_repo?
%li= link_to _('New branch'), new_project_branch_path(@project)
%li= link_to _('New tag'), new_project_tag_path(@project)
- elsif can_collaborate_with_project?(@project)
%li= link_to _('New file'), project_new_blob_path(@project, @project.default_branch_or_main)
- elsif create_mr_from_new_fork
- continue_params = { to: project_new_blob_path(@project, @project.default_branch_or_main),
notice: edit_in_new_fork_notice,
notice_now: edit_in_new_fork_notice_now }
- fork_path = project_forks_path(@project, namespace_key: current_user.namespace.id, continue: continue_params)
%li= link_to _('New file'), fork_path, method: :post
......@@ -9932,9 +9932,6 @@ msgstr ""
msgid "Create new project"
msgstr ""
msgid "Create new..."
msgstr ""
msgid "Create or import your first project"
msgstr ""
......
......@@ -45,10 +45,6 @@ module QA
element :tree_holder, '.tree-holder' # rubocop:disable QA/ElementWithPattern
end
view 'app/views/projects/buttons/_dropdown.html.haml' do
element :create_new_dropdown
end
view 'app/views/projects/buttons/_fork.html.haml' do
element :fork_label, "%span= s_('ProjectOverview|Fork')" # rubocop:disable QA/ElementWithPattern
element :fork_link, "link_to new_project_fork_path(@project)" # rubocop:disable QA/ElementWithPattern
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'projects/buttons/_dropdown' do
let(:user) { create(:user) }
context 'user with all abilities' do
before do
assign(:project, project)
allow(view).to receive(:current_user).and_return(user)
allow(view).to receive(:can?).with(user, :push_code, project).and_return(true)
allow(view).to receive(:can_collaborate_with_project?).and_return(true)
end
context 'empty repository' do
let(:project) { create(:project, :empty_repo) }
it 'has a link to create a new file' do
render
expect(view).to render_template('projects/buttons/_dropdown')
expect(rendered).to have_link('New file')
end
it 'does not have a link to create a new branch' do
render
expect(view).to render_template('projects/buttons/_dropdown')
expect(rendered).not_to have_link('New branch')
end
it 'does not have a link to create a new tag' do
render
expect(view).to render_template('projects/buttons/_dropdown')
expect(rendered).not_to have_link('New tag')
end
end
end
end
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