_new_dropdown.haml 2.23 KB
Newer Older
1 2 3 4 5
%li.header-new.dropdown
  = link_to new_project_path, class: "header-new-dropdown-toggle has-tooltip", title: "New...", ref: 'tooltip', aria: { label: "New..." }, data: { toggle: 'dropdown', placement: 'bottom', container: 'body' } do
    = icon('plus fw')
    = icon('caret-down')
  .dropdown-menu-nav.dropdown-menu-align-right
6
    %ul
7
      - if @group&.persisted?
Tim Zallmann's avatar
Tim Zallmann committed
8 9
        - create_group_project = can?(current_user, :create_projects, @group)
        - create_group_subgroup = can?(current_user, :create_subgroup, @group)
Tim Zallmann's avatar
Tim Zallmann committed
10
        - if create_group_project || create_group_subgroup
Tim Zallmann's avatar
Tim Zallmann committed
11 12
          %li.dropdown-bold-header This group
          - if create_group_project
13
            %li.header-new-group-project
Tim Zallmann's avatar
Tim Zallmann committed
14 15 16 17 18 19
              = 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
20

21
      - if @project&.persisted?
Tim Zallmann's avatar
Tim Zallmann committed
22
        - create_project_issue = can?(current_user, :create_issue, @project)
23
        - merge_project = can?(current_user, :create_merge_request, @project) ? @project : (current_user && current_user.fork_of(@project))
Tim Zallmann's avatar
Tim Zallmann committed
24
        - create_project_snippet = can?(current_user, :create_project_snippet, @project)
Tim Zallmann's avatar
Tim Zallmann committed
25
        - if create_project_issue || merge_project || create_project_snippet
Tim Zallmann's avatar
Tim Zallmann committed
26
          %li.dropdown-bold-header This project
27
          - if create_project_issue
Tim Zallmann's avatar
Tim Zallmann committed
28 29 30 31 32 33
            %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
34
            %li.header-new-project-snippet
Tim Zallmann's avatar
Tim Zallmann committed
35 36
              = link_to 'New snippet', new_namespace_project_snippet_path(@project.namespace, @project)
          %li.divider
Tim Zallmann's avatar
Tim Zallmann committed
37
          %li.dropdown-bold-header GitLab
38 39 40 41 42 43 44 45
      - if current_user.can_create_project?
        %li
          = link_to 'New project', new_project_path
      - if current_user.can_create_group?
        %li
          = link_to 'New group', new_group_path
      %li
        = link_to 'New snippet', new_snippet_path