diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-12-07 17:12:04 +0100 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-12-07 17:12:04 +0100 |
commit | cbcb8dbe702c0b1532327aeb2dc53caffb6e8ed9 (patch) | |
tree | fd5b44f26fb3458f5f0eaf0c875b231fbe5cf44b /app/views | |
parent | 8f817c7b08bcad23e1b047f84cc60d1748104e2a (diff) | |
download | gitlab-ce-cbcb8dbe702c0b1532327aeb2dc53caffb6e8ed9.tar.gz |
Use select2 dropdown for dashboard/group 'New X' buttons
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/dashboard/issues.html.haml | 13 | ||||
-rw-r--r-- | app/views/dashboard/merge_requests.html.haml | 13 | ||||
-rw-r--r-- | app/views/dashboard/milestones/index.html.haml | 13 | ||||
-rw-r--r-- | app/views/groups/issues.html.haml | 13 | ||||
-rw-r--r-- | app/views/groups/merge_requests.html.haml | 13 | ||||
-rw-r--r-- | app/views/shared/_new_project_item_select.html.haml | 20 |
6 files changed, 25 insertions, 60 deletions
diff --git a/app/views/dashboard/issues.html.haml b/app/views/dashboard/issues.html.haml index 829c3c83769..2d3da01178a 100644 --- a/app/views/dashboard/issues.html.haml +++ b/app/views/dashboard/issues.html.haml @@ -12,18 +12,7 @@ = link_to issues_dashboard_url(format: :atom, private_token: current_user.private_token), class: 'btn' do %i.fa.fa-rss - - if @projects.any? { |project| can?(current_user, :create_issue, project) } - .dropdown.inline.prepend-left-10 - %button.dropdown-toggle.btn.btn-new{type: 'button', 'data-toggle' => 'dropdown'} - %i.fa.fa-plus - New Issue - %b.caret - %ul.dropdown-menu.dropdown-menu-align-right - - @projects.each do |project| - - if can?(current_user, :create_issue, project) - %li - = link_to new_namespace_project_issue_path(project.namespace, project) do - = project.name_with_namespace + = render 'shared/new_project_item_select', path: 'issues/new', label: "New Issue" = render 'shared/issuable/filter', type: :issues diff --git a/app/views/dashboard/merge_requests.html.haml b/app/views/dashboard/merge_requests.html.haml index 2e91c8dec8a..c5a5ec21f78 100644 --- a/app/views/dashboard/merge_requests.html.haml +++ b/app/views/dashboard/merge_requests.html.haml @@ -3,18 +3,7 @@ .project-issuable-filter .controls - - if @projects.any? { |project| can?(current_user, :create_merge_request, project) } - .dropdown.inline - %button.dropdown-toggle.btn.btn-new{type: 'button', 'data-toggle' => 'dropdown'} - %i.fa.fa-plus - New Merge Request - %b.caret - %ul.dropdown-menu.dropdown-menu-align-right - - @projects.each do |project| - - if can?(current_user, :create_merge_request, project) - %li - = link_to new_namespace_project_merge_request_path(project.namespace, project) do - = project.name_with_namespace + = render 'shared/new_project_item_select', path: 'merge_requests/new', label: "New Merge Request" = render 'shared/issuable/filter', type: :merge_requests diff --git a/app/views/dashboard/milestones/index.html.haml b/app/views/dashboard/milestones/index.html.haml index 9aea75e50db..94ff259a338 100644 --- a/app/views/dashboard/milestones/index.html.haml +++ b/app/views/dashboard/milestones/index.html.haml @@ -3,18 +3,7 @@ .project-issuable-filter .controls - - if @projects.any? { |project| can?(current_user, :admin_milestone, project) } - .dropdown.inline - %button.dropdown-toggle.btn.btn-new{type: 'button', 'data-toggle' => 'dropdown'} - %i.fa.fa-plus - New Milestone - %b.caret - %ul.dropdown-menu.dropdown-menu-align-right - - @projects.each do |project| - - if can?(current_user, :admin_milestone, project) - %li - = link_to new_namespace_project_milestone_path(project.namespace, project) do - = project.name_with_namespace + = render 'shared/new_project_item_select', path: 'milestones/new', label: "New Milestone" = render 'shared/milestones_filter' diff --git a/app/views/groups/issues.html.haml b/app/views/groups/issues.html.haml index 5a9739a0cda..90ade1e1680 100644 --- a/app/views/groups/issues.html.haml +++ b/app/views/groups/issues.html.haml @@ -12,18 +12,7 @@ = link_to issues_group_url(@group, format: :atom, private_token: current_user.private_token), class: 'btn' do %i.fa.fa-rss - - if @projects.any? { |project| can?(current_user, :create_issue, project) } - .dropdown.inline.prepend-left-10 - %button.dropdown-toggle.btn.btn-new{type: 'button', 'data-toggle' => 'dropdown'} - %i.fa.fa-plus - New Issue - %b.caret - %ul.dropdown-menu.dropdown-menu-align-right - - @projects.each do |project| - - if can?(current_user, :create_issue, project) - %li - = link_to new_namespace_project_issue_path(project.namespace, project) do - = project.name_with_namespace + = render 'shared/new_project_item_select', path: 'issues/new', label: "New Issue" = render 'shared/issuable/filter', type: :issues diff --git a/app/views/groups/merge_requests.html.haml b/app/views/groups/merge_requests.html.haml index 95c503a3afa..f662f5a8c17 100644 --- a/app/views/groups/merge_requests.html.haml +++ b/app/views/groups/merge_requests.html.haml @@ -3,18 +3,7 @@ .project-issuable-filter .controls - - if @projects.any? { |project| can?(current_user, :create_merge_request, project) } - .dropdown.inline - %button.dropdown-toggle.btn.btn-new{type: 'button', 'data-toggle' => 'dropdown'} - %i.fa.fa-plus - New Merge Request - %b.caret - %ul.dropdown-menu.dropdown-menu-align-right - - @projects.each do |project| - - if can?(current_user, :create_merge_request, project) - %li - = link_to new_namespace_project_merge_request_path(project.namespace, project) do - = project.name_with_namespace + = render 'shared/new_project_item_select', path: 'merge_requests/new', label: "New Merge Request" = render 'shared/issuable/filter', type: :merge_requests diff --git a/app/views/shared/_new_project_item_select.html.haml b/app/views/shared/_new_project_item_select.html.haml new file mode 100644 index 00000000000..d7243b2d518 --- /dev/null +++ b/app/views/shared/_new_project_item_select.html.haml @@ -0,0 +1,20 @@ +- if @projects.any? + .prepend-left-10.new-project-item-select-holder + = project_select_tag :project_path, class: "new-project-item-select" + %a.btn.btn-new.new-project-item-select-button + = icon('plus') + = local_assigns[:label] + %b.caret + + :javascript + $('.new-project-item-select-button').on('click', function() { + $('.new-project-item-select').select2('open'); + }); + + var relativePath = '#{local_assigns[:path]}'; + + $('.new-project-item-select').on('click', function() { + window.location = $(this).val() + '/' + relativePath; + }); + + new ProjectSelect() |