[#369] git tree page
This commit is contained in:
parent
33790f884c
commit
388617c248
|
@ -0,0 +1,35 @@
|
|||
RosaABF.controller('GitTreeCtrl', ['$scope', '$http', function($scope, $http) {
|
||||
$scope.project = null;
|
||||
$scope.treeish = null;
|
||||
$scope.path = null;
|
||||
$scope.root_path = null;
|
||||
$scope.tree = null;
|
||||
|
||||
$scope.init = function(project, treeish, path, root_path) {
|
||||
$scope.project = project;
|
||||
$scope.treeish = treeish;
|
||||
$scope.path = path;
|
||||
$scope.path_path = root_path;
|
||||
$scope.getTree();
|
||||
};
|
||||
|
||||
$scope.getTree = function($event, path) {
|
||||
if(path) { $scope.path = path; }
|
||||
if($scope.path) {
|
||||
var treeish = $scope.treeish+'/'+$scope.path;
|
||||
}
|
||||
else {
|
||||
var treeish = $scope.treeish;
|
||||
}
|
||||
$http.get(Routes.tree_path($scope.project, treeish, {format: 'json'})).then(function(res) {
|
||||
$scope.path = res.data.path;
|
||||
$scope.root_path = res.data.root_path;
|
||||
$scope.tree = res.data.tree;
|
||||
$scope.path_breadcrumb = res.data.tree_breadcrumb;
|
||||
});
|
||||
|
||||
if($event) {
|
||||
$event.preventDefault();
|
||||
}
|
||||
};
|
||||
}]);
|
|
@ -50,4 +50,18 @@ $(document).ready(function() {
|
|||
});
|
||||
|
||||
var clip = new ZeroClipboard($("#clipboard_copy_button"));
|
||||
|
||||
$('.datetime_moment').each(function() {
|
||||
var mtime = moment($(this).attr('origin_datetime'), 'X').format('ddd, LLL');
|
||||
$(this).attr('title', mtime);
|
||||
});
|
||||
|
||||
window.updateTime = function () {
|
||||
$('.datetime_moment').each(function() {
|
||||
$(this).html(moment($(this).attr('origin_datetime'), 'X').fromNow());
|
||||
});
|
||||
};
|
||||
|
||||
updateTime();
|
||||
setInterval( updateTime, 15000 );
|
||||
});
|
||||
|
|
|
@ -9,12 +9,12 @@ class Projects::Git::TreesController < Projects::Git::BaseController
|
|||
before_filter -> { authorize!(:write, @project) }, only: [:destroy, :restore_branch, :create]
|
||||
|
||||
def show
|
||||
unless request.xhr?
|
||||
#unless request.xhr?
|
||||
render('empty') and return if @project.is_empty?
|
||||
@tree = @tree / @path if @path.present?
|
||||
@commit = @branch.present? ? @branch.commit() : @project.repo.log(@treeish, @path, max_count: 1).first
|
||||
raise Grit::NoSuchPathError unless @commit
|
||||
end
|
||||
#end
|
||||
end
|
||||
|
||||
def archive
|
||||
|
|
|
@ -50,7 +50,8 @@ module ApplicationHelper
|
|||
|
||||
def datetime_moment(date, options = {})
|
||||
tag = options[:tag] || :div
|
||||
title = options[:title] || date.strftime('%Y-%m-%d %H:%M:%S UTC')
|
||||
klass = "datetime_moment #{options[:class]}"
|
||||
content_tag(tag, nil, class: klass, title: date.strftime('%Y-%m-%d %H:%M:%S UTC'), origin_datetime: date.to_i)
|
||||
content_tag(tag, nil, class: klass, title: title, origin_datetime: date.to_i)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -56,8 +56,10 @@ module GitHelper
|
|||
end
|
||||
|
||||
def iterate_path(path, &block)
|
||||
p '*'*60, "path == #{path}", '*'*60
|
||||
path.split(File::SEPARATOR).inject('') do |a, e|
|
||||
if e != '.' and e != '..'
|
||||
p '*'*60, "a == #{a}; e = #{e}", '*'*60
|
||||
if e != '.' && e != '..'
|
||||
a = File.join(a, e)
|
||||
a = a[1..-1] if a[0] == File::SEPARATOR
|
||||
block.call(a, e) if a.length > 1
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
- if project.description.present?
|
||||
.description
|
||||
%h3= t("layout.projects.about_subheader")
|
||||
%p
|
||||
= project.description
|
||||
-# link_to t('layout.read_more'), '#'
|
||||
%h3= t 'layout.projects.about_subheader'
|
||||
%p= simple_format project.description
|
||||
|
|
|
@ -1,13 +1,30 @@
|
|||
= render 'submenu'
|
||||
= render 'repo_block', project: @project
|
||||
|
||||
= render 'about_block', project: @project
|
||||
.container
|
||||
.row
|
||||
= render 'about_block', project: @project
|
||||
|
||||
%h3= t("layout.projects.last_commit")
|
||||
- GitPresenters::CommitAsMessagePresenter.present(@commit, project: @project) do |presenter|
|
||||
= render 'shared/feed_message', presenter: presenter, item_no: 1
|
||||
%h3= t 'layout.projects.last_commit'
|
||||
- GitPresenters::CommitAsMessagePresenter.present(@commit, project: @project) do |presenter|
|
||||
=# render 'shared/feed_message', presenter: presenter, item_no: 1
|
||||
|
||||
.both
|
||||
.panel.panel-default
|
||||
.panel-body
|
||||
.pull-left.roffset5
|
||||
%img{ alt: 'avatar', src: presenter.image }
|
||||
.pull-left
|
||||
%strong= presenter.header
|
||||
= "(#{datetime_moment(presenter.date, tag: :strong)})".html_safe
|
||||
.clearfix
|
||||
%span= presenter.caption
|
||||
- if presenter.expandable? and presenter.content?
|
||||
%span.glyphicon.glyphicon-chevron-down{ 'data-toggle' => 'collapse', 'data-target' => '#commit_message' }
|
||||
.clearfix
|
||||
- if presenter.content?
|
||||
#commit_message.collapse
|
||||
= preserve do
|
||||
= markdown(presenter.content)
|
||||
|
||||
#repo-wrapper
|
||||
= yield
|
||||
.clearfix
|
||||
= yield
|
||||
|
|
|
@ -2,119 +2,77 @@
|
|||
-http_url = git_repo_url(project.name_with_owner)
|
||||
-ssh_url = git_ssh_repo_url(project.name_with_owner)
|
||||
|
||||
%nav.navbar.navbar-default{ role: 'navigation', 'ng-controller' => 'ProjectRepoBlockController',
|
||||
'ng-init' => "init('#{ssh_url}', #{project.repo.branches.count})",
|
||||
'ng-cloak' => true }
|
||||
.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-toggle{ 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'
|
||||
%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-toggle{ 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' }
|
||||
#copy_to_clipboard.navbar-text.navbar-left
|
||||
%a.navbar-link
|
||||
%i.fa.fa-clipboard.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' }
|
||||
#copy_to_clipboard.navbar-text.navbar-left{ title: t('layout.projects.git_help.question_title') }
|
||||
%a.navbar-link
|
||||
%i.fa.fa-clipboard.fa-lg
|
||||
|
||||
.navbar-text.navbar-left
|
||||
= can?(:write, project) ? t("layout.read_write_access") : t("layout.read_access")
|
||||
.navbar-text.navbar-left
|
||||
= can?(:write, project) ? t("layout.read_write_access") : t("layout.read_access")
|
||||
|
||||
= render 'branch_select', project: project if act != :tags
|
||||
= 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"
|
||||
%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"
|
||||
|
||||
|
||||
-#
|
||||
.well#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 )}
|
||||
.container
|
||||
.row
|
||||
%ul.nav.nav-tabs{ role: 'tablist' }
|
||||
%li{class: ('active' if act == :show && contr == :trees )}
|
||||
= link_to t('project_menu.files'), tree_path(project, treeish)
|
||||
%li{class: ('selected' if act == :index && contr == :commits )}
|
||||
%li{class: ('active' if act == :index && contr == :commits )}
|
||||
= link_to t('project_menu.commits'), commits_path(project, treeish)
|
||||
%li{class: ('selected' if act == :branches && contr == :trees )}
|
||||
%li{class: ('active' 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 )}
|
||||
%li.tags{class: ('active' 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').on('click', function() {
|
||||
$(this).select();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,14 +2,15 @@
|
|||
- full_name = "#{owner.uname}/#{name} #{is_group}"
|
||||
|
||||
- if owner.own_projects.exists? name: name
|
||||
%p.center
|
||||
%p.text-center
|
||||
=t 'layout.projects.already_exists'
|
||||
=link_to full_name, project_path("#{owner.uname}/#{name}")
|
||||
=link_to full_name, project_path("#{owner.uname}/#{name}")#, class: 'center-block'
|
||||
- else
|
||||
= form_for @project, url: fork_project_path(@project), html: { class: :form, multipart: true, method: :post } do |f|
|
||||
= hidden_field_tag :group, owner.id if owner.class == Group
|
||||
= hidden_field_tag :fork_name, name, name: 'fork_name'
|
||||
=f.submit t('layout.projects.fork_to', to: full_name), class: 'btn btn-primary disabled', 'data-loading-text' => t('layout.processing'), id: 'create_fork'
|
||||
=f.submit t('layout.projects.fork_to', to: full_name), class: 'btn btn-primary center-block',
|
||||
'data-loading-text' => t('layout.processing'), id: 'create_fork'
|
||||
|
||||
:javascript
|
||||
$('#create_fork').click(function () {
|
||||
|
|
|
@ -1,19 +1,26 @@
|
|||
= hidden_field_tag :possible_forks_path, possible_forks_project_path(@project)
|
||||
|
||||
- if can? :write, @project
|
||||
.r{style: "display: block"}
|
||||
=link_to t("projects.pull_requests.show.pull"), new_project_pull_request_path(@project, treeish: @treeish), id: 'send_pull_request', class: 'button'
|
||||
.pull-right.roffset5
|
||||
=link_to t("projects.pull_requests.show.pull"), new_project_pull_request_path(@project, treeish: @treeish),
|
||||
id: 'send_pull_request', class: 'btn btn-primary'
|
||||
|
||||
- if can? :fork, @project
|
||||
.r#fork-and-edit= link_to t('layout.projects.fork_and_edit'), '#forkModal', class: 'button', 'data-toggle' => 'modal'
|
||||
#forkModal.modal.fork-modal{style: 'display: none;'}
|
||||
.modal-header
|
||||
%a.close{"data-dismiss" => "modal"} ×
|
||||
%h3=t 'layout.projects.fork_modal_header'
|
||||
= hidden_field_tag :possible_forks, possible_forks_project_path(@project)
|
||||
%div{align: 'center'}= text_field_tag 'fork_name', @project.name, id: 'fork_name', class: 'fork_name'
|
||||
#forks_list.modal-body.modal-body-fork
|
||||
= render 'forks', owner: current_user, name: @project.name
|
||||
.pull-right#fork-and-edit.roffset5
|
||||
= link_to t('layout.projects.fork_and_edit'), '#', class: 'btn btn-primary',
|
||||
'data-toggle' => 'modal', 'data-target' => '#forkModal'
|
||||
#forkModal.modal.fade{ tabindex: '-1', role: 'dialog', 'aria-labelledby' => 'myModalLabel', 'aria-hidden' => 'true' }
|
||||
.modal-dialog
|
||||
.modal-content
|
||||
.modal-header
|
||||
%button.close{ type: 'button', 'data-dismiss' => 'modal' }
|
||||
%span{ 'aria-hidden' => 'true' } ×
|
||||
%span.sr-only Close
|
||||
%h4.modal-title#myModalLabel= t 'layout.projects.fork_modal_header'
|
||||
= hidden_field_tag :possible_forks, possible_forks_project_path(@project)
|
||||
%p.offset10= text_field_tag 'fork_name', @project.name, id: 'fork_name', class: 'form-control'
|
||||
.modal-body= render 'forks', owner: current_user, name: @project.name
|
||||
|
||||
- if @project.is_package && can?(:create, @project.build_lists.new)
|
||||
.r{style: "display: block"}= link_to t('layout.projects.new_build_list'), new_project_build_list_path(@project), class: 'button'
|
||||
.pull-right.roffset5
|
||||
= link_to t('layout.projects.new_build_list'), new_project_build_list_path(@project), class: 'btn btn-primary'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
=render 'projects/git/base/choose_fork', owner: current_user, name: name
|
||||
%hr.bootstrap
|
||||
%hr
|
||||
- Group.can_own_project(current_user).each do |group|
|
||||
=render 'projects/git/base/choose_fork', owner: group, name: name
|
||||
%hr.bootstrap
|
||||
%hr
|
|
@ -1,10 +1,5 @@
|
|||
%p#file-name1
|
||||
= link_to @project.name, tree_path(@project, treeish: @treeish)
|
||||
= File::SEPARATOR
|
||||
- if @path.present?
|
||||
- paths = File.split(@path)
|
||||
- if paths.size > 1 and paths.first != '.'
|
||||
- iterate_path(paths.first) do |path, name|
|
||||
= link_to(name, tree_path(@project, @treeish, path))
|
||||
= File::SEPARATOR
|
||||
= paths.last
|
||||
%ol.breadcrumb
|
||||
%li= link_to @project.name, tree_path(@project, treeish: @treeish), 'ng-click' => "getTree($event)"
|
||||
%li{ 'ng-repeat' => 'path in tree_breadcrumb.elements' }
|
||||
%a{ 'ng-href' => '{{path.url}}', 'ng-click' => 'getTree($event, path.path)' } {{path.name}}
|
||||
%li.active {{path.last}}
|
||||
|
|
|
@ -1,50 +1,38 @@
|
|||
%h3= t("layout.projects.files_in_project")
|
||||
.files
|
||||
.l= render 'whereami'
|
||||
= render 'fork'
|
||||
.both
|
||||
|
||||
%table#myTable.tablesorter.project{cellpadding: "0", cellspacing: "0"}
|
||||
%thead
|
||||
%tr
|
||||
%th.th1= t("layout.projects.filename")
|
||||
%th.th2= t("layout.projects.age")
|
||||
%th.th3= t("layout.projects.message")
|
||||
%th.th4= t("layout.projects.author")
|
||||
%tbody
|
||||
- if @path.present?
|
||||
%h3= t 'layout.projects.files_in_project'
|
||||
%div{ 'ng-controller' => 'GitTreeCtrl', 'ng-cloak' => true,
|
||||
'ng-init' => "init('#{@project.name_with_owner}', '#{@treeish}', '#{@path}', '#{root_path}')" }
|
||||
.files
|
||||
.pull-left= render 'whereami'
|
||||
.pull-right= render 'fork'
|
||||
- root_path = @path.present? ? File.join([@path, ".."].compact) : 'null'
|
||||
%table.table.table-hover
|
||||
%thead
|
||||
%tr
|
||||
%th= t 'layout.projects.filename'
|
||||
%th.col-md-9= t 'layout.projects.message'
|
||||
%th= t 'layout.projects.age'
|
||||
%tbody
|
||||
%tr{ 'ng-show' => 'path' }
|
||||
%td
|
||||
.pic= image_tag 'folder.png'
|
||||
.name= link_to "..", tree_path(@project, @treeish, File.join([@path, ".."].compact))
|
||||
%td==
|
||||
%td==
|
||||
%td==
|
||||
- @project.tree_info(@tree, @treeish, @path).each do |node, node_path, commit|
|
||||
%tr
|
||||
%td
|
||||
- if node.is_a? Grit::Submodule
|
||||
.pic= image_tag 'folder-submodule.png'
|
||||
.name
|
||||
- if url = submodule_url(node, @treeish)
|
||||
= link_to(node.name, url, class: 'files-see')
|
||||
= '@'
|
||||
= link_to(node.id[0..6], "#{url}/tree/#{node.id}", class: 'files-see')
|
||||
- else
|
||||
= "#{node.name} @ #{node.id[0..6]}"
|
||||
- else
|
||||
- options = [@project, @treeish, node_path]
|
||||
- if node.is_a?(Grit::Tree)
|
||||
- pic = 'folder.png'
|
||||
- path = tree_path *options
|
||||
.pic= image_tag pic || 'code.png'
|
||||
.name= link_to(node.name, path || blob_path(*options), class: 'files-see')
|
||||
|
||||
- if commit
|
||||
= datetime_moment(commit.committed_date || commit.authored_date, tag: :td)
|
||||
%td= commit.short_message
|
||||
%td= (commit.committer || commit.author).name
|
||||
- else
|
||||
%td
|
||||
%td
|
||||
%td
|
||||
%span= fa_icon 'folder', class: 'text-primary'
|
||||
%a{ 'ng-href' => '{{root_path}}', 'ng-click' => 'getTree(root_path)' } ..
|
||||
%td
|
||||
%td
|
||||
%tr{ 'ng-repeat' => 'el in tree' }
|
||||
%td{ 'ng-show' => 'el.submodule && el.submodule.url' }
|
||||
%span= fa_icon 'folder-open', class: 'text-info'
|
||||
%a{ 'ng-href' => '{{el.submodule.url}}' } {{el.submodule.name}}
|
||||
@
|
||||
%a{ 'ng-href' => '{{el.submodule.tree_url}}' } {{el.submodule.id}}
|
||||
%td{ 'ng-show' => 'el.is_submodule && !el.submodule.url' }
|
||||
{{el.submodule.name+' @ '+el.submodule.id}}
|
||||
%td{ 'ng-show' => '!el.submodule' }
|
||||
%span
|
||||
%i.fa.text-primary{ 'ng-class' => 'el.node.class_name' }
|
||||
%a{ 'ng-href' => '{{el.node.url}}', 'ng-click' => 'getTree($event, el.node.path)' } {{el.node.name}}
|
||||
%td{ 'ng-show' => 'el.commit' }
|
||||
%a{ 'ng-href' => '{{el.commit.url}}' } {{el.commit.short_message}}
|
||||
%td{ 'ng-show' => 'el.commit' }
|
||||
%span{ 'am-time-ago' => 'el.commit.committed_date', title: "{{issue.committed_date | amDateFormat:'ddd, LLL'}}" }
|
||||
%td{ 'ng-hide' => 'el.commit' }
|
||||
%td{ 'ng-hide' => 'el.commit' }
|
||||
|
|
|
@ -1,8 +1,67 @@
|
|||
json.project do
|
||||
json.(@project, :id, :name)
|
||||
json.fullname @project.name_with_owner
|
||||
json.fullname '!!!!!!!!!' #@project.name_with_owner
|
||||
|
||||
json.owner do
|
||||
json.(@project.owner, :id, :name, :uname)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
json.tree do
|
||||
json.array!@project.tree_info(@tree, @treeish, @path).each do |node, node_path, commit|
|
||||
if node.is_a? Grit::Submodule
|
||||
url = submodule_url(node, @treeish)
|
||||
json.submodule do
|
||||
json.url url
|
||||
json.name node.name
|
||||
json.tree_url "#{url}/tree/#{node.id}"
|
||||
json.id node.id[0..6]
|
||||
end
|
||||
else
|
||||
|
||||
json.node do
|
||||
options = [@project, @treeish, node_path]
|
||||
if node.is_a?(Grit::Tree)
|
||||
json.class_name 'fa-folder'
|
||||
json.url tree_path *options
|
||||
else
|
||||
json.class_name 'fa-file-text-o'
|
||||
json.url blob_path(*options)
|
||||
end
|
||||
json.name node.name
|
||||
json.path node_path
|
||||
end
|
||||
end
|
||||
if commit
|
||||
json.commit do
|
||||
json.committed_date commit.committed_date
|
||||
json.short_message commit.short_message
|
||||
json.url commit_path(@project, commit)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
json.tree_breadcrumb do
|
||||
if @path.present?
|
||||
paths = File.split(@path)
|
||||
if paths.size > 1 && paths.first != '.'
|
||||
json.elements do
|
||||
json.array! paths.first.split(File::SEPARATOR).each do |a, name|
|
||||
if name != '.' && name != '..'
|
||||
path = File.join(a, name)
|
||||
path = path[1..-1] if path[0] == File::SEPARATOR
|
||||
if path.length > 1
|
||||
json.name path
|
||||
json.path name
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
json.last paths.last
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
json.path @path
|
||||
json.root_path @path.present? ? File.join([@path, ".."].compact) : nil
|
||||
|
|
|
@ -1,28 +1,27 @@
|
|||
-if !presenter.is_reference_to_issue || can?(:show, presenter.reference_project)
|
||||
.activity{id: presenter.comment_id? ? presenter.comment_anchor : ''}
|
||||
.top
|
||||
- if presenter.buttons?
|
||||
%span.buttons= raw presenter.buttons.join(' | ').html_safe
|
||||
.image
|
||||
%img{alt: "avatar", src: presenter.image}
|
||||
.text
|
||||
-#.imaged move up a line.
|
||||
%span.name= presenter.header
|
||||
.both
|
||||
= datetime_moment presenter.date, tag: :span, class: :date
|
||||
.both
|
||||
.panel.panel-default{id: presenter.comment_id? ? presenter.comment_anchor : ''}
|
||||
.panel-body
|
||||
.pull-left.roffset5
|
||||
%img{ alt: 'avatar', src: presenter.image }
|
||||
.pull-left
|
||||
%strong= presenter.header
|
||||
- if presenter.buttons?
|
||||
%span.pull-right= raw presenter.buttons.join(' | ').html_safe
|
||||
|
||||
= "(#{datetime_moment(presenter.date, tag: :strong)})".html_safe
|
||||
- if presenter.caption?
|
||||
%span.subject= presenter.caption
|
||||
.clearfix
|
||||
%span= presenter.caption
|
||||
- if presenter.expandable? and presenter.content?
|
||||
%span.data-expander.collapsed{id: "expand#{item_no}"}
|
||||
.both
|
||||
.both
|
||||
- if presenter.content?
|
||||
%div
|
||||
=presenter.issue_referenced_state if presenter.issue_referenced_state?
|
||||
.fulltext{class: "#{presenter.expandable? ? "hidden" : ''} #{presenter.caption? ? "" : "alone"}",
|
||||
id: presenter.expandable? ? "content-expand#{item_no}" : ''}
|
||||
.md_and_cm{class: presenter.is_reference_to_issue ? '' : 'cm-s-default'}
|
||||
= preserve do
|
||||
= presenter.is_reference_to_issue ? presenter.content : markdown(presenter.content)
|
||||
.both
|
||||
|
||||
.clearfix
|
||||
- if presenter.content?
|
||||
%div
|
||||
=presenter.issue_referenced_state if presenter.issue_referenced_state?
|
||||
.fulltext{class: "#{presenter.expandable? ? "hidden" : ''} #{presenter.caption? ? "" : "alone"}",
|
||||
id: presenter.expandable? ? "content-expand#{item_no}" : ''}
|
||||
.md_and_cm{class: presenter.is_reference_to_issue ? '' : 'cm-s-default'}
|
||||
= preserve do
|
||||
= presenter.is_reference_to_issue ? presenter.content : markdown(presenter.content)
|
||||
.clearfix
|
||||
|
|
|
@ -60,6 +60,7 @@ en:
|
|||
git_help:
|
||||
cloning: Cloning the repository
|
||||
remote: Add this repository as a remote to an existing local repository
|
||||
question_title: Copy to clipboard
|
||||
|
||||
diff_show_header: "%{files} with %{additions} and %{deletions}."
|
||||
about_subheader: "About project"
|
||||
|
|
|
@ -75,6 +75,7 @@ ru:
|
|||
git_help:
|
||||
cloning: Клонирование этого репозитория
|
||||
remote: Добавление этого репозитория как удаленного к существующему локальному репозиторию
|
||||
question_title: Скопировать в буфер обмена
|
||||
|
||||
public: Публичные
|
||||
private: Приватные
|
||||
|
|
Loading…
Reference in New Issue