@@ -249,6 +249,15 @@ clone_this_repo = Clone this repository | |||
create_new_repo_command = Create a new repository on the command line | |||
push_exist_repo = Push an existing repository from the command line | |||
branch = Branch | |||
tree = Tree | |||
branch_and_tags = Branches & Tags | |||
branches = Branches | |||
tags = Tags | |||
issues = Issues | |||
commits = Commits | |||
releases = Releases | |||
settings = Settings | |||
settings.options = Options | |||
settings.collaboration = Collaboration | |||
@@ -249,6 +249,15 @@ clone_this_repo = 克隆当前仓库 | |||
create_new_repo_command = 从命令行创建一个新的仓库 | |||
push_exist_repo = 从命令行推送已经创建的仓库 | |||
branch = 分支 | |||
tree = 目录树 | |||
branch_and_tags = 分支与标签 | |||
branches = 分支列表 | |||
tags = 标签列表 | |||
issues = 工单管理 | |||
commits = 提交历史 | |||
releases = 版本发布 | |||
settings = 仓库设置 | |||
settings.options = 基本设置 | |||
settings.collaboration = 管理协作者 | |||
@@ -168,6 +168,7 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler { | |||
ctx.Handle(500, "GetTags", err) | |||
return | |||
} | |||
ctx.Data["Tags"] = tags | |||
ctx.Repo.Repository.NumTags = len(tags) | |||
ctx.Data["Title"] = u.Name + "/" + repo.Name | |||
@@ -251,6 +252,7 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler { | |||
} | |||
ctx.Data["IsBranch"] = ctx.Repo.IsBranch | |||
ctx.Data["IsTag"] = ctx.Repo.IsTag | |||
ctx.Data["IsCommit"] = ctx.Repo.IsCommit | |||
ctx.Repo.CommitsCount, err = ctx.Repo.Commit.CommitsCount() | |||
@@ -278,7 +280,8 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler { | |||
ctx.Data["TagName"] = ctx.Repo.TagName | |||
brs, err := ctx.Repo.GitRepo.GetBranches() | |||
if err != nil { | |||
log.Error(4, "GetBranches: %v", err) | |||
ctx.Handle(500, "GetBranches", err) | |||
return | |||
} | |||
ctx.Data["Branches"] = brs | |||
ctx.Data["BrancheCount"] = len(brs) | |||
@@ -1156,6 +1156,10 @@ The register and sign-in page style | |||
background-color: #EEE; | |||
font-weight: bold; | |||
} | |||
#repo-branch-tag .switching-list { | |||
max-height: 300px; | |||
overflow-y: auto; | |||
} | |||
#repo-branch-list li i, | |||
#repo-tag-list li i { | |||
margin-right: 12px; | |||
@@ -1165,9 +1169,6 @@ The register and sign-in page style | |||
#repo-tag-list li.checked i { | |||
opacity: 1; | |||
} | |||
#repo-tag-list { | |||
display: none; | |||
} | |||
#repo-bread .bread { | |||
padding-right: 0; | |||
font-size: 16px; | |||
@@ -263,13 +263,12 @@ var Gogs = {}; | |||
return str; | |||
}, | |||
afterCopy: function () { | |||
var $this = $(this); | |||
$this.tipsy("hide").attr('original-title', $this.data('after-title')); | |||
$(this).tipsy("hide").attr('original-title', $this.data('after-title')); | |||
setTimeout(function () { | |||
$this.tipsy("show"); | |||
$(this).tipsy("show"); | |||
}, 200); | |||
setTimeout(function () { | |||
$this.tipsy('hide').attr('original-title', $this.data('original-title')); | |||
$(this).tipsy('hide').attr('original-title', $this.data('original-title')); | |||
}, 3000); | |||
} | |||
}).addClass("js-copy-bind"); | |||
@@ -279,6 +278,18 @@ var Gogs = {}; | |||
function initCore() { | |||
Gogs.renderMarkdown(); | |||
Gogs.renderCodeView(); | |||
// Switch list. | |||
$('.js-tab-nav').click(function (e) { | |||
if (!$(this).hasClass('js-tab-nav-show')) { | |||
$(this).parent().find('.js-tab-nav-show').each(function () { | |||
$(this).removeClass('js-tab-nav-show'); | |||
$($(this).data('tab-target')).hide(); | |||
}); | |||
$(this).addClass('js-tab-nav-show'); | |||
$($(this).data('tab-target')).show(); | |||
} | |||
}); | |||
} | |||
function initUserSetting() { | |||
@@ -341,6 +352,7 @@ function initRepo() { | |||
$('#repo-clone-url').val($(this).data('link')); | |||
$('.clone-url').text($(this).data('link')) | |||
}); | |||
// Copy URL. | |||
var $clone_btn = $('#repo-clone-copy'); | |||
$clone_btn.hover(function () { | |||
@@ -199,33 +199,34 @@ | |||
box-sizing: border-box; | |||
} | |||
#repo-branch-tag { | |||
.tab-nav { | |||
border-bottom: 1px solid #EAEAEA; | |||
a { | |||
padding: .3em .8em; | |||
.tab-nav { | |||
border-bottom: 1px solid #EAEAEA; | |||
a { | |||
padding: .3em .8em; | |||
} | |||
.js-tab-nav-show { | |||
background-color: #EEE; | |||
font-weight: bold; | |||
} | |||
} | |||
.js-tab-nav-show { | |||
background-color: #EEE; | |||
font-weight: bold; | |||
.switching-list { | |||
max-height: 300px; | |||
overflow-y: auto; | |||
} | |||
} | |||
} | |||
#repo-branch-list, | |||
#repo-tag-list { | |||
li { | |||
i { | |||
margin-right: 12px; | |||
opacity: 0; | |||
li { | |||
i { | |||
margin-right: 12px; | |||
opacity: 0; | |||
} | |||
} | |||
} | |||
li.checked { | |||
i { | |||
opacity: 1; | |||
li.checked { | |||
i { | |||
opacity: 1; | |||
} | |||
} | |||
} | |||
} | |||
#repo-tag-list { | |||
display: none; | |||
} | |||
#repo-bread { | |||
.bread { | |||
@@ -15,31 +15,30 @@ | |||
</a> | |||
</li> --> | |||
<li id="repo-branch-switch" class="down drop"> | |||
<a href="#"> | |||
<button class="btn btn-gray btn-small btn-radius"> | |||
<i class="octicon octicon-git-branch"></i> {{if .IsViewBranch}}Branch{{else}}Tree{{end}}: | |||
<a> | |||
<button class="btn btn-gray btn-medium btn-radius"> | |||
<i class="octicon octicon-git-branch"></i> {{if .IsViewBranch}}{{.i18n.Tr "repo.branch"}}{{else}}{{.i18n.Tr "repo.tree"}}{{end}}: | |||
<strong id="repo-branch-current">{{if .IsViewBranch}}{{.BranchName}}{{else}}{{ShortSha .BranchName}}{{end}}</strong> | |||
</button> | |||
</a> | |||
<div class="drop-down panel"> | |||
<p class="panel-header text-bold">Branches <!-- & Tags --></p> | |||
<p class="panel-header text-bold">{{.i18n.Tr "repo.branch_and_tags"}}</p> | |||
<!-- <input id="repo-branch-filter-ipt" class="ipt ipt-large" type="text" placeholder="find branches / tags"/> --> | |||
<div id="repo-branch-tag"> | |||
<ul class="menu menu-line tab-nav clear" id="repo-branch-tab-nav"> | |||
<li class="js-tab-nav js-tab-nav-show left" data-tab-target="#repo-branch-list"><a href="#">Branches</a></li> | |||
<!-- <li class="js-tab-nav left" data-tab-target="#repo-tag-list"><a href="#">Tags</a></li> --> | |||
<li class="js-tab-nav {{if not .IsTag}}js-tab-nav-show{{end}} left" data-tab-target="#repo-branch-list"><a>{{.i18n.Tr "repo.branches"}}</a></li> | |||
<li class="js-tab-nav {{if .IsTag}}js-tab-nav-show{{end}} left" data-tab-target="#repo-tag-list"><a>{{.i18n.Tr "repo.tags"}}</a></li> | |||
</ul> | |||
<ul class="menu menu-vertical switching-list" id="repo-branch-list"> | |||
<ul class="menu menu-vertical switching-list {{if .IsTag}}hide{{end}}" id="repo-branch-list"> | |||
{{range .Branches}} | |||
<li {{if eq . $.BranchName}}class="checked"{{end}}><a href="{{$.RepoLink}}/src/{{.}}"><i class="octicon octicon-check"></i>{{.}}</a></li> | |||
{{end}} | |||
</ul> | |||
<!-- <ul class="menu menu-vertical switching-list" id="repo-tag-list"> | |||
<li><a href="#"><i class="octicon octicon-check"></i>0.3.3</a></li> | |||
<li><a href="#"><i class="octicon octicon-check"></i>0.4.4</a></li> | |||
<li class="checked"><a href="#"><i class="octicon octicon-check"></i>0.1</a></li> | |||
<li><a href="#"><i class="octicon octicon-check"></i>0.1 beta</a></li> | |||
</ul> --> | |||
<ul class="menu menu-vertical switching-list {{if not .IsTag}}hide{{end}}" id="repo-tag-list"> | |||
{{range .Tags}} | |||
<li {{if eq . $.BranchName}}class="checked"{{end}}><a href="{{$.RepoLink}}/src/{{.}}"><i class="octicon octicon-check"></i>{{.}}</a></li> | |||
{{end}} | |||
</ul> | |||
</div> | |||
</div> | |||
</li> | |||
@@ -1,7 +1,7 @@ | |||
<div id="repo-sidebar" class="right grid-1-5"> | |||
<ul class="menu menu-vertical" id="repo-sidebar-nav"> | |||
<li> | |||
<a class="radius" href="{{.RepoLink}}/issues"><i class="octicon octicon-issue-opened"></i>Issues<span class="num right label label-blue label-radius">{{.Repository.NumOpenIssues}}</span></a> | |||
<a class="radius" href="{{.RepoLink}}/issues"><i class="octicon octicon-issue-opened"></i>{{.i18n.Tr "repo.issues"}}<span class="num right label label-blue label-radius">{{.Repository.NumOpenIssues}}</span></a> | |||
</li> | |||
<!-- <li> | |||
<a class="radius" href="{{.RepoLink}}/pulls"><i class="octicon octicon-git-pull-request"></i>Pull Requests<span class="num right label label-blue label-radius">{{.Repository.NumOpenPulls}}</span></a> | |||
@@ -9,20 +9,20 @@ | |||
<li class="border-bottom"></li> | |||
<li class="head">{{if .IsViewBranch}}{{.BranchName}}{{else}}{{ShortSha .BranchName}}{{end}}</li> | |||
<li> | |||
<a class="radius" href="{{.RepoLink}}/commits/{{.BranchName}}"><i class="octicon octicon-history"></i>Commits <span class="num right label label-gray label-radius">{{.CommitsCount}}</span></a> | |||
<a class="radius" href="{{.RepoLink}}/commits/{{.BranchName}}"><i class="octicon octicon-history"></i>{{.i18n.Tr "repo.commits"}} <span class="num right label label-gray label-radius">{{.CommitsCount}}</span></a> | |||
</li> | |||
<!-- <li> | |||
<a class="radius" href="{{.RepoLink}}/branches"><i class="octicon octicon-git-branch"></i>Branches<span class="num right label label-gray label-radius">{{.BrancheCount}}</span></a> | |||
</li> --> | |||
<li> | |||
<a class="radius" href="{{.RepoLink}}/releases"><i class="octicon octicon-tag"></i>Releases <span class="num right label label-gray label-radius">{{.Repository.NumTags}}</span></a> | |||
<a class="radius" href="{{.RepoLink}}/releases"><i class="octicon octicon-tag"></i>{{.i18n.Tr "repo.releases"}} <span class="num right label label-gray label-radius">{{.Repository.NumTags}}</span></a> | |||
</li> | |||
<!-- <li> | |||
<a class="radius" href="#"><i class="octicon octicon-organization"></i>contributors <span class="num right label label-gray label-radius">43</span></a> | |||
</li> --> | |||
<li class="border-bottom"></li> | |||
<li> | |||
<a class="radius" href="{{.RepoLink}}/settings"><i class="octicon octicon-tools"></i>settings</a> | |||
<a class="radius" href="{{.RepoLink}}/settings"><i class="octicon octicon-tools"></i>{{.i18n.Tr "repo.settings"}}</a> | |||
</li> | |||
</ul> | |||
</div> |