Commit 6709e65c 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 5677cb01
......@@ -261,7 +261,13 @@
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;
}
......
......@@ -3,35 +3,38 @@
= icon('plus fw')
= icon('caret-down')
.dropdown-menu-nav.dropdown-menu-align-right
%ul
- create_group_project = can?(current_user, :create_projects, @group)
- create_group_subgroup = can?(current_user, :create_subgroup, @group)
- if @group && (create_group_project || create_group_subgroup)
%li
.bold This group
- if create_group_project
%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)
%ul
- if @group
- 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
= 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.divider
%li.dropdown-bold-header GitLab
- if @project
%li
.bold This project
%li
= link_to 'New issue', new_namespace_project_issue_path(@project.namespace, @project)
- create_project_issue = can?(current_user, :create_issue, @project)
- merge_project = can?(current_user, :create_merge_request, @project) ? @project : (current_user && current_user.fork_of(@project))
- if merge_project
%li
= link_to 'New merge request', new_namespace_project_merge_request_path(merge_project.namespace, merge_project)
- if can?(current_user, :create_project_snippet, @project)
%li
= link_to 'New snippet', new_namespace_project_snippet_path(@project.namespace, @project)
- if @group || @project
%li.divider
%li
.bold GitLab
- create_project_snippet = can?(current_user, :create_project_snippet, @project)
- if (create_project_issue || create_project_mr || create_project_snippet)
%li.dropdown-bold-header This project
- if create_project_issue
%li
= link_to 'New issue', new_namespace_project_issue_path(@project.namespace, @project)
- if merge_project
%li
= link_to 'New merge request', new_namespace_project_merge_request_path(merge_project.namespace, merge_project)
- 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?
%li
= link_to 'New project', new_project_path
......
......@@ -4,7 +4,7 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps
include SharedProject
step 'I click "New project" link' do
page.within('.content') do
page.within '#content-body' do
click_link "New project"
end
end
......
......@@ -5,7 +5,9 @@ class Spinach::Features::ProjectCreate < Spinach::FeatureSteps
step 'fill project form with valid data' do
fill_in 'project_path', with: 'Empty'
click_button "Create project"
page.within '#content-body' do
click_button "Create project"
end
end
step 'I should see project page' do
......
......@@ -17,7 +17,9 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps
end
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
step 'I should see merge request "Merge Request On Forked Project"' do
......
......@@ -62,7 +62,9 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
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
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