BigW Consortium Gitlab

_dropdown.html.haml 2.81 KB
Newer Older
1
- if current_user
2
  .project-action-button.dropdown.inline
3
    %a.btn.dropdown-toggle.has-tooltip{ href: '#', title: _('Create new...'), 'data-toggle' => 'dropdown', 'data-container' => 'body', 'aria-label' => _('Create new...') }
4
      = icon('plus')
5
      = icon("caret-down")
6
    %ul.dropdown-menu.dropdown-menu-align-right.project-home-dropdown
7 8 9 10 11
      - can_create_issue = can?(current_user, :create_issue, @project)
      - merge_project = can?(current_user, :create_merge_request, @project) ? @project : (current_user && current_user.fork_of(@project))
      - can_create_snippet = can?(current_user, :create_snippet, @project)

      - if can_create_issue
12
        %li
13
          = link_to new_namespace_project_issue_path(@project.namespace, @project) do
14
            = icon('exclamation-circle fw')
15
            #{ _('New issue') }
16

17
      - if merge_project
18
        %li
19
          = link_to new_namespace_project_merge_request_path(merge_project.namespace, merge_project) do
20
            = icon('tasks fw')
21
            #{ _('New merge request') }
22 23

      - if can_create_snippet
24
        %li
25 26
          = link_to new_namespace_project_snippet_path(@project.namespace, @project) do
            = icon('file-text-o fw')
27
            #{ _('New snippet') }
28

29
      - if can_create_issue || merge_project || can_create_snippet
30
        %li.divider
31 32

      - if can?(current_user, :push_code, @project)
33
        %li
34
          = link_to namespace_project_new_blob_path(@project.namespace, @project, @project.default_branch || 'master') do
35
            = icon('file fw')
36
            #{ _('New file') }
37 38
        %li
          = link_to new_namespace_project_branch_path(@project.namespace, @project) do
39
            = icon('code-fork fw')
40
            #{ _('New branch') }
41 42
        %li
          = link_to new_namespace_project_tag_path(@project.namespace, @project) do
43
            = icon('tags fw')
44
            #{ _('New tag') }
45 46 47 48
      - elsif current_user && current_user.already_forked?(@project)
        %li
          = link_to namespace_project_new_blob_path(@project.namespace, @project, @project.default_branch || 'master') do
            = icon('file fw')
49
            #{ _('New file') }
50 51 52 53 54
      - elsif can?(current_user, :fork_project, @project)
        %li
          - continue_params = { to:         namespace_project_new_blob_path(@project.namespace, @project, @project.default_branch || 'master'),
                                notice:     edit_in_new_fork_notice,
                                notice_now: edit_in_new_fork_notice_now }
55
          - fork_path = namespace_project_forks_path(@project.namespace, @project, namespace_key:  current_user.namespace.id,
56 57 58
                                                                                  continue:       continue_params)
          = link_to fork_path, method: :post do
            = icon('file fw')
59
            #{ _('New file') }