_tree_header.html.haml 5.4 KB
Newer Older
1
2
3
- can_collaborate = can_collaborate_with_project?(@project)
- can_create_mr_from_fork = can?(current_user, :fork_project, @project) && can?(current_user, :create_merge_request_in, @project)

Annabel Dunstone Gray's avatar
Annabel Dunstone Gray committed
4
5
.tree-ref-container
  .tree-ref-holder
6
    = render 'shared/ref_switcher', destination: 'tree', path: @path, show_create: true
7

8
    - if on_top_of_branch?
9
      - addtotree_toggle_attributes = { 'data-toggle': 'dropdown', 'data-target': '.add-to-tree-dropdown', 'data-boundary': 'window' }
10
11
12
    - else
      - addtotree_toggle_attributes = { title: _("You can only add files when you are on a branch"), data: { container: 'body' }, class: 'disabled has-tooltip' }

13
  - if vue_file_list_enabled?
14
    #js-repo-breadcrumb{ data: breadcrumb_data_attributes }
15
16
  - else
    %ul.breadcrumb.repo-breadcrumb
17
      %li.breadcrumb-item
18
19
20
21
22
        = link_to project_tree_path(@project, @ref) do
          = @project.path
      - path_breadcrumbs do |title, path|
        %li.breadcrumb-item
          = link_to truncate(title, length: 40), project_tree_path(@project, tree_join(@ref, path))
23

24
25
26
27
      - if can_collaborate || can_create_mr_from_fork
        %li.breadcrumb-item
          %button.btn.add-to-tree.qa-add-to-tree{ addtotree_toggle_attributes, type: 'button' }
            = sprite_icon('plus', size: 16, css_class: 'float-left')
28
            = sprite_icon('chevron-down', size: 16, css_class: 'float-left')
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
          - if on_top_of_branch?
            .add-to-tree-dropdown
              %ul.dropdown-menu
                - if can_edit_tree?
                  %li.dropdown-header
                    #{ _('This directory') }
                  %li
                    = link_to project_new_blob_path(@project, @id), class: 'qa-new-file-option' do
                      #{ _('New file') }
                  %li
                    = link_to '#modal-upload-blob', { 'data-target' => '#modal-upload-blob', 'data-toggle' => 'modal' } do
                      #{ _('Upload file') }
                  %li
                    = link_to '#modal-create-new-dir', { 'data-target' => '#modal-create-new-dir', 'data-toggle' => 'modal' } do
                      #{ _('New directory') }
44
                - elsif can_create_mr_from_fork
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
                  %li
                    - continue_params = { to: project_new_blob_path(@project, @id),
                                          notice: edit_in_new_fork_notice,
                                          notice_now: edit_in_new_fork_notice_now }
                    - fork_path = project_forks_path(@project, namespace_key: current_user.namespace.id, continue: continue_params)
                    = link_to fork_path, method: :post do
                      #{ _('New file') }
                  %li
                    - continue_params = { to: request.fullpath,
                                          notice: edit_in_new_fork_notice + " Try to upload a file again.",
                                          notice_now: edit_in_new_fork_notice_now }
                    - fork_path = project_forks_path(@project, namespace_key: current_user.namespace.id, continue: continue_params)
                    = link_to fork_path, method: :post do
                      #{ _('Upload file') }
                  %li
                    - continue_params = { to: request.fullpath,
                                          notice: edit_in_new_fork_notice + " Try to create a new directory again.",
                                          notice_now: edit_in_new_fork_notice_now }
                    - fork_path = project_forks_path(@project, namespace_key: current_user.namespace.id, continue: continue_params)
                    = link_to fork_path, method: :post do
                      #{ _('New directory') }
66

67
68
69
70
71
72
73
74
75
76
                - if can?(current_user, :push_code, @project)
                  %li.divider
                  %li.dropdown-header
                    #{ _('This repository') }
                  %li
                    = link_to new_project_branch_path(@project) do
                      #{ _('New branch') }
                  %li
                    = link_to new_project_tag_path(@project) do
                      #{ _('New tag') }
77

78
.tree-controls<
Filipa Lacerda's avatar
Filipa Lacerda committed
79
  = render_if_exists 'projects/tree/lock_link'
80
81
82
83
  - if vue_file_list_enabled?
    #js-tree-history-link.d-inline-block{ data: { history_link: project_commits_path(@project, @ref) } }
  - else
    = link_to s_('Commits|History'), project_commits_path(@project, @id), class: 'btn'
84

85
  = render 'projects/find_file_link'
86

87
  - if can_create_mr_from_fork
88
89
90
    - if can_collaborate || current_user&.already_forked?(@project)
      - if vue_file_list_enabled?
        #js-tree-web-ide-link.d-inline-block
91
      - else
92
        = link_to ide_edit_path(@project, @ref, @path), class: 'btn btn-default qa-web-ide-button' do
93
          = _('Web IDE')
94
95
96
97
    - else
      = link_to '#modal-confirm-fork', class: 'btn btn-default qa-web-ide-button', data: { target: '#modal-confirm-fork', toggle: 'modal'} do
        = _('Web IDE')
      = render 'shared/confirm_fork_modal', fork_path: ide_fork_and_edit_path(@project, @ref, @path)
Phil Hughes's avatar
Phil Hughes committed
98

99
  - if show_xcode_link?(@project)
100
    .project-action-button.project-xcode.inline<
101
102
      = render "projects/buttons/xcode_link"

103
  = render 'projects/buttons/download', project: @project, ref: @ref
104
105
106
107
108
109

  .project-clone-holder.d-block.d-md-none.mt-sm-2.mt-md-0>
    = render "shared/mobile_clone_panel"

  .project-clone-holder.d-none.d-md-inline-block>
    = render "projects/buttons/clone", dropdown_class: 'dropdown-menu-right'