summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2018-11-23 17:50:54 -0500
committerRobert Speicher <rspeicher@gmail.com>2018-11-26 11:19:16 -0600
commit6d754eb1808835e68823b5b28bc6628fa0d05306 (patch)
treedce1fb98579da4fb65247ddae2fc3f862913484c
parentc0fcf120b79ea90b60980a77b4b2e16c6653f450 (diff)
downloadgitlab-ce-6d754eb1808835e68823b5b28bc6628fa0d05306.tar.gz
Condense the "new_dropdown" layout partial
After converting the test that verifies this partial's behavior from a feature spec to a view spec, we're able to remove a few CSS classes that were only used for scoping tests found in the feature spec. All the view spec needs is the `have_link` matcher which allows us to check for a specific `href` attribute.
-rw-r--r--app/views/layouts/header/_new_dropdown.haml26
1 files changed, 10 insertions, 16 deletions
diff --git a/app/views/layouts/header/_new_dropdown.haml b/app/views/layouts/header/_new_dropdown.haml
index e134f416c70..5cb8aebadb3 100644
--- a/app/views/layouts/header/_new_dropdown.haml
+++ b/app/views/layouts/header/_new_dropdown.haml
@@ -7,15 +7,14 @@
- if @group&.persisted?
- create_group_project = can?(current_user, :create_projects, @group)
- create_group_subgroup = can?(current_user, :create_subgroup, @group)
+
- if create_group_project || create_group_subgroup
%li.dropdown-bold-header
= _('This group')
- if create_group_project
- %li.header-new-group-project
- = link_to _('New project'), new_project_path(namespace_id: @group.id)
+ %li= link_to _('New project'), new_project_path(namespace_id: @group.id)
- if create_group_subgroup
- %li
- = link_to _('New subgroup'), new_group_path(parent_id: @group.id)
+ %li= link_to _('New subgroup'), new_group_path(parent_id: @group.id)
%li.divider
%li.dropdown-bold-header GitLab
@@ -23,25 +22,20 @@
- create_project_issue = show_new_issue_link?(@project)
- merge_project = merge_request_source_project_for_project(@project)
- create_project_snippet = can?(current_user, :create_project_snippet, @project)
+
- if create_project_issue || merge_project || create_project_snippet
%li.dropdown-bold-header
= _('This project')
- if create_project_issue
- %li
- = link_to _('New issue'), new_project_issue_path(@project)
+ %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)
+ %li= link_to _('New merge request'), project_new_merge_request_path(merge_project)
- if create_project_snippet
- %li.header-new-project-snippet
- = link_to _('New snippet'), new_project_snippet_path(@project)
+ %li= link_to _('New snippet'), new_project_snippet_path(@project)
%li.divider
%li.dropdown-bold-header GitLab
- if current_user.can_create_project?
- %li
- = link_to _('New project'), new_project_path, class: 'qa-global-new-project-link'
+ %li= link_to _('New project'), new_project_path, class: 'qa-global-new-project-link'
- if current_user.can_create_group?
- %li
- = link_to _('New group'), new_group_path
- %li
- = link_to _('New snippet'), new_snippet_path
+ %li= link_to _('New group'), new_group_path
+ %li= link_to _('New snippet'), new_snippet_path