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

55 lines
2.9 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)
#description-top{'ng-controller' => 'ProjectRepoBlockController', 'ng-init' => "init(#{project.repo.branches.count})"}
-if @commit
%ul.nav.zip
%li#menu-archive.dropdown
%a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#menu-archive"}
=image_tag 'zip.png', :alt => 'ZIP'
%b.caret
%ul.dropdown-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')
.btn-group#clone-urls
%button.git-protocol-selector.btn{:value => 'http_url', :class => current_user ? '' : 'active'} HTTP
%button.git-protocol-selector.btn{:value => 'ssh_url', :class => current_user ? 'active' : ''} SSH
=hidden_field_tag :http_url, http_url
=hidden_field_tag :ssh_url, ssh_url
= text_field_tag :url, (current_user ? ssh_url : http_url), :class => 'name', :spellcheck => 'false', :readonly => true
.git_help ?
.role= can?(:write, project) ? t("layout.read_write_access") : t("layout.read_access")
= render 'branch_select', :project => project if act != :tags
.both
#git_help_data
%p= t("layout.projects.git_help.cloning") + ":"
%p
%p.http_url{:class => current_user ? 'hidden' : ''}~ "git clone #{http_url} #{project.name}"
%p.ssh_url{:class => current_user ? '' : 'hidden'}~ "git clone #{ssh_url} #{project.name}"
%p~ "cd #{project.name}"
%p
%p= t("layout.projects.git_help.remote") + ":"
%p
%p.http_url{:class => current_user ? 'hidden' : ''}~ "git remote add #{project.name} #{http_url}"
%p.ssh_url{:class => current_user ? '' : 'hidden'}~ "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"
.project-tabnav
%ul.tabnav-tabs
%li{:class => ('selected' if act == :show && contr == :trees )}
= link_to t('project_menu.files'), tree_path(project, treeish)
%li{:class => ('selected' if act == :index && contr == :commits )}
= link_to t('project_menu.commits'), commits_path(project, treeish)
%li{:class => ('selected' if act == :branches && contr == :trees )}
= link_to t('project_menu.branches', :count => '{{singleton.project.branches_count}}'), branch_path(project, branch)
%li.tags{:class => ('selected' if act == :tags && contr == :trees )}
= link_to t('project_menu.tags', :count => project.repo.tags.count), tags_path(project)
.both
:javascript
$(document).ready(function() {
$('#url').live('click', function() {
$(this).select();
});
});