Browse Source

Page: Repository home page

pull/498/head
Unknwon 10 years ago
parent
commit
a1109e6fbc
  1. 9
      conf/locale/locale_en-US.ini
  2. 9
      conf/locale/locale_zh-CN.ini
  3. 5
      modules/middleware/repo.go
  4. 7
      public/ng/css/gogs.css
  5. 20
      public/ng/js/gogs.js
  6. 10
      public/ng/js/min/gogs-min.js
  7. 7
      public/ng/less/gogs/repository.less
  8. 25
      templates/repo/home.tmpl
  9. 8
      templates/repo/sidebar.tmpl

9
conf/locale/locale_en-US.ini

@ -249,6 +249,15 @@ clone_this_repo = Clone this repository
create_new_repo_command = Create a new repository on the command line create_new_repo_command = Create a new repository on the command line
push_exist_repo = Push an existing repository from 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 = Settings
settings.options = Options settings.options = Options
settings.collaboration = Collaboration settings.collaboration = Collaboration

9
conf/locale/locale_zh-CN.ini

@ -249,6 +249,15 @@ clone_this_repo = 克隆当前仓库
create_new_repo_command = 从命令行创建一个新的仓库 create_new_repo_command = 从命令行创建一个新的仓库
push_exist_repo = 从命令行推送已经创建的仓库 push_exist_repo = 从命令行推送已经创建的仓库
branch = 分支
tree = 目录树
branch_and_tags = 分支与标签
branches = 分支列表
tags = 标签列表
issues = 工单管理
commits = 提交历史
releases = 版本发布
settings = 仓库设置 settings = 仓库设置
settings.options = 基本设置 settings.options = 基本设置
settings.collaboration = 管理协作者 settings.collaboration = 管理协作者

5
modules/middleware/repo.go

@ -168,6 +168,7 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
ctx.Handle(500, "GetTags", err) ctx.Handle(500, "GetTags", err)
return return
} }
ctx.Data["Tags"] = tags
ctx.Repo.Repository.NumTags = len(tags) ctx.Repo.Repository.NumTags = len(tags)
ctx.Data["Title"] = u.Name + "/" + repo.Name 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["IsBranch"] = ctx.Repo.IsBranch
ctx.Data["IsTag"] = ctx.Repo.IsTag
ctx.Data["IsCommit"] = ctx.Repo.IsCommit ctx.Data["IsCommit"] = ctx.Repo.IsCommit
ctx.Repo.CommitsCount, err = ctx.Repo.Commit.CommitsCount() 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 ctx.Data["TagName"] = ctx.Repo.TagName
brs, err := ctx.Repo.GitRepo.GetBranches() brs, err := ctx.Repo.GitRepo.GetBranches()
if err != nil { if err != nil {
log.Error(4, "GetBranches: %v", err) ctx.Handle(500, "GetBranches", err)
return
} }
ctx.Data["Branches"] = brs ctx.Data["Branches"] = brs
ctx.Data["BrancheCount"] = len(brs) ctx.Data["BrancheCount"] = len(brs)

7
public/ng/css/gogs.css

@ -1156,6 +1156,10 @@ The register and sign-in page style
background-color: #EEE; background-color: #EEE;
font-weight: bold; font-weight: bold;
} }
#repo-branch-tag .switching-list {
max-height: 300px;
overflow-y: auto;
}
#repo-branch-list li i, #repo-branch-list li i,
#repo-tag-list li i { #repo-tag-list li i {
margin-right: 12px; margin-right: 12px;
@ -1165,9 +1169,6 @@ The register and sign-in page style
#repo-tag-list li.checked i { #repo-tag-list li.checked i {
opacity: 1; opacity: 1;
} }
#repo-tag-list {
display: none;
}
#repo-bread .bread { #repo-bread .bread {
padding-right: 0; padding-right: 0;
font-size: 16px; font-size: 16px;

20
public/ng/js/gogs.js

@ -263,13 +263,12 @@ var Gogs = {};
return str; return str;
}, },
afterCopy: function () { 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 () { setTimeout(function () {
$this.tipsy("show"); $(this).tipsy("show");
}, 200); }, 200);
setTimeout(function () { setTimeout(function () {
$this.tipsy('hide').attr('original-title', $this.data('original-title')); $(this).tipsy('hide').attr('original-title', $this.data('original-title'));
}, 3000); }, 3000);
} }
}).addClass("js-copy-bind"); }).addClass("js-copy-bind");
@ -279,6 +278,18 @@ var Gogs = {};
function initCore() { function initCore() {
Gogs.renderMarkdown(); Gogs.renderMarkdown();
Gogs.renderCodeView(); 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() { function initUserSetting() {
@ -341,6 +352,7 @@ function initRepo() {
$('#repo-clone-url').val($(this).data('link')); $('#repo-clone-url').val($(this).data('link'));
$('.clone-url').text($(this).data('link')) $('.clone-url').text($(this).data('link'))
}); });
// Copy URL. // Copy URL.
var $clone_btn = $('#repo-clone-copy'); var $clone_btn = $('#repo-clone-copy');
$clone_btn.hover(function () { $clone_btn.hover(function () {

10
public/ng/js/min/gogs-min.js vendored

File diff suppressed because one or more lines are too long

7
public/ng/less/gogs/repository.less

@ -209,6 +209,10 @@
font-weight: bold; font-weight: bold;
} }
} }
.switching-list {
max-height: 300px;
overflow-y: auto;
}
} }
#repo-branch-list, #repo-branch-list,
#repo-tag-list { #repo-tag-list {
@ -224,9 +228,6 @@
} }
} }
} }
#repo-tag-list {
display: none;
}
#repo-bread { #repo-bread {
.bread { .bread {
padding-right: 0; padding-right: 0;

25
templates/repo/home.tmpl

@ -15,31 +15,30 @@
</a> </a>
</li> --> </li> -->
<li id="repo-branch-switch" class="down drop"> <li id="repo-branch-switch" class="down drop">
<a href="#"> <a>
<button class="btn btn-gray btn-small btn-radius"> <button class="btn btn-gray btn-medium btn-radius">
<i class="octicon octicon-git-branch"></i> {{if .IsViewBranch}}Branch{{else}}Tree{{end}}: <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> <strong id="repo-branch-current">{{if .IsViewBranch}}{{.BranchName}}{{else}}{{ShortSha .BranchName}}{{end}}</strong>
</button> </button>
</a> </a>
<div class="drop-down panel"> <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"/> --> <!-- <input id="repo-branch-filter-ipt" class="ipt ipt-large" type="text" placeholder="find branches / tags"/> -->
<div id="repo-branch-tag"> <div id="repo-branch-tag">
<ul class="menu menu-line tab-nav clear" id="repo-branch-tab-nav"> <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 {{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 left" data-tab-target="#repo-tag-list"><a href="#">Tags</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>
<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}} {{range .Branches}}
<li {{if eq . $.BranchName}}class="checked"{{end}}><a href="{{$.RepoLink}}/src/{{.}}"><i class="octicon octicon-check"></i>{{.}}</a></li> <li {{if eq . $.BranchName}}class="checked"{{end}}><a href="{{$.RepoLink}}/src/{{.}}"><i class="octicon octicon-check"></i>{{.}}</a></li>
{{end}} {{end}}
</ul> </ul>
<!-- <ul class="menu menu-vertical switching-list" id="repo-tag-list"> <ul class="menu menu-vertical switching-list {{if not .IsTag}}hide{{end}}" id="repo-tag-list">
<li><a href="#"><i class="octicon octicon-check"></i>0.3.3</a></li> {{range .Tags}}
<li><a href="#"><i class="octicon octicon-check"></i>0.4.4</a></li> <li {{if eq . $.BranchName}}class="checked"{{end}}><a href="{{$.RepoLink}}/src/{{.}}"><i class="octicon octicon-check"></i>{{.}}</a></li>
<li class="checked"><a href="#"><i class="octicon octicon-check"></i>0.1</a></li> {{end}}
<li><a href="#"><i class="octicon octicon-check"></i>0.1 beta</a></li> </ul>
</ul> -->
</div> </div>
</div> </div>
</li> </li>

8
templates/repo/sidebar.tmpl

@ -1,7 +1,7 @@
<div id="repo-sidebar" class="right grid-1-5"> <div id="repo-sidebar" class="right grid-1-5">
<ul class="menu menu-vertical" id="repo-sidebar-nav"> <ul class="menu menu-vertical" id="repo-sidebar-nav">
<li> <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>
<!-- <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> <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="border-bottom"></li>
<li class="head">{{if .IsViewBranch}}{{.BranchName}}{{else}}{{ShortSha .BranchName}}{{end}}</li> <li class="head">{{if .IsViewBranch}}{{.BranchName}}{{else}}{{ShortSha .BranchName}}{{end}}</li>
<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>
<!-- <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> <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> -->
<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>
<!-- <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> <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> -->
<li class="border-bottom"></li> <li class="border-bottom"></li>
<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> </li>
</ul> </ul>
</div> </div>
Loading…
Cancel
Save