Commit e8a30517 authored by Tim Zallmann's avatar Tim Zallmann

Externalised Dropdown

Checks for creating new issue
Styling of .dropdown-bold-header
Fixed Spinach Tests to limit them to the main content area for clicking 'New Project' etc. so that they don't click the dropdown menu
parent c5d3b723
...@@ -261,7 +261,13 @@ ...@@ -261,7 +261,13 @@
text-transform: capitalize; text-transform: capitalize;
} }
.separator + .dropdown-header { .dropdown-bold-header {
font-weight: 600;
line-height: 22px;
padding: 0 16px;
}
.separator + .dropdown-header, .separator + .dropdown-bold-header {
padding-top: 2px; padding-top: 2px;
} }
......
...@@ -3,35 +3,38 @@ ...@@ -3,35 +3,38 @@
= icon('plus fw') = icon('plus fw')
= icon('caret-down') = icon('caret-down')
.dropdown-menu-nav.dropdown-menu-align-right .dropdown-menu-nav.dropdown-menu-align-right
%ul %ul
- create_group_project = can?(current_user, :create_projects, @group) - if @group
- create_group_subgroup = can?(current_user, :create_subgroup, @group) - create_group_project = can?(current_user, :create_projects, @group)
- if @group && (create_group_project || create_group_subgroup) - create_group_subgroup = can?(current_user, :create_subgroup, @group)
%li - if (create_group_project || create_group_subgroup)
.bold This group %li.dropdown-bold-header This group
- if create_group_project - if create_group_project
%li %li
= link_to 'New project', new_project_path(namespace_id: @group.id) = link_to 'New project', new_project_path(namespace_id: @group.id)
- if create_group_subgroup - if create_group_subgroup
%li %li
= link_to 'New subgroup', new_group_path(parent_id: @group.id) = link_to 'New subgroup', new_group_path(parent_id: @group.id)
%li.divider
%li.dropdown-bold-header GitLab
- if @project - if @project
%li - create_project_issue = can?(current_user, :create_issue, @project)
.bold This project
%li
= link_to 'New issue', new_namespace_project_issue_path(@project.namespace, @project)
- merge_project = can?(current_user, :create_merge_request, @project) ? @project : (current_user && current_user.fork_of(@project)) - merge_project = can?(current_user, :create_merge_request, @project) ? @project : (current_user && current_user.fork_of(@project))
- if merge_project - create_project_snippet = can?(current_user, :create_project_snippet, @project)
%li - if (create_project_issue || create_project_mr || create_project_snippet)
= link_to 'New merge request', new_namespace_project_merge_request_path(merge_project.namespace, merge_project) %li.dropdown-bold-header This project
- if can?(current_user, :create_project_snippet, @project) - if create_project_issue
%li %li
= link_to 'New snippet', new_namespace_project_snippet_path(@project.namespace, @project) = link_to 'New issue', new_namespace_project_issue_path(@project.namespace, @project)
- if @group || @project - if merge_project
%li.divider %li
%li = link_to 'New merge request', new_namespace_project_merge_request_path(merge_project.namespace, merge_project)
.bold GitLab - if create_project_snippet
%li
= link_to 'New snippet', new_namespace_project_snippet_path(@project.namespace, @project)
%li.divider
%li.dropdown-bold-header GitLab
- if current_user.can_create_project? - if current_user.can_create_project?
%li %li
= link_to 'New project', new_project_path = link_to 'New project', new_project_path
......
...@@ -4,7 +4,7 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps ...@@ -4,7 +4,7 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps
include SharedProject include SharedProject
step 'I click "New project" link' do step 'I click "New project" link' do
page.within('.content') do page.within '#content-body' do
click_link "New project" click_link "New project"
end end
end end
......
...@@ -5,7 +5,9 @@ class Spinach::Features::ProjectCreate < Spinach::FeatureSteps ...@@ -5,7 +5,9 @@ class Spinach::Features::ProjectCreate < Spinach::FeatureSteps
step 'fill project form with valid data' do step 'fill project form with valid data' do
fill_in 'project_path', with: 'Empty' fill_in 'project_path', with: 'Empty'
click_button "Create project" page.within '#content-body' do
click_button "Create project"
end
end end
step 'I should see project page' do step 'I should see project page' do
......
...@@ -17,7 +17,9 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps ...@@ -17,7 +17,9 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps
end end
step 'I click link "New Merge Request"' do step 'I click link "New Merge Request"' do
page.has_link?('New Merge Request') ? click_link("New Merge Request") : click_link('New merge request') page.within '#content-body' do
page.has_link?('New Merge Request') ? click_link("New Merge Request") : click_link('New merge request')
end
end end
step 'I should see merge request "Merge Request On Forked Project"' do step 'I should see merge request "Merge Request On Forked Project"' do
......
...@@ -62,7 +62,9 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps ...@@ -62,7 +62,9 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end end
step 'I click link "New issue"' do step 'I click link "New issue"' do
page.has_link?('New Issue') ? click_link('New Issue') : click_link('New issue') page.within '#content-body' do
page.has_link?('New Issue') ? click_link('New Issue') : click_link('New issue')
end
end end
step 'I click "author" dropdown' do step 'I click "author" dropdown' do
......
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