debian-mirror-gitlab/app/views/projects/tree/_tree_header.html.haml

90 lines
4.4 KiB
Text
Raw Normal View History

2018-05-09 12:01:36 +05:30
- 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)
2017-09-10 17:25:29 +05:30
.tree-ref-container
.tree-ref-holder
2018-03-17 18:26:18 +05:30
= render 'shared/ref_switcher', destination: 'tree', path: @path, show_create: true
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
- if on_top_of_branch?
2018-11-08 19:23:39 +05:30
- addtotree_toggle_attributes = { href: '#', 'data-toggle': 'dropdown', 'data-target': '.add-to-tree-dropdown', 'data-boundary': 'window' }
2018-03-17 18:26:18 +05:30
- else
- addtotree_toggle_attributes = { title: _("You can only add files when you are on a branch"), data: { container: 'body' }, class: 'disabled has-tooltip' }
%ul.breadcrumb.repo-breadcrumb
2018-11-08 19:23:39 +05:30
%li.breadcrumb-item
2018-03-17 18:26:18 +05:30
= link_to project_tree_path(@project, @ref) do
= @project.path
- path_breadcrumbs do |title, path|
2018-11-08 19:23:39 +05:30
%li.breadcrumb-item
2018-03-17 18:26:18 +05:30
= link_to truncate(title, length: 40), project_tree_path(@project, tree_join(@ref, path))
2018-05-09 12:01:36 +05:30
- if can_collaborate || can_create_mr_from_fork
2018-11-08 19:23:39 +05:30
%li.breadcrumb-item
2019-02-15 15:39:39 +05:30
%a.btn.add-to-tree.qa-add-to-tree{ addtotree_toggle_attributes }
2018-11-08 19:23:39 +05:30
= sprite_icon('plus', size: 16, css_class: 'float-left')
= sprite_icon('arrow-down', size: 16, css_class: 'float-left')
2018-03-17 18:26:18 +05:30
- if on_top_of_branch?
.add-to-tree-dropdown
%ul.dropdown-menu
- if can_edit_tree?
%li.dropdown-header
#{ _('This directory') }
%li
2019-02-15 15:39:39 +05:30
= link_to project_new_blob_path(@project, @id), class: 'qa-new-file-option' do
2018-03-17 18:26:18 +05:30
#{ _('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') }
2018-05-09 12:01:36 +05:30
- elsif can?(current_user, :fork_project, @project) && can?(current_user, :create_merge_request_in, @project)
2018-03-17 18:26:18 +05:30
%li
2019-03-02 22:35:43 +05:30
- continue_params = { to: project_new_blob_path(@project, @id),
notice: edit_in_new_fork_notice,
2018-03-17 18:26:18 +05:30
notice_now: edit_in_new_fork_notice_now }
2019-03-02 22:35:43 +05:30
- fork_path = project_forks_path(@project, namespace_key: current_user.namespace.id, continue: continue_params)
2018-03-17 18:26:18 +05:30
= link_to fork_path, method: :post do
#{ _('New file') }
%li
2019-03-02 22:35:43 +05:30
- continue_params = { to: request.fullpath,
notice: edit_in_new_fork_notice + " Try to upload a file again.",
2018-03-17 18:26:18 +05:30
notice_now: edit_in_new_fork_notice_now }
2019-03-02 22:35:43 +05:30
- fork_path = project_forks_path(@project, namespace_key: current_user.namespace.id, continue: continue_params)
2018-03-17 18:26:18 +05:30
= link_to fork_path, method: :post do
#{ _('Upload file') }
%li
2019-03-02 22:35:43 +05:30
- continue_params = { to: request.fullpath,
notice: edit_in_new_fork_notice + " Try to create a new directory again.",
2018-03-17 18:26:18 +05:30
notice_now: edit_in_new_fork_notice_now }
2019-03-02 22:35:43 +05:30
- fork_path = project_forks_path(@project, namespace_key: current_user.namespace.id, continue: continue_params)
2018-03-17 18:26:18 +05:30
= link_to fork_path, method: :post do
#{ _('New directory') }
2018-05-09 12:01:36 +05:30
- 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') }
2015-11-26 14:37:03 +05:30
2017-09-10 17:25:29 +05:30
.tree-controls
2018-03-17 18:26:18 +05:30
= link_to s_('Commits|History'), project_commits_path(@project, @id), class: 'btn'
2017-09-10 17:25:29 +05:30
= render 'projects/find_file_link'
2018-05-09 12:01:36 +05:30
- if can_collaborate
= succeed " " do
2018-12-13 13:39:08 +05:30
= link_to ide_edit_path(@project, @ref, @path), class: 'btn btn-default qa-web-ide-button' do
2018-05-09 12:01:36 +05:30
= _('Web IDE')
2019-02-15 15:39:39 +05:30
- if show_xcode_link?(@project)
.project-action-button.project-xcode.inline
= render "projects/buttons/xcode_link"
2017-09-10 17:25:29 +05:30
= render 'projects/buttons/download', project: @project, ref: @ref