Commit 4b6ab497 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 9387dd5f
...@@ -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;
} }
......
...@@ -4,34 +4,37 @@ ...@@ -4,34 +4,37 @@
= icon('caret-down') = icon('caret-down')
.dropdown-menu-nav.dropdown-menu-align-right .dropdown-menu-nav.dropdown-menu-align-right
%ul %ul
- if @group
- create_group_project = can?(current_user, :create_projects, @group) - create_group_project = can?(current_user, :create_projects, @group)
- create_group_subgroup = can?(current_user, :create_subgroup, @group) - create_group_subgroup = can?(current_user, :create_subgroup, @group)
- if @group && (create_group_project || create_group_subgroup) - if (create_group_project || create_group_subgroup)
%li %li.dropdown-bold-header This group
.bold 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 - merge_project = can?(current_user, :create_merge_request, @project) ? @project : (current_user && current_user.fork_of(@project))
- 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 %li
= link_to 'New issue', new_namespace_project_issue_path(@project.namespace, @project) = 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))
- if merge_project - if merge_project
%li %li
= link_to 'New merge request', new_namespace_project_merge_request_path(merge_project.namespace, merge_project) = link_to 'New merge request', new_namespace_project_merge_request_path(merge_project.namespace, merge_project)
- if can?(current_user, :create_project_snippet, @project) - if create_project_snippet
%li %li
= link_to 'New snippet', new_namespace_project_snippet_path(@project.namespace, @project) = link_to 'New snippet', new_namespace_project_snippet_path(@project.namespace, @project)
- if @group || @project
%li.divider %li.divider
%li %li.dropdown-bold-header GitLab
.bold 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,8 +5,10 @@ class Spinach::Features::ProjectCreate < Spinach::FeatureSteps ...@@ -5,8 +5,10 @@ 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'
page.within '#content-body' do
click_button "Create project" click_button "Create project"
end end
end
step 'I should see project page' do step 'I should see project page' do
expect(page).to have_content "Empty" expect(page).to have_content "Empty"
......
...@@ -17,8 +17,10 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps ...@@ -17,8 +17,10 @@ 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.within '#content-body' do
page.has_link?('New Merge Request') ? click_link("New Merge Request") : click_link('New merge request') 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
expect(@project.merge_requests.size).to be >= 1 expect(@project.merge_requests.size).to be >= 1
......
...@@ -62,8 +62,10 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps ...@@ -62,8 +62,10 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end end
step 'I click link "New issue"' do step 'I click link "New issue"' do
page.within '#content-body' do
page.has_link?('New Issue') ? click_link('New Issue') : click_link('New issue') 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
page.find('.js-author-search').click page.find('.js-author-search').click
......
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