mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-23 10:31:31 +08:00
Finish new UI for release page
This commit is contained in:
parent
01ba771783
commit
bc8721fb6c
13
cmd/web.go
13
cmd/web.go
|
@ -397,14 +397,17 @@ func runWeb(*cli.Context) {
|
||||||
})
|
})
|
||||||
|
|
||||||
m.Post("/comment/:action", repo.Comment)
|
m.Post("/comment/:action", repo.Comment)
|
||||||
m.Get("/releases/new", repo.NewRelease)
|
|
||||||
m.Post("/releases/new", bindIgnErr(auth.NewReleaseForm{}), repo.NewReleasePost)
|
m.Group("/releases", func() {
|
||||||
m.Get("/releases/edit/:tagname", repo.EditRelease)
|
m.Get("/new", repo.NewRelease)
|
||||||
m.Post("/releases/edit/:tagname", bindIgnErr(auth.EditReleaseForm{}), repo.EditReleasePost)
|
m.Post("/new", bindIgnErr(auth.NewReleaseForm{}), repo.NewReleasePost)
|
||||||
|
m.Get("/edit/:tagname", repo.EditRelease)
|
||||||
|
m.Post("/edit/:tagname", bindIgnErr(auth.EditReleaseForm{}), repo.EditReleasePost)
|
||||||
|
}, middleware.RepoRef())
|
||||||
}, reqSignIn, middleware.RepoAssignment(true))
|
}, reqSignIn, middleware.RepoAssignment(true))
|
||||||
|
|
||||||
m.Group("/:username/:reponame", func() {
|
m.Group("/:username/:reponame", func() {
|
||||||
m.Get("/releases", repo.Releases)
|
m.Get("/releases", middleware.RepoRef(), repo.Releases)
|
||||||
m.Get("/issues", repo.Issues)
|
m.Get("/issues", repo.Issues)
|
||||||
m.Get("/issues/:index", repo.ViewIssue)
|
m.Get("/issues/:index", repo.ViewIssue)
|
||||||
m.Get("/issues/milestones", repo.Milestones)
|
m.Get("/issues/milestones", repo.Milestones)
|
||||||
|
|
|
@ -377,6 +377,30 @@ diff.stats_desc = <strong> %d changed files</strong> with <strong>%d additions</
|
||||||
diff.bin = BIN
|
diff.bin = BIN
|
||||||
diff.view_file = View File
|
diff.view_file = View File
|
||||||
|
|
||||||
|
release.releases = Releases
|
||||||
|
release.new_release = New Release
|
||||||
|
release.draft = Draft
|
||||||
|
release.prerelease = Pre-Release
|
||||||
|
release.stable = Stable
|
||||||
|
release.edit = edit
|
||||||
|
release.ahead = <strong>%d</strong> commits to %s since this release
|
||||||
|
release.source_code = Source Code
|
||||||
|
release.tag_name = Tag name
|
||||||
|
release.target = Target
|
||||||
|
release.tag_helper = Choose an existing tag, or create a new tag on publish.
|
||||||
|
release.release_title = Release title
|
||||||
|
release.content_with_md = Content with <a href="%s">Markdown</a>
|
||||||
|
release.write = Write
|
||||||
|
release.preview = Preview
|
||||||
|
release.content_placeholder = Write some content
|
||||||
|
release.loading = Loading...
|
||||||
|
release.prerelease_desc = This is a pre-release
|
||||||
|
release.prerelease_helper = We’ll point out that this release is identified as non-production ready.
|
||||||
|
release.publish = Publish Release
|
||||||
|
release.save_draft = Save Draft
|
||||||
|
release.edit_release = Edit Release
|
||||||
|
release.tag_name_already_exist = Release with this tag name has already existed.
|
||||||
|
|
||||||
[org]
|
[org]
|
||||||
org_name_holder = Organization Name
|
org_name_holder = Organization Name
|
||||||
org_name_helper = Great organization names are short and memorable.
|
org_name_helper = Great organization names are short and memorable.
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type MarkdownForm struct {
|
type MarkdownForm struct {
|
||||||
Text string `form:"text" binding:"Required"`
|
Text string `form:"text"`
|
||||||
Mode string `form:"mode"`
|
Mode string `form:"mode"`
|
||||||
Context string `form:"context"`
|
Context string `form:"context"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,7 +164,6 @@ func (f *NewReleaseForm) Validate(ctx *macaron.Context, errs binding.Errors) bin
|
||||||
}
|
}
|
||||||
|
|
||||||
type EditReleaseForm struct {
|
type EditReleaseForm struct {
|
||||||
Target string `form:"tag_target" binding:"Required"`
|
|
||||||
Title string `form:"title" binding:"Required"`
|
Title string `form:"title" binding:"Required"`
|
||||||
Content string `form:"content" binding:"Required"`
|
Content string `form:"content" binding:"Required"`
|
||||||
Draft string `form:"draft"`
|
Draft string `form:"draft"`
|
||||||
|
|
|
@ -1072,7 +1072,8 @@ The register and sign-in page style
|
||||||
text-overflow: clip;
|
text-overflow: clip;
|
||||||
}
|
}
|
||||||
#repo-content {
|
#repo-content {
|
||||||
padding: 18px 0;
|
padding-top: 18px;
|
||||||
|
padding-bottom: 18px;
|
||||||
}
|
}
|
||||||
.repo-wide-wrapper {
|
.repo-wide-wrapper {
|
||||||
padding: 18px;
|
padding: 18px;
|
||||||
|
@ -1353,31 +1354,54 @@ The register and sign-in page style
|
||||||
#repo-create-cancel {
|
#repo-create-cancel {
|
||||||
margin-left: 4em;
|
margin-left: 4em;
|
||||||
}
|
}
|
||||||
|
#release-new-target-branch-list,
|
||||||
#repo-create-owner-list {
|
#repo-create-owner-list {
|
||||||
top: 30px;
|
top: 30px;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: auto;
|
width: auto;
|
||||||
max-width: 300px;
|
max-width: 300px;
|
||||||
}
|
}
|
||||||
|
#release-new-target-branch-list .octicon,
|
||||||
#repo-create-owner-list .octicon {
|
#repo-create-owner-list .octicon {
|
||||||
margin-right: 12px;
|
margin-right: 12px;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
#release-new-target-branch-list .avatar,
|
||||||
#repo-create-owner-list .avatar {
|
#repo-create-owner-list .avatar {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
}
|
}
|
||||||
|
#release-new-target-branch-list li,
|
||||||
#repo-create-owner-list li {
|
#repo-create-owner-list li {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
#release-new-target-branch-list li.checked .octicon,
|
||||||
#repo-create-owner-list li.checked .octicon {
|
#repo-create-owner-list li.checked .octicon {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
#release-new-target-branch-list li a,
|
||||||
#repo-create-owner-list li a {
|
#repo-create-owner-list li a {
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
-o-text-overflow: ellipsis;
|
-o-text-overflow: ellipsis;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
#release-new-target-branch-list {
|
||||||
|
margin-top: -1px;
|
||||||
|
min-width: 150px;
|
||||||
|
}
|
||||||
|
#release-new-title {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
#release-new-content {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
#release-preview-btn .btn {
|
||||||
|
border-left: 0;
|
||||||
|
}
|
||||||
|
#release-preview.markdown {
|
||||||
|
margin-top: 5px;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
.file-name {
|
.file-name {
|
||||||
margin-left: 1em;
|
margin-left: 1em;
|
||||||
}
|
}
|
||||||
|
@ -1622,6 +1646,87 @@ The register and sign-in page style
|
||||||
margin-left: 44px;
|
margin-left: 44px;
|
||||||
margin-top: -15px;
|
margin-top: -15px;
|
||||||
}
|
}
|
||||||
|
#release h4 {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
#release h4 small {
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 1;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
#release #release-head {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 0;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
border-bottom: 1px solid #DDD;
|
||||||
|
}
|
||||||
|
#release #release-head .btn {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
#release .release-item > div {
|
||||||
|
padding-top: 20px;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
}
|
||||||
|
#release .release-item .label-green:hover {
|
||||||
|
background-color: #65ad4e;
|
||||||
|
}
|
||||||
|
#release .release-item .release-meta {
|
||||||
|
position: relative;
|
||||||
|
float: left;
|
||||||
|
padding-right: 15px;
|
||||||
|
}
|
||||||
|
#release .release-item .tag,
|
||||||
|
#release .release-item .commit {
|
||||||
|
display: block;
|
||||||
|
margin-top: 12px;
|
||||||
|
line-height: 20px;
|
||||||
|
}
|
||||||
|
#release .release-item .release-detail {
|
||||||
|
margin-top: -1px;
|
||||||
|
border-left: 1px solid #DDD;
|
||||||
|
position: relative;
|
||||||
|
float: left;
|
||||||
|
padding-left: 15px;
|
||||||
|
}
|
||||||
|
#release .release-item .title {
|
||||||
|
line-height: 25px;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
#release .release-item p.info {
|
||||||
|
line-height: 20px;
|
||||||
|
color: #666;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
#release .release-item p.info > * {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
#release .release-item .author img {
|
||||||
|
margin-top: -3px;
|
||||||
|
}
|
||||||
|
#release .release-item div.desc {
|
||||||
|
margin-bottom: 25px;
|
||||||
|
}
|
||||||
|
#release .release-item div.desc.markdown {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
#release .release-item .download a {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
#release .release-item .dot {
|
||||||
|
width: 9px;
|
||||||
|
height: 9px;
|
||||||
|
background-color: #ccc;
|
||||||
|
z-index: 999;
|
||||||
|
position: absolute;
|
||||||
|
display: block;
|
||||||
|
left: -6px;
|
||||||
|
top: 27px;
|
||||||
|
border-radius: 6px;
|
||||||
|
border: 1px solid #FFF;
|
||||||
|
}
|
||||||
|
#release #release-new-form {
|
||||||
|
padding-top: 15px;
|
||||||
|
}
|
||||||
#admin-wrapper,
|
#admin-wrapper,
|
||||||
#setting-wrapper {
|
#setting-wrapper {
|
||||||
padding-bottom: 100px;
|
padding-bottom: 100px;
|
||||||
|
|
|
@ -379,6 +379,7 @@ dt {
|
||||||
}
|
}
|
||||||
.btn-large {
|
.btn-large {
|
||||||
font-size: 14.4px;
|
font-size: 14.4px;
|
||||||
|
padding: .4em .9em;
|
||||||
}
|
}
|
||||||
.btn-green {
|
.btn-green {
|
||||||
background-color: #65ad4e;
|
background-color: #65ad4e;
|
||||||
|
|
|
@ -403,6 +403,16 @@ function initRepo() {
|
||||||
$clone_btn.tipsy({
|
$clone_btn.tipsy({
|
||||||
fade: true
|
fade: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Markdown preview.
|
||||||
|
$('.markdown-preview').click(function() {
|
||||||
|
var $this = $(this);
|
||||||
|
$this.toggleAjax(function (resp) {
|
||||||
|
$($this.data("preview")).html(resp);
|
||||||
|
}, function () {
|
||||||
|
$($this.data("preview")).html("no content");
|
||||||
|
})
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// when user changes hook type, hide/show proper divs
|
// when user changes hook type, hide/show proper divs
|
||||||
|
@ -423,6 +433,13 @@ function initHookTypeChange() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function initRepoRelease() {
|
||||||
|
$('#release-new-target-branch-list li').click(function() {
|
||||||
|
$('#repo-branch-current').text($(this).text());
|
||||||
|
$('#tag-target').val($(this).text());
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function initRepoSetting() {
|
function initRepoSetting() {
|
||||||
// Options.
|
// Options.
|
||||||
// Confirmation of changing repository name.
|
// Confirmation of changing repository name.
|
||||||
|
@ -753,8 +770,12 @@ $(document).ready(function () {
|
||||||
initRepoCreate();
|
initRepoCreate();
|
||||||
}
|
}
|
||||||
if ($('#repo-header').length) {
|
if ($('#repo-header').length) {
|
||||||
|
initTimeSwitch();
|
||||||
initRepo();
|
initRepo();
|
||||||
}
|
}
|
||||||
|
if ($('#release').length) {
|
||||||
|
initRepoRelease();
|
||||||
|
}
|
||||||
if ($('#repo-setting').length) {
|
if ($('#repo-setting').length) {
|
||||||
initRepoSetting();
|
initRepoSetting();
|
||||||
}
|
}
|
||||||
|
@ -819,3 +840,7 @@ function homepage() {
|
||||||
$('#promo-form').attr('action', Gogs.AppSubUrl + '/user/sign_up');
|
$('#promo-form').attr('action', Gogs.AppSubUrl + '/user/sign_up');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String.prototype.endsWith = function (suffix) {
|
||||||
|
return this.indexOf(suffix, this.length - suffix.length) !== -1;
|
||||||
|
};
|
||||||
|
|
8
public/ng/js/min/gogs-min.js
vendored
8
public/ng/js/min/gogs-min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -90,7 +90,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#repo-content {
|
#repo-content {
|
||||||
padding: 18px 0;
|
padding-top: 18px;
|
||||||
|
padding-bottom: 18px;
|
||||||
}
|
}
|
||||||
.repo-wide-wrapper {
|
.repo-wide-wrapper {
|
||||||
padding: 18px;
|
padding: 18px;
|
||||||
|
@ -383,6 +384,7 @@
|
||||||
#repo-create-cancel {
|
#repo-create-cancel {
|
||||||
margin-left: 4em;
|
margin-left: 4em;
|
||||||
}
|
}
|
||||||
|
#release-new-target-branch-list,
|
||||||
#repo-create-owner-list {
|
#repo-create-owner-list {
|
||||||
top: 30px;
|
top: 30px;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
@ -410,6 +412,23 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#release-new-target-branch-list {
|
||||||
|
margin-top: -1px;
|
||||||
|
min-width: 150px;
|
||||||
|
}
|
||||||
|
#release-new-title {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
#release-new-content {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
#release-preview-btn .btn {
|
||||||
|
border-left: 0;
|
||||||
|
}
|
||||||
|
#release-preview.markdown {
|
||||||
|
margin-top: 5px;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
.file-name {
|
.file-name {
|
||||||
margin-left: 1em;
|
margin-left: 1em;
|
||||||
}
|
}
|
||||||
|
@ -666,3 +685,90 @@
|
||||||
margin-left: 44px;
|
margin-left: 44px;
|
||||||
margin-top: -15px;
|
margin-top: -15px;
|
||||||
}
|
}
|
||||||
|
#release {
|
||||||
|
h4 {
|
||||||
|
font-size: 18px;
|
||||||
|
small {
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 1;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#release-head {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 0;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
border-bottom: 1px solid #DDD;
|
||||||
|
.btn {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.release-item {
|
||||||
|
&>div {
|
||||||
|
padding-top: 20px;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
}
|
||||||
|
.label-green:hover {
|
||||||
|
background-color: @labelGreenColor;
|
||||||
|
}
|
||||||
|
.release-meta {
|
||||||
|
position: relative;
|
||||||
|
float: left;
|
||||||
|
padding-right: 15px;
|
||||||
|
}
|
||||||
|
.tag,
|
||||||
|
.commit {
|
||||||
|
display: block;
|
||||||
|
margin-top: 12px;
|
||||||
|
line-height: 20px;
|
||||||
|
}
|
||||||
|
.release-detail {
|
||||||
|
margin-top: -1px;
|
||||||
|
border-left: 1px solid #DDD;
|
||||||
|
position: relative;
|
||||||
|
float: left;
|
||||||
|
padding-left: 15px;
|
||||||
|
}
|
||||||
|
.title {
|
||||||
|
line-height: 25px;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
p.info {
|
||||||
|
line-height: 20px;
|
||||||
|
color: #666;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
>* {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.author {
|
||||||
|
img {
|
||||||
|
margin-top: -3px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
div.desc {
|
||||||
|
margin-bottom: 25px;
|
||||||
|
&.markdown {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.download a {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
.dot {
|
||||||
|
width: 9px;
|
||||||
|
height: 9px;
|
||||||
|
background-color: #ccc;
|
||||||
|
z-index: 999;
|
||||||
|
position: absolute;
|
||||||
|
display: block;
|
||||||
|
left: -6px;
|
||||||
|
top: 27px;
|
||||||
|
border-radius: 6px;
|
||||||
|
border: 1px solid #FFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#release-new-form {
|
||||||
|
padding-top: 15px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
}
|
}
|
||||||
.btn-large {
|
.btn-large {
|
||||||
font-size: 1.2*@baseFontSize;
|
font-size: 1.2*@baseFontSize;
|
||||||
|
padding: .4em .9em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-green {
|
.btn-green {
|
||||||
|
|
|
@ -20,6 +20,11 @@ func Markdown(ctx *middleware.Context, form apiv1.MarkdownForm) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(form.Text) == 0 {
|
||||||
|
ctx.Write([]byte(""))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
switch form.Mode {
|
switch form.Mode {
|
||||||
case "gfm":
|
case "gfm":
|
||||||
ctx.Write(base.RenderMarkdown([]byte(form.Text),
|
ctx.Write(base.RenderMarkdown([]byte(form.Text),
|
||||||
|
|
|
@ -19,7 +19,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
func Releases(ctx *middleware.Context) {
|
func Releases(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = "Releases"
|
ctx.Data["Title"] = ctx.Tr("repo.release.releases")
|
||||||
ctx.Data["IsRepoToolbarReleases"] = true
|
ctx.Data["IsRepoToolbarReleases"] = true
|
||||||
ctx.Data["IsRepoReleaseNew"] = false
|
ctx.Data["IsRepoReleaseNew"] = false
|
||||||
|
|
||||||
|
@ -35,35 +35,13 @@ func Releases(ctx *middleware.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get default branch.
|
|
||||||
refName := ctx.Repo.Repository.DefaultBranch
|
|
||||||
if !ctx.Repo.GitRepo.IsBranchExist(refName) {
|
|
||||||
brs, err := ctx.Repo.GitRepo.GetBranches()
|
|
||||||
if err != nil {
|
|
||||||
ctx.Handle(500, "GetBranches", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
refName = brs[0]
|
|
||||||
}
|
|
||||||
commit, err := ctx.Repo.GitRepo.GetCommitOfBranch(refName)
|
|
||||||
if err != nil {
|
|
||||||
ctx.Handle(500, "GetCommitOfBranch", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
commitsCount, err := commit.CommitsCount()
|
|
||||||
if err != nil {
|
|
||||||
ctx.Handle(500, "CommitsCount", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Temproray cache commits count of used branches to speed up.
|
// Temproray cache commits count of used branches to speed up.
|
||||||
countCache := make(map[string]int)
|
countCache := make(map[string]int)
|
||||||
|
|
||||||
tags := make([]*models.Release, len(rawTags))
|
tags := make([]*models.Release, len(rawTags))
|
||||||
for i, rawTag := range rawTags {
|
for i, rawTag := range rawTags {
|
||||||
for _, rel := range rels {
|
for j, rel := range rels {
|
||||||
if rel.IsDraft && !ctx.Repo.IsOwner {
|
if rel == nil || (rel.IsDraft && !ctx.Repo.IsOwner) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if rel.TagName == rawTag {
|
if rel.TagName == rawTag {
|
||||||
|
@ -72,6 +50,7 @@ func Releases(ctx *middleware.Context) {
|
||||||
ctx.Handle(500, "GetUserById", err)
|
ctx.Handle(500, "GetUserById", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// FIXME: duplicated code.
|
||||||
// Get corresponding target if it's not the current branch.
|
// Get corresponding target if it's not the current branch.
|
||||||
if ctx.Repo.BranchName != rel.Target {
|
if ctx.Repo.BranchName != rel.Target {
|
||||||
// Get count if not exists.
|
// Get count if not exists.
|
||||||
|
@ -89,11 +68,12 @@ func Releases(ctx *middleware.Context) {
|
||||||
}
|
}
|
||||||
rel.NumCommitsBehind = countCache[ctx.Repo.BranchName] - rel.NumCommits
|
rel.NumCommitsBehind = countCache[ctx.Repo.BranchName] - rel.NumCommits
|
||||||
} else {
|
} else {
|
||||||
rel.NumCommitsBehind = commitsCount - rel.NumCommits
|
rel.NumCommitsBehind = ctx.Repo.CommitsCount - rel.NumCommits
|
||||||
}
|
}
|
||||||
|
|
||||||
rel.Note = base.RenderMarkdownString(rel.Note, ctx.Repo.RepoLink)
|
rel.Note = base.RenderMarkdownString(rel.Note, ctx.Repo.RepoLink)
|
||||||
tags[i] = rel
|
tags[i] = rel
|
||||||
|
rels[j] = nil // Mark as used.
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,9 +96,44 @@ func Releases(ctx *middleware.Context) {
|
||||||
ctx.Handle(500, "CommitsCount", err)
|
ctx.Handle(500, "CommitsCount", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
tags[i].NumCommitsBehind = commitsCount - tags[i].NumCommits
|
tags[i].NumCommitsBehind = ctx.Repo.CommitsCount - tags[i].NumCommits
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, rel := range rels {
|
||||||
|
if rel == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
rel.Publisher, err = models.GetUserById(rel.PublisherId)
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "GetUserById", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// FIXME: duplicated code.
|
||||||
|
// Get corresponding target if it's not the current branch.
|
||||||
|
if ctx.Repo.BranchName != rel.Target {
|
||||||
|
// Get count if not exists.
|
||||||
|
if _, ok := countCache[rel.Target]; !ok {
|
||||||
|
commit, err := ctx.Repo.GitRepo.GetCommitOfBranch(ctx.Repo.BranchName)
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "GetCommitOfBranch", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
countCache[ctx.Repo.BranchName], err = commit.CommitsCount()
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "CommitsCount2", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rel.NumCommitsBehind = countCache[ctx.Repo.BranchName] - rel.NumCommits
|
||||||
|
} else {
|
||||||
|
rel.NumCommitsBehind = ctx.Repo.CommitsCount - rel.NumCommits
|
||||||
|
}
|
||||||
|
|
||||||
|
rel.Note = base.RenderMarkdownString(rel.Note, ctx.Repo.RepoLink)
|
||||||
|
tags = append(tags, rel)
|
||||||
|
}
|
||||||
models.SortReleases(tags)
|
models.SortReleases(tags)
|
||||||
ctx.Data["Releases"] = tags
|
ctx.Data["Releases"] = tags
|
||||||
ctx.HTML(200, RELEASES)
|
ctx.HTML(200, RELEASES)
|
||||||
|
@ -130,7 +145,8 @@ func NewRelease(ctx *middleware.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Data["Title"] = "New Release"
|
ctx.Data["Title"] = ctx.Tr("repo.release.new_release")
|
||||||
|
ctx.Data["tag_target"] = ctx.Repo.Repository.DefaultBranch
|
||||||
ctx.Data["IsRepoToolbarReleases"] = true
|
ctx.Data["IsRepoToolbarReleases"] = true
|
||||||
ctx.Data["IsRepoReleaseNew"] = true
|
ctx.Data["IsRepoReleaseNew"] = true
|
||||||
ctx.HTML(200, RELEASE_NEW)
|
ctx.HTML(200, RELEASE_NEW)
|
||||||
|
@ -142,7 +158,7 @@ func NewReleasePost(ctx *middleware.Context, form auth.NewReleaseForm) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Data["Title"] = "New Release"
|
ctx.Data["Title"] = ctx.Tr("repo.release.new_release")
|
||||||
ctx.Data["IsRepoToolbarReleases"] = true
|
ctx.Data["IsRepoToolbarReleases"] = true
|
||||||
ctx.Data["IsRepoReleaseNew"] = true
|
ctx.Data["IsRepoReleaseNew"] = true
|
||||||
|
|
||||||
|
@ -183,9 +199,9 @@ func NewReleasePost(ctx *middleware.Context, form auth.NewReleaseForm) {
|
||||||
|
|
||||||
if err = models.CreateRelease(ctx.Repo.GitRepo, rel); err != nil {
|
if err = models.CreateRelease(ctx.Repo.GitRepo, rel); err != nil {
|
||||||
if err == models.ErrReleaseAlreadyExist {
|
if err == models.ErrReleaseAlreadyExist {
|
||||||
ctx.RenderWithErr("Release with this tag name has already existed", "release/new", &form)
|
ctx.RenderWithErr(ctx.Tr("repo.release.tag_name_already_exist"), RELEASE_NEW, &form)
|
||||||
} else {
|
} else {
|
||||||
ctx.Handle(500, "release.ReleasesNewPost(IsReleaseExist)", err)
|
ctx.Handle(500, "CreateRelease", err)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -204,15 +220,15 @@ func EditRelease(ctx *middleware.Context) {
|
||||||
rel, err := models.GetRelease(ctx.Repo.Repository.Id, tagName)
|
rel, err := models.GetRelease(ctx.Repo.Repository.Id, tagName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrReleaseNotExist {
|
if err == models.ErrReleaseNotExist {
|
||||||
ctx.Handle(404, "release.ReleasesEdit(GetRelease)", err)
|
ctx.Handle(404, "GetRelease", err)
|
||||||
} else {
|
} else {
|
||||||
ctx.Handle(500, "release.ReleasesEdit(GetRelease)", err)
|
ctx.Handle(500, "GetRelease", err)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ctx.Data["Release"] = rel
|
ctx.Data["Release"] = rel
|
||||||
|
|
||||||
ctx.Data["Title"] = "Edit Release"
|
ctx.Data["Title"] = ctx.Tr("repo.release.edit_release")
|
||||||
ctx.Data["IsRepoToolbarReleases"] = true
|
ctx.Data["IsRepoToolbarReleases"] = true
|
||||||
ctx.HTML(200, RELEASE_EDIT)
|
ctx.HTML(200, RELEASE_EDIT)
|
||||||
}
|
}
|
||||||
|
@ -227,9 +243,9 @@ func EditReleasePost(ctx *middleware.Context, form auth.EditReleaseForm) {
|
||||||
rel, err := models.GetRelease(ctx.Repo.Repository.Id, tagName)
|
rel, err := models.GetRelease(ctx.Repo.Repository.Id, tagName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrReleaseNotExist {
|
if err == models.ErrReleaseNotExist {
|
||||||
ctx.Handle(404, "release.EditReleasePost(GetRelease)", err)
|
ctx.Handle(404, "GetRelease", err)
|
||||||
} else {
|
} else {
|
||||||
ctx.Handle(500, "release.EditReleasePost(GetRelease)", err)
|
ctx.Handle(500, "GetRelease", err)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -240,7 +256,7 @@ func EditReleasePost(ctx *middleware.Context, form auth.EditReleaseForm) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Data["Title"] = "Edit Release"
|
ctx.Data["Title"] = ctx.Tr("repo.release.edit_release")
|
||||||
ctx.Data["IsRepoToolbarReleases"] = true
|
ctx.Data["IsRepoToolbarReleases"] = true
|
||||||
|
|
||||||
rel.Title = form.Title
|
rel.Title = form.Title
|
||||||
|
@ -248,7 +264,7 @@ func EditReleasePost(ctx *middleware.Context, form auth.EditReleaseForm) {
|
||||||
rel.IsDraft = len(form.Draft) > 0
|
rel.IsDraft = len(form.Draft) > 0
|
||||||
rel.IsPrerelease = form.Prerelease
|
rel.IsPrerelease = form.Prerelease
|
||||||
if err = models.UpdateRelease(ctx.Repo.GitRepo, rel); err != nil {
|
if err = models.UpdateRelease(ctx.Repo.GitRepo, rel); err != nil {
|
||||||
ctx.Handle(500, "release.EditReleasePost(UpdateRelease)", err)
|
ctx.Handle(500, "UpdateRelease", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ctx.Redirect(ctx.Repo.RepoLink + "/releases")
|
ctx.Redirect(ctx.Repo.RepoLink + "/releases")
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
</li>
|
</li>
|
||||||
<li id="repo-find-jump" class="repo-jump right">
|
<li id="repo-find-jump" class="repo-jump right">
|
||||||
<a href="#">
|
<a href="#">
|
||||||
<button class="btn btn-small btn btn-small btn-gray btn-left-radius"><i class="octicon octicon-list-unordered"></i></button>
|
<button class="btn btn-small btn-gray btn-left-radius"><i class="octicon octicon-list-unordered"></i></button>
|
||||||
</a>
|
</a>
|
||||||
</li> -->
|
</li> -->
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -1,70 +1,59 @@
|
||||||
{{template "base/head" .}}
|
{{template "ng/base/head" .}}
|
||||||
{{template "base/navbar" .}}
|
{{template "ng/base/header" .}}
|
||||||
{{template "repo/nav" .}}
|
<div id="repo-wrapper">
|
||||||
{{template "repo/toolbar" .}}
|
{{template "repo/header" .}}
|
||||||
<div id="body" class="container">
|
<div id="repo-content" class="clear container">
|
||||||
<div id="release">
|
<div id="repo-main" class="left grid-5-6">
|
||||||
<h4 id="release-head">Edit Release</h4>
|
{{template "ng/base/alert" .}}
|
||||||
{{template "base/alert" .}}
|
<div id="release">
|
||||||
<form id="release-new-form" action="{{.RepoLink}}/releases/edit/{{.Release.TagName}}" method="post" class="form form-inline">
|
<h4 id="release-head">{{.i18n.Tr "repo.release.edit_release"}}</h4>
|
||||||
{{.CsrfTokenHtml}}
|
<form class="form" id="release-new-form" action="{{.RepoLink}}/releases/edit/{{.Release.TagName}}" method="post">
|
||||||
<div class="form-group">
|
{{.CsrfTokenHtml}}
|
||||||
<b>{{.Release.TagName}}</b>
|
<div class="field">
|
||||||
<span class="target-at">@</span>
|
<b>{{.Release.TagName}}</b>
|
||||||
<div class="btn-group" id="release-new-target-select">
|
<span class="target-at">@</span>
|
||||||
<button type="button" class="btn btn-default"><i class="fa fa-code-fork fa-lg fa-m"></i>
|
<strong>{{.Repository.DefaultBranch}}</strong>
|
||||||
<span class="target-text">Target : </span>
|
|
||||||
<strong id="release-new-target-name"> {{.Release.Target}}</strong>
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
|
||||||
<span class="caret"></span>
|
|
||||||
</button>
|
|
||||||
<div class="dropdown-menu clone-group-btn" id="release-new-target-branch-list">
|
|
||||||
<ul class="list-group">
|
|
||||||
{{range .Branches}}
|
|
||||||
<li class="list-group-item">
|
|
||||||
<a href="#" rel="{{.}}"><i class="fa fa-code-fork"></i>{{.}}</a>
|
|
||||||
</li>
|
|
||||||
{{end}}
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
<input id="tag-target" type="hidden" name="tag_target" value="{{.Release.Target}}"/>
|
<div class="field">
|
||||||
</div>
|
<input class="ipt ipt-large ipt-radius grid-4-5" id="release-new-title" name="title" placeholder="{{.i18n.Tr "repo.release.release_title"}}" value="{{.Release.Title}}" required>
|
||||||
<p class="help-block">Choose an existing tag, or create a new tag on publish</p>
|
</div>
|
||||||
</div>
|
<br>
|
||||||
<div class="form-group" style="display: block">
|
<div class="field grid-4-5">
|
||||||
<input class="form-control input-lg" id="release-new-title" name="title" type="text" placeholder="release title" value="{{.Release.Title}}" />
|
<div class="md-help pull-right">
|
||||||
</div>
|
{{.i18n.Tr "repo.release.content_with_md" "https://help.github.com/articles/markdown-basics" | Str2html}}
|
||||||
<div class="form-group col-md-8" style="display: block" id="release-new-content-div">
|
</div>
|
||||||
<div class="md-help pull-right">
|
<div class="clear">
|
||||||
Content with <a href="https://help.github.com/articles/markdown-basics">Markdown</a>
|
<ul class="tab-nav list-unstyled">
|
||||||
</div>
|
<li class="js-tab-nav js-tab-nav-show left" data-tab-target="#release-textarea">
|
||||||
<ul class="nav nav-tabs" data-init="tabs">
|
<button class="btn btn-medium btn-gray btn-left-radius">{{.i18n.Tr "repo.release.write"}}</button>
|
||||||
<li class="release-write active"><a href="#release-textarea" data-toggle="tab">Write</a></li>
|
</li>
|
||||||
<li class="release-preview"><a href="#release-preview" data-toggle="tab" data-ajax="/api/v1/markdown" data-ajax-name="release-preview" data-ajax-context="{{.RepoLink}}" data-ajax-method="post" data-preview="#release-preview">Preview</a></li>
|
<li class="js-tab-nav left markdown-preview" id="release-preview-btn" data-tab-target="#release-preview" data-ajax="/api/v1/markdown" data-ajax-name="release-preview" data-ajax-context="{{.RepoLink}}" data-ajax-method="post" data-preview="#release-preview">
|
||||||
</ul>
|
<button class="btn btn-medium btn-gray btn-right-radius">{{.i18n.Tr "repo.release.preview"}}</button>
|
||||||
<div class="tab-content">
|
</li>
|
||||||
<div class="tab-pane active" id="release-textarea">
|
</ul>
|
||||||
<div class="form-group">
|
</div>
|
||||||
<textarea class="form-control" name="content" id="release-new-content" rows="10" placeholder="Write some content" data-ajax-rel="release-preview" data-ajax-val="val" data-ajax-field="text">{{.Release.Note}}</textarea>
|
<div id="release-textarea">
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="ipt ipt-large ipt-radius" name="content" id="release-new-content" rows="10" placeholder="{{.i18n.Tr "repo.release.content_placeholder"}}" data-ajax-rel="release-preview" data-ajax-val="val" data-ajax-field="text" required>{{.Release.Note}}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="markdown hide" id="release-preview">{{.i18n.Tr "repo.release.loading"}}...</div>
|
||||||
|
<br>
|
||||||
|
<hr>
|
||||||
|
<div class="text-right">
|
||||||
|
<input class="ipt-chk" name="prerelease" type="checkbox" {{if .Release.IsPrerelease}}checked{{end}}/>
|
||||||
|
<span><strong>{{.i18n.Tr "repo.release.prerelease_desc"}}</strong></span>
|
||||||
|
<p>{{.i18n.Tr "repo.release.prerelease_helper"}}</p>
|
||||||
|
<button class="btn btn-large btn-green btn-radius">Publish release</button>
|
||||||
|
{{if .Release.IsDraft}}
|
||||||
|
<input class="btn btn-large btn-gary btn-radius" type="submit" name="draft" value="{{.i18n.Tr "repo.release.save_draft"}}"/>
|
||||||
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane release-preview-content" id="release-preview">loading...</div>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="text-right form-group col-md-8" style="display: block">
|
</div>
|
||||||
<hr/>
|
{{template "repo/sidebar" .}}
|
||||||
<label for="release-new-pre-release">
|
|
||||||
<input id="release-new-pre-release" type="checkbox" name="prerelease" {{if .Release.IsPrerelease}}checked{{end}}/>
|
|
||||||
<strong>This is a pre-release</strong>
|
|
||||||
</label>
|
|
||||||
<p class="help-block">We’ll point out that this release is identified as non-production ready.</p>
|
|
||||||
</div>
|
|
||||||
<div class="text-right form-group col-md-8" style="display: block">
|
|
||||||
<button class="btn-success btn">Publish release</button>
|
|
||||||
<input class="btn btn-default" type="submit" name="draft" value="Save draft"/>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{template "base/footer" .}}
|
{{template "ng/base/footer" .}}
|
|
@ -1,62 +1,71 @@
|
||||||
{{template "base/head" .}}
|
{{template "ng/base/head" .}}
|
||||||
{{template "base/navbar" .}}
|
{{template "ng/base/header" .}}
|
||||||
{{template "repo/nav" .}}
|
<div id="repo-wrapper">
|
||||||
{{template "repo/toolbar" .}}
|
{{template "repo/header" .}}
|
||||||
<div id="body" class="container">
|
<div id="repo-content" class="clear container">
|
||||||
<div id="release">
|
<div id="repo-main" class="left grid-5-6">
|
||||||
<h4 id="release-head">
|
<div id="release">
|
||||||
<span class="release"><strong>Releases</strong></span><!-- /
|
<h4 id="release-head">
|
||||||
<a class="tag" href="{{AppSubUrl}}/{tag_link}">Tags</a> -->
|
<span class="release"><strong>{{.i18n.Tr "repo.release.releases"}}</strong></span><!-- /
|
||||||
<!-- comment : if in tag page, show a.release and span.tag please -->
|
<a class="tag" href="{{AppSubUrl}}/{tag_link}">Tags</a> -->
|
||||||
</h4>
|
<!-- comment : if in tag page, show a.release and span.tag please -->
|
||||||
<ul id="release-list" class="list-unstyled">
|
<a class="btn" href="{{$.RepoLink}}/releases/new">
|
||||||
{{range .Releases}}
|
<button class="btn btn-medium btn-blue btn-radius">
|
||||||
<li class="release-item clearfix" id="release-{{.Sha1}}">
|
{{.i18n.Tr "repo.release.new_release"}}
|
||||||
{{if .PublisherId}}
|
</button>
|
||||||
<div class="col-md-2 text-right">
|
</a>
|
||||||
{{if .IsDraft}}
|
</h4>
|
||||||
<span class="btn btn-primary status pre-release">Draft</span>
|
<ul id="release-list" class="list-unstyled">
|
||||||
{{else if .IsPrerelease}}
|
{{range .Releases}}
|
||||||
<span class="btn btn-warning status pre-release">Pre-Release</span>
|
<li class="release-item clearfix" id="release-{{.Sha1}}">
|
||||||
{{else}}
|
{{if .PublisherId}}
|
||||||
<span class="btn btn-success status stable">Stable</span>
|
<div class="grid-1-6 text-right release-meta">
|
||||||
|
{{if .IsDraft}}
|
||||||
|
<span class="label label-blue label-radius">{{$.i18n.Tr "repo.release.draft"}}</span>
|
||||||
|
{{else if .IsPrerelease}}
|
||||||
|
<span class="label label-orange label-radius">{{$.i18n.Tr "repo.release.prerelease"}}</span>
|
||||||
|
{{else}}
|
||||||
|
<span class="label label-green label-radius">{{$.i18n.Tr "repo.release.stable"}}</span>
|
||||||
|
{{end}}
|
||||||
|
<a class="tag" href="{{$.RepoLink}}/src/{{.TagName}}" rel="nofollow"><i class="fa fa-tag"></i> {{.TagName}}</a>
|
||||||
|
<a class="commit" href="{{$.RepoLink}}/src/{{.Sha1}}" rel="nofollow"><i class="fa fa-code"></i> {{ShortSha .Sha1}}</a>
|
||||||
|
</div>
|
||||||
|
<div class="grid-9-12 release-detail left">
|
||||||
|
<h4 class="title"><a href="{{$.RepoLink}}/src/{{.TagName}}">{{.Title}}</a> <small>(<a href="{{$.RepoLink}}/releases/edit/{{.TagName}}" rel="nofollow">{{$.i18n.Tr "repo.release.edit"}}</a>)</small></h4>
|
||||||
|
<p class="info">
|
||||||
|
<span class="author"><img class="avatar-20" src="{{.Publisher.AvatarLink}}">
|
||||||
|
<a href="{{AppSubUrl}}/{{.Publisher.Name}}">{{.Publisher.Name}}</a></span>
|
||||||
|
{{if .Created}}<span class="time">{{TimeSince .Created $.Lang}}</span>{{end}}
|
||||||
|
<span class="ahead">{{$.i18n.Tr "repo.release.ahead" .NumCommitsBehind .Target | Str2html}}</span>
|
||||||
|
</p>
|
||||||
|
<div class="markdown desc">
|
||||||
|
{{str2html .Note}}
|
||||||
|
</div>
|
||||||
|
<p class="download">
|
||||||
|
<a class="btn btn-gray btn-large btn-radius" href="{{$.RepoLink}}/archive/{{.TagName}}.zip" rel="nofollow"><i class="fa fa-download"></i> {{$.i18n.Tr "repo.release.source_code"}} (ZIP)</a>
|
||||||
|
<a class="btn btn-gray btn-large btn-radius" href="{{$.RepoLink}}/archive/{{.TagName}}.tar.gz"><i class="fa fa-download"></i> {{$.i18n.Tr "repo.release.source_code"}} (TAR.GZ)</a>
|
||||||
|
</p>
|
||||||
|
<span class="dot"> </span>
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
|
<div class="grid-1-6 text-right release-meta">
|
||||||
|
<a class="commit" href="{{$.RepoLink}}/src/{{.Sha1}}" rel="nofollow"><i class="fa fa-code"></i> {{ShortSha .Sha1}}</a>
|
||||||
|
</div>
|
||||||
|
<div class="grid-9-12 release-detail left">
|
||||||
|
<h5 class="title"><a href="{{$.RepoLink}}/src/{{.TagName}}" rel="nofollow">{{.TagName}}</a> <i class="fa fa-tag"></i></h5>
|
||||||
|
<p class="download">
|
||||||
|
<a class="download-link" href="{{$.RepoLink}}/archive/{{.TagName}}.zip" rel="nofollow"><i class="fa fa-download"></i> ZIP</a>
|
||||||
|
<a class="download-link" href="{{$.RepoLink}}/archive/{{.TagName}}.tar.gz"><i class="fa fa-download"></i> TAR.GZ</a>
|
||||||
|
</p>
|
||||||
|
<span class="dot"> </span>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
</li>
|
||||||
{{end}}
|
{{end}}
|
||||||
<a class="tag" href="{{$.RepoLink}}/src/{{.TagName}}" rel="nofollow"><i class="fa fa-tag"></i>{{.TagName}}</a>
|
</ul>
|
||||||
<a class="commit" href="{{$.RepoLink}}/src/{{.Sha1}}" rel="nofollow"><i class="fa fa-code"></i>{{ShortSha .Sha1}}</a>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-10">
|
{{template "repo/sidebar" .}}
|
||||||
<h4 class="title"><a href="{{$.RepoLink}}/src/{{.TagName}}">{{.Title}}</a> <small>(<a href="{{$.RepoLink}}/releases/edit/{{.TagName}}" rel="nofollow">edit</a>)</small></h4>
|
|
||||||
<p class="info">
|
|
||||||
<span class="author"><img class="avatar" src="{{.Publisher.AvatarLink}}" alt="" width="20">
|
|
||||||
<a href="{{AppSubUrl}}/{{.Publisher.Name}}">{{.Publisher.Name}}</a></span>
|
|
||||||
{{if .Created}}<span class="time">{{TimeSince .Created $.Lang}}</span>{{end}}
|
|
||||||
<span class="ahead"><strong>{{.NumCommitsBehind}}</strong> commits to {{.Target}} since this release</span>
|
|
||||||
</p>
|
|
||||||
<div class="markdown desc">
|
|
||||||
{{str2html .Note}}
|
|
||||||
</div>
|
|
||||||
<p class="download">
|
|
||||||
<a class="btn btn-default" href="{{$.RepoLink}}/archive/{{.TagName}}.zip" rel="nofollow"><i class="fa fa-download"></i>Source Code (ZIP)</a>
|
|
||||||
<a class="btn btn-default" href="{{$.RepoLink}}/archive/{{.TagName}}.tar.gz"><i class="fa fa-download"></i>Source Code (TAR.GZ)</a>
|
|
||||||
</p>
|
|
||||||
<span class="dot"> </span>
|
|
||||||
</div>
|
|
||||||
{{else}}
|
|
||||||
<div class="col-md-2 text-right">
|
|
||||||
<a class="commit" href="{{$.RepoLink}}/src/{{.Sha1}}" rel="nofollow"><i class="fa fa-code"></i>{{ShortSha .Sha1}}</a>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<h5 class="title"><a href="{{$.RepoLink}}/src/{{.TagName}}" rel="nofollow">{{.TagName}}</a><i class="fa fa-tag"></i></h5>
|
|
||||||
<p class="download">
|
|
||||||
<a class="download-link" href="{{$.RepoLink}}/archive/{{.TagName}}.zip" rel="nofollow"><i class="fa fa-download"></i>zip</a>
|
|
||||||
<a class="download-link" href="{{$.RepoLink}}/archive/{{.TagName}}.tar.gz"><i class="fa fa-download"></i>tar.gz</a>
|
|
||||||
</p>
|
|
||||||
<span class="dot"> </span>
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
</li>
|
|
||||||
{{end}}
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{template "base/footer" .}}
|
{{template "ng/base/footer" .}}
|
|
@ -1,70 +1,68 @@
|
||||||
{{template "base/head" .}}
|
{{template "ng/base/head" .}}
|
||||||
{{template "base/navbar" .}}
|
{{template "ng/base/header" .}}
|
||||||
{{template "repo/nav" .}}
|
<div id="repo-wrapper">
|
||||||
{{template "repo/toolbar" .}}
|
{{template "repo/header" .}}
|
||||||
<div id="body" class="container">
|
<div id="repo-content" class="clear container">
|
||||||
<div id="release">
|
<div id="repo-main" class="left grid-5-6">
|
||||||
<h4 id="release-head">New Release</h4>
|
{{template "ng/base/alert" .}}
|
||||||
{{template "base/alert" .}}
|
<div id="release">
|
||||||
<form id="release-new-form" action="{{.RepoLink}}/releases/new" method="post" class="form form-inline">
|
<h4 id="release-head">{{.i18n.Tr "repo.release.new_release"}}</h4>
|
||||||
{{.CsrfTokenHtml}}
|
<form class="form" id="release-new-form" action="{{.RepoLink}}/releases/new" method="post">
|
||||||
<div class="form-group">
|
{{.CsrfTokenHtml}}
|
||||||
<input id="tag-name" name="tag_name" type="text" class="form-control" placeholder="tag name" value="{{.tag_name}}" />
|
<div class="field">
|
||||||
<span class="target-at">@</span>
|
<input class="ipt ipt-large ipt-radius" name="tag_name" value="{{.tag_name}}" placeholder="{{.i18n.Tr "repo.release.tag_name"}}" required>
|
||||||
<div class="btn-group" id="release-new-target-select">
|
<span class="target-at">@</span>
|
||||||
<button type="button" class="btn btn-default"><i class="fa fa-code-fork fa-lg fa-m"></i>
|
<div class="inline-block drop">
|
||||||
<span class="target-text">Target : </span>
|
<button class="btn btn-gray btn-medium btn-radius drop-bottom">
|
||||||
<strong id="release-new-target-name"> {{.Repository.DefaultBranch}}</strong>
|
<i class="octicon octicon-git-branch"></i> {{.i18n.Tr "repo.release.target"}} :
|
||||||
</button>
|
<strong id="repo-branch-current">{{.Repository.DefaultBranch}}</strong>
|
||||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
</button>
|
||||||
<span class="caret"></span>
|
<ul class="drop-down menu menu-vertical menu-radius switching-list" id="release-new-target-branch-list">
|
||||||
</button>
|
{{range .Branches}}
|
||||||
<div class="dropdown-menu clone-group-btn" id="release-new-target-branch-list">
|
<li {{if eq . $.tag_target}}class="checked"{{end}}><a><i class="octicon octicon-check"></i>{{.}}</a></li>
|
||||||
<ul class="list-group">
|
{{end}}
|
||||||
{{range .Branches}}
|
</ul>
|
||||||
<li class="list-group-item">
|
</div>
|
||||||
<a href="#" rel="{{.}}"><i class="fa fa-code-fork"></i>{{.}}</a>
|
<input id="tag-target" type="hidden" name="tag_target" value="{{.tag_target}}"/>
|
||||||
</li>
|
|
||||||
{{end}}
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
<input id="tag-target" type="hidden" name="tag_target" value="{{.Repository.DefaultBranch}}"/>
|
<p class="help">{{.i18n.Tr "repo.release.tag_helper"}}</p>
|
||||||
</div>
|
<div class="field">
|
||||||
<p class="help-block">Choose an existing tag, or create a new tag on publish</p>
|
<input class="ipt ipt-large ipt-radius grid-4-5" id="release-new-title" name="title" placeholder="{{.i18n.Tr "repo.release.release_title"}}" value="{{.title}}" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" style="display: block">
|
<br>
|
||||||
<input class="form-control input-lg" id="release-new-title" name="title" type="text" placeholder="release title" value="{{.title}}" />
|
<div class="field grid-4-5">
|
||||||
</div>
|
<div class="md-help pull-right">
|
||||||
<div class="form-group col-md-8" style="display: block" id="release-new-content-div">
|
{{.i18n.Tr "repo.release.content_with_md" "https://help.github.com/articles/markdown-basics" | Str2html}}
|
||||||
<div class="md-help pull-right">
|
</div>
|
||||||
Content with <a href="https://help.github.com/articles/markdown-basics">Markdown</a>
|
<div class="clear">
|
||||||
</div>
|
<ul class="tab-nav list-unstyled">
|
||||||
<ul class="nav nav-tabs" data-init="tabs">
|
<li class="js-tab-nav js-tab-nav-show left" data-tab-target="#release-textarea">
|
||||||
<li class="release-write active"><a href="#release-textarea" data-toggle="tab">Write</a></li>
|
<button class="btn btn-medium btn-gray btn-left-radius">{{.i18n.Tr "repo.release.write"}}</button>
|
||||||
<li class="release-preview"><a href="#release-preview" data-toggle="tab" data-ajax="/api/v1/markdown" data-ajax-name="release-preview" data-ajax-context="{{.RepoLink}}" data-ajax-method="post" data-preview="#release-preview">Preview</a></li>
|
</li>
|
||||||
</ul>
|
<li class="js-tab-nav left markdown-preview" id="release-preview-btn" data-tab-target="#release-preview" data-ajax="/api/v1/markdown" data-ajax-name="release-preview" data-ajax-context="{{.RepoLink}}" data-ajax-method="post" data-preview="#release-preview">
|
||||||
<div class="tab-content">
|
<button class="btn btn-medium btn-gray btn-right-radius">{{.i18n.Tr "repo.release.preview"}}</button>
|
||||||
<div class="tab-pane active" id="release-textarea">
|
</li>
|
||||||
<div class="form-group">
|
</ul>
|
||||||
<textarea class="form-control" name="content" id="release-new-content" rows="10" placeholder="Write some content" data-ajax-rel="release-preview" data-ajax-val="val" data-ajax-field="text">{{.content}}</textarea>
|
</div>
|
||||||
|
<div id="release-textarea">
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="ipt ipt-large ipt-radius" name="content" id="release-new-content" rows="10" placeholder="{{.i18n.Tr "repo.release.content_placeholder"}}" data-ajax-rel="release-preview" data-ajax-val="val" data-ajax-field="text" required>{{.content}}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="markdown hide" id="release-preview">{{.i18n.Tr "repo.release.loading"}}...</div>
|
||||||
|
<hr>
|
||||||
|
<div class="text-right">
|
||||||
|
<input class="ipt-chk" name="prerelease" type="checkbox" {{if .prerelease}}checked{{end}}/>
|
||||||
|
<span><strong>{{.i18n.Tr "repo.release.prerelease_desc"}}</strong></span>
|
||||||
|
<p>{{.i18n.Tr "repo.release.prerelease_helper"}}</p>
|
||||||
|
<button class="btn btn-large btn-green btn-radius">{{.i18n.Tr "repo.release.publish"}}</button>
|
||||||
|
<input class="btn btn-large btn-gary btn-radius" type="submit" name="draft" value="{{.i18n.Tr "repo.release.save_draft"}}"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane release-preview-content" id="release-preview">loading...</div>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="text-right form-group col-md-8" style="display: block">
|
</div>
|
||||||
<hr/>
|
{{template "repo/sidebar" .}}
|
||||||
<label for="release-new-pre-release">
|
|
||||||
<input id="release-new-pre-release" type="checkbox" name="prerelease" {{if .prerelease}}checked{{end}}/>
|
|
||||||
<strong>This is a pre-release</strong>
|
|
||||||
</label>
|
|
||||||
<p class="help-block">We’ll point out that this release is identified as non-production ready.</p>
|
|
||||||
</div>
|
|
||||||
<div class="text-right form-group col-md-8" style="display: block">
|
|
||||||
<button class="btn-success btn">Publish release</button>
|
|
||||||
<input class="btn btn-default" type="submit" name="draft" value="Save draft"/>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{template "base/footer" .}}
|
{{template "ng/base/footer" .}}
|
Loading…
Reference in New Issue
Block a user