rosa-build/app/views/projects/base/_repo_block.html.slim

87 lines
4.3 KiB
Plaintext

- act = action_name.to_sym; contr = controller_name.to_sym; treeish = project.default_head(params[:treeish]); branch = @branch.try(:name) || project.default_head
-http_url = git_repo_url(project.name_with_owner)
-ssh_url = git_ssh_repo_url(project.name_with_owner)
div[ role = 'navigation' ng-controller = 'ProjectRepoBlockController' ng-cloak = true
ng-init = "init('#{ssh_url}', #{project.repo.branches.count})" ]
nav.navbar.navbar-default
.container-fluid
/ Brand and toggle get grouped for better mobile display
.navbar-header
button.navbar-toggle[ data-target = '#repo-block-navbar-collapse' data-toggle = 'collapse' type = 'button' ]
span.sr-only Toggle navigation
span.icon-bar
span.icon-bar
span.icon-bar
/ Collect the nav links, forms, and other content for toggling
#repo-block-navbar-collapse.collapse.navbar-collapse
ul.nav.navbar-nav
li.dropdown
a.dropdown href = '#' data-toggle = 'dropdown'
= fa_icon 'file-archive-o', class: 'fa-lg'
span.caret
ul.dropdown-menu role = 'menu'
- file_name = "#{@project.name}-#{treeish}"
li= link_to 'tar.gz', archive_path(project, file_name, 'tar.gz')
li= link_to 'zip', archive_path(project, file_name, 'zip')
.navbar-left
button.btn.navbar-btn.btn-default[ type = 'button' ng-click = "clone_url = '#{http_url}'"
ng-model = "clone_url_protocol" btn-radio = "'http'"
ng-class = '{"btn-info": clone_url_protocol == "http"}' ] HTTP
button.btn.navbar-btn.btn-default[ type = 'button' ng-click = "clone_url = '#{ssh_url}'"
ng-model = "clone_url_protocol" btn-radio = "'ssh'"
ng-class = '{"btn-info": clone_url_protocol == "ssh"}'] SSH
#git-help.navbar-text.navbar-left
a.navbar-link ng-click = 'is_collapsed_git_help = !is_collapsed_git_help'
= fa_icon 'question', class: 'fa-lg'
form#clone_url.navbar-form.navbar-left
.form-group
input#clone-url.form-control[ readonly = 'readonly' spellcheck = false
type = 'text' ng-model = 'clone_url' ]
.navbar-text.navbar-left title = t('layout.projects.git_help.question_title')
a#copy_to_clipboard.navbar-link data-clipboard-target = 'clone-url'
i.fa.fa-clipboard.fa-lg
.navbar-text.navbar-left
= can?(:write, project) ? t("layout.read_write_access") : t("layout.read_access")
.navbar-right== render 'branch_select', project: project if act != :tags
div collapse = "is_collapsed_git_help"
.container
p= t("layout.projects.git_help.cloning") + ":"
p
- if current_user
p[ ng-hide = 'clone_url_protocol == "ssh"']~ "git clone #{http_url} #{project.name}"
p[ ng-hide = 'clone_url_protocol == "http"']~ "git clone #{ssh_url} #{project.name}"
p~ "cd #{project.name}"
p
p= t("layout.projects.git_help.remote") + ":"
p
- if current_user
p[ ng-hide = 'clone_url_protocol == "ssh"' ]~ "git remote add #{project.name} #{http_url}"
p[ ng-hide = 'clone_url_protocol == "http"' ]~ "git remote add #{project.name} #{ssh_url}"
p~ "git fetch #{project.name}"
p~ "git checkout -b my-local-tracking-branch #{project.name}/master_or_other_branch"
.container
.row
ul.nav.nav-tabs role = 'tablist'
li class = ('active' if act == :show && contr == :trees )
a href=tree_path(project, treeish)
i.fa.fa-files-o>
= t('project_menu.files')
li class = ('active' if act == :index && contr == :commits )
a href=commits_path(project, treeish)
i.fa.fa-history>
= t('project_menu.commits')
li class = ('active' if act == :branches && contr == :trees )
a href=branch_path(project, branch)
i.fa.fa-code-fork>
= t('project_menu.branches', count: '{{singleton.project.branches_count}}')
li.tags class = ('active' if act == :tags && contr == :trees )
a href=tags_path(project)
i.fa.fa-tag>
= t('project_menu.tags', count: project.repo.tags.count)