fix #1958
This commit is contained in:
parent
1a901433e2
commit
18de67380c
15 changed files with 417 additions and 278 deletions
|
@ -5,7 +5,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
|
|||
|
||||
![](public/img/gogs-large-resize.png)
|
||||
|
||||
##### Current version: 0.7.11 Beta
|
||||
##### Current version: 0.7.12 Beta
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
|
|
@ -368,9 +368,7 @@ fork_from_self = You cannot fork repository you already owned!
|
|||
copy_link = Copy
|
||||
copy_link_success = Copied!
|
||||
copy_link_error = Press ⌘-C or Ctrl-C to copy
|
||||
click_to_copy = Copy to clipboard
|
||||
copied = Copied OK
|
||||
clone_helper = Need help cloning? Visit <a target="_blank" href="%s">Help</a>!
|
||||
unwatch = Unwatch
|
||||
watch = Watch
|
||||
unstar = Unstar
|
||||
|
@ -634,21 +632,21 @@ release.stable = Stable
|
|||
release.edit = edit
|
||||
release.ahead = <strong>%d</strong> commits to %s since this release
|
||||
release.source_code = Source Code
|
||||
release.new_subheader = Publish releases to iterate product.
|
||||
release.edit_subheader = Detailed change log can help users understand what has been improved.
|
||||
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.title = Title
|
||||
release.content = Content
|
||||
release.prerelease_desc = This is a pre-release
|
||||
release.prerelease_helper = We’ll point out that this release is not production-ready.
|
||||
release.cancel = Cancel
|
||||
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.
|
||||
release.downloads = Downloads
|
||||
|
||||
[org]
|
||||
org_name_holder = Organization Name
|
||||
|
|
2
gogs.go
2
gogs.go
|
@ -17,7 +17,7 @@ import (
|
|||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
const APP_VER = "0.7.11.1115 Beta"
|
||||
const APP_VER = "0.7.12.1115 Beta"
|
||||
|
||||
func init() {
|
||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||
|
|
|
@ -288,6 +288,32 @@ func (err ErrUpdateTaskNotExist) Error() string {
|
|||
return fmt.Sprintf("update task does not exist [uuid: %s]", err.UUID)
|
||||
}
|
||||
|
||||
type ErrReleaseAlreadyExist struct {
|
||||
TagName string
|
||||
}
|
||||
|
||||
func IsErrReleaseAlreadyExist(err error) bool {
|
||||
_, ok := err.(ErrReleaseAlreadyExist)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (err ErrReleaseAlreadyExist) Error() string {
|
||||
return fmt.Sprintf("Release tag already exist [tag_name: %s]", err.TagName)
|
||||
}
|
||||
|
||||
type ErrReleaseNotExist struct {
|
||||
TagName string
|
||||
}
|
||||
|
||||
func IsErrReleaseNotExist(err error) bool {
|
||||
_, ok := err.(ErrReleaseNotExist)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (err ErrReleaseNotExist) Error() string {
|
||||
return fmt.Sprintf("Release tag does not exist [tag_name: %s]", err.TagName)
|
||||
}
|
||||
|
||||
// __ __ ___. .__ __
|
||||
// / \ / \ ____\_ |__ | |__ ____ ____ | | __
|
||||
// \ \/\/ // __ \| __ \| | \ / _ \ / _ \| |/ /
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -15,16 +14,11 @@ import (
|
|||
"github.com/gogits/gogs/modules/git"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrReleaseAlreadyExist = errors.New("Release already exist")
|
||||
ErrReleaseNotExist = errors.New("Release does not exist")
|
||||
)
|
||||
|
||||
// Release represents a release of repository.
|
||||
type Release struct {
|
||||
Id int64
|
||||
RepoId int64
|
||||
PublisherId int64
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
RepoID int64
|
||||
PublisherID int64
|
||||
Publisher *User `xorm:"-"`
|
||||
TagName string
|
||||
LowerTagName string
|
||||
|
@ -47,12 +41,12 @@ func (r *Release) AfterSet(colName string, _ xorm.Cell) {
|
|||
}
|
||||
|
||||
// IsReleaseExist returns true if release with given tag name already exists.
|
||||
func IsReleaseExist(repoId int64, tagName string) (bool, error) {
|
||||
func IsReleaseExist(repoID int64, tagName string) (bool, error) {
|
||||
if len(tagName) == 0 {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
return x.Get(&Release{RepoId: repoId, LowerTagName: strings.ToLower(tagName)})
|
||||
return x.Get(&Release{RepoID: repoID, LowerTagName: strings.ToLower(tagName)})
|
||||
}
|
||||
|
||||
func createTag(gitRepo *git.Repository, rel *Release) error {
|
||||
|
@ -84,11 +78,11 @@ func createTag(gitRepo *git.Repository, rel *Release) error {
|
|||
|
||||
// CreateRelease creates a new release of repository.
|
||||
func CreateRelease(gitRepo *git.Repository, rel *Release) error {
|
||||
isExist, err := IsReleaseExist(rel.RepoId, rel.TagName)
|
||||
isExist, err := IsReleaseExist(rel.RepoID, rel.TagName)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if isExist {
|
||||
return ErrReleaseAlreadyExist
|
||||
return ErrReleaseAlreadyExist{rel.TagName}
|
||||
}
|
||||
|
||||
if err = createTag(gitRepo, rel); err != nil {
|
||||
|
@ -100,22 +94,22 @@ func CreateRelease(gitRepo *git.Repository, rel *Release) error {
|
|||
}
|
||||
|
||||
// GetRelease returns release by given ID.
|
||||
func GetRelease(repoId int64, tagName string) (*Release, error) {
|
||||
isExist, err := IsReleaseExist(repoId, tagName)
|
||||
func GetRelease(repoID int64, tagName string) (*Release, error) {
|
||||
isExist, err := IsReleaseExist(repoID, tagName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !isExist {
|
||||
return nil, ErrReleaseNotExist
|
||||
return nil, ErrReleaseNotExist{tagName}
|
||||
}
|
||||
|
||||
rel := &Release{RepoId: repoId, LowerTagName: strings.ToLower(tagName)}
|
||||
rel := &Release{RepoID: repoID, LowerTagName: strings.ToLower(tagName)}
|
||||
_, err = x.Get(rel)
|
||||
return rel, err
|
||||
}
|
||||
|
||||
// GetReleasesByRepoId returns a list of releases of repository.
|
||||
func GetReleasesByRepoId(repoId int64) (rels []*Release, err error) {
|
||||
err = x.Desc("created").Find(&rels, Release{RepoId: repoId})
|
||||
func GetReleasesByRepoId(repoID int64) (rels []*Release, err error) {
|
||||
err = x.Desc("created").Find(&rels, Release{RepoID: repoID})
|
||||
return rels, err
|
||||
}
|
||||
|
||||
|
@ -150,6 +144,6 @@ func UpdateRelease(gitRepo *git.Repository, rel *Release) (err error) {
|
|||
if err = createTag(gitRepo, rel); err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = x.Id(rel.Id).AllCols().Update(rel)
|
||||
_, err = x.Id(rel.ID).AllCols().Update(rel)
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -1116,7 +1116,7 @@ func DeleteRepository(uid, repoID int64) error {
|
|||
return err
|
||||
} else if _, err = sess.Delete(&Milestone{RepoID: repoID}); err != nil {
|
||||
return err
|
||||
} else if _, err = sess.Delete(&Release{RepoId: repoID}); err != nil {
|
||||
} else if _, err = sess.Delete(&Release{RepoID: repoID}); err != nil {
|
||||
return err
|
||||
} else if _, err = sess.Delete(&Collaboration{RepoID: repoID}); err != nil {
|
||||
return err
|
||||
|
|
|
@ -215,12 +215,12 @@ func (f *CreateLabelForm) Validate(ctx *macaron.Context, errs binding.Errors) bi
|
|||
// \/ \/ \/ \/ \/ \/
|
||||
|
||||
type NewReleaseForm struct {
|
||||
TagName string `form:"tag_name" binding:"Required"`
|
||||
TagName string `binding:"Required"`
|
||||
Target string `form:"tag_target" binding:"Required"`
|
||||
Title string `form:"title" binding:"Required"`
|
||||
Content string `form:"content" binding:"Required"`
|
||||
Draft string `form:"draft"`
|
||||
Prerelease bool `form:"prerelease"`
|
||||
Title string `binding:"Required"`
|
||||
Content string
|
||||
Draft string
|
||||
Prerelease bool
|
||||
}
|
||||
|
||||
func (f *NewReleaseForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2393,6 +2393,85 @@ footer .container .links > *:first-child {
|
|||
padding: 5px 10px;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
.repository.release #release-list {
|
||||
border-top: 1px solid #DDD;
|
||||
margin-top: 20px;
|
||||
padding-top: 15px;
|
||||
}
|
||||
.repository.release #release-list > li {
|
||||
list-style: none;
|
||||
}
|
||||
.repository.release #release-list > li .meta,
|
||||
.repository.release #release-list > li .detail {
|
||||
padding-top: 30px;
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
.repository.release #release-list > li .meta {
|
||||
text-align: right;
|
||||
position: relative;
|
||||
}
|
||||
.repository.release #release-list > li .meta .tag:not(.icon) {
|
||||
display: block;
|
||||
margin-top: 15px;
|
||||
}
|
||||
.repository.release #release-list > li .meta .commit {
|
||||
display: block;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.repository.release #release-list > li .detail {
|
||||
border-left: 1px solid #DDD;
|
||||
}
|
||||
.repository.release #release-list > li .detail .author img {
|
||||
margin-bottom: -3px;
|
||||
}
|
||||
.repository.release #release-list > li .detail .download {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.repository.release #release-list > li .detail .download > a .octicon {
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.repository.release #release-list > li .detail .download .list {
|
||||
padding-left: 0;
|
||||
border-top: 1px solid #eee;
|
||||
}
|
||||
.repository.release #release-list > li .detail .download .list li {
|
||||
list-style: none;
|
||||
display: block;
|
||||
padding-top: 8px;
|
||||
padding-bottom: 8px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
.repository.release #release-list > li .detail .dot {
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
background-color: #ccc;
|
||||
z-index: 999;
|
||||
position: absolute;
|
||||
display: block;
|
||||
left: -5px;
|
||||
top: 40px;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #FFF;
|
||||
}
|
||||
.repository.new.release .target {
|
||||
min-width: 500px;
|
||||
}
|
||||
.repository.new.release .target .at {
|
||||
margin-left: -5px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.repository.new.release .target .dropdown.icon {
|
||||
margin: 0;
|
||||
padding-top: 3px;
|
||||
}
|
||||
.repository.new.release .target .selection.dropdown {
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
.repository.new.release .prerelease.field {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.issue.list {
|
||||
list-style: none;
|
||||
padding-top: 15px;
|
||||
|
|
|
@ -794,6 +794,102 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.release {
|
||||
#release-list {
|
||||
border-top: 1px solid #DDD;
|
||||
margin-top: 20px;
|
||||
padding-top: 15px;
|
||||
|
||||
>li {
|
||||
list-style: none;
|
||||
|
||||
.meta,
|
||||
.detail {
|
||||
padding-top: 30px;
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
.meta {
|
||||
text-align: right;
|
||||
position: relative;
|
||||
|
||||
.tag:not(.icon) {
|
||||
display: block;
|
||||
margin-top: 15px;
|
||||
}
|
||||
.commit {
|
||||
display: block;
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
.detail {
|
||||
border-left: 1px solid #DDD;
|
||||
|
||||
.author {
|
||||
img {
|
||||
margin-bottom: -3px;
|
||||
}
|
||||
}
|
||||
.download {
|
||||
margin-top: 20px;
|
||||
|
||||
>a {
|
||||
.octicon {
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.list {
|
||||
padding-left: 0;
|
||||
border-top: 1px solid #eee;
|
||||
|
||||
li {
|
||||
list-style: none;
|
||||
display: block;
|
||||
padding-top: 8px;
|
||||
padding-bottom: 8px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
}
|
||||
}
|
||||
.dot {
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
background-color: #ccc;
|
||||
z-index: 999;
|
||||
position: absolute;
|
||||
display: block;
|
||||
left: -5px;
|
||||
top: 40px;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #FFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&.new.release {
|
||||
.target {
|
||||
min-width: 500px;
|
||||
|
||||
.at {
|
||||
margin-left: -5px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.dropdown.icon {
|
||||
margin: 0;
|
||||
padding-top: 3px;
|
||||
}
|
||||
.selection.dropdown {
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
}
|
||||
.prerelease.field {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
// End of .repository
|
||||
|
||||
|
|
|
@ -15,13 +15,10 @@ import (
|
|||
const (
|
||||
RELEASES base.TplName = "repo/release/list"
|
||||
RELEASE_NEW base.TplName = "repo/release/new"
|
||||
RELEASE_EDIT base.TplName = "repo/release/edit"
|
||||
)
|
||||
|
||||
func Releases(ctx *middleware.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("repo.release.releases")
|
||||
ctx.Data["IsRepoToolbarReleases"] = true
|
||||
ctx.Data["IsRepoReleaseNew"] = false
|
||||
|
||||
rawTags, err := ctx.Repo.GitRepo.GetTags()
|
||||
if err != nil {
|
||||
|
@ -45,7 +42,7 @@ func Releases(ctx *middleware.Context) {
|
|||
continue
|
||||
}
|
||||
if rel.TagName == rawTag {
|
||||
rel.Publisher, err = models.GetUserByID(rel.PublisherId)
|
||||
rel.Publisher, err = models.GetUserByID(rel.PublisherID)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetUserById", err)
|
||||
return
|
||||
|
@ -105,7 +102,7 @@ func Releases(ctx *middleware.Context) {
|
|||
continue
|
||||
}
|
||||
|
||||
rel.Publisher, err = models.GetUserByID(rel.PublisherId)
|
||||
rel.Publisher, err = models.GetUserByID(rel.PublisherID)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetUserById", err)
|
||||
return
|
||||
|
@ -140,27 +137,13 @@ func Releases(ctx *middleware.Context) {
|
|||
}
|
||||
|
||||
func NewRelease(ctx *middleware.Context) {
|
||||
if !ctx.Repo.IsOwner() {
|
||||
ctx.Handle(403, "release.ReleasesNew", nil)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Data["Title"] = ctx.Tr("repo.release.new_release")
|
||||
ctx.Data["tag_target"] = ctx.Repo.Repository.DefaultBranch
|
||||
ctx.Data["IsRepoToolbarReleases"] = true
|
||||
ctx.Data["IsRepoReleaseNew"] = true
|
||||
ctx.HTML(200, RELEASE_NEW)
|
||||
}
|
||||
|
||||
func NewReleasePost(ctx *middleware.Context, form auth.NewReleaseForm) {
|
||||
if !ctx.Repo.IsOwner() {
|
||||
ctx.Handle(403, "release.ReleasesNew", nil)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Data["Title"] = ctx.Tr("repo.release.new_release")
|
||||
ctx.Data["IsRepoToolbarReleases"] = true
|
||||
ctx.Data["IsRepoReleaseNew"] = true
|
||||
|
||||
if ctx.HasError() {
|
||||
ctx.HTML(200, RELEASE_NEW)
|
||||
|
@ -185,8 +168,8 @@ func NewReleasePost(ctx *middleware.Context, form auth.NewReleaseForm) {
|
|||
}
|
||||
|
||||
rel := &models.Release{
|
||||
RepoId: ctx.Repo.Repository.ID,
|
||||
PublisherId: ctx.User.Id,
|
||||
RepoID: ctx.Repo.Repository.ID,
|
||||
PublisherID: ctx.User.Id,
|
||||
Title: form.Title,
|
||||
TagName: form.TagName,
|
||||
Target: form.Target,
|
||||
|
@ -198,67 +181,67 @@ func NewReleasePost(ctx *middleware.Context, form auth.NewReleaseForm) {
|
|||
}
|
||||
|
||||
if err = models.CreateRelease(ctx.Repo.GitRepo, rel); err != nil {
|
||||
if err == models.ErrReleaseAlreadyExist {
|
||||
if models.IsErrReleaseAlreadyExist(err) {
|
||||
ctx.Data["Err_TagName"] = true
|
||||
ctx.RenderWithErr(ctx.Tr("repo.release.tag_name_already_exist"), RELEASE_NEW, &form)
|
||||
} else {
|
||||
ctx.Handle(500, "CreateRelease", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
log.Trace("%s Release created: %s/%s:%s", ctx.Req.RequestURI, ctx.User.LowerName, ctx.Repo.Repository.Name, form.TagName)
|
||||
log.Trace("Release created: %s/%s:%s", ctx.User.LowerName, ctx.Repo.Repository.Name, form.TagName)
|
||||
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/releases")
|
||||
}
|
||||
|
||||
func EditRelease(ctx *middleware.Context) {
|
||||
if !ctx.Repo.IsOwner() {
|
||||
ctx.Handle(403, "release.ReleasesEdit", nil)
|
||||
return
|
||||
}
|
||||
ctx.Data["Title"] = ctx.Tr("repo.release.edit_release")
|
||||
ctx.Data["PageIsEditRelease"] = true
|
||||
|
||||
tagName := ctx.Params(":tagname")
|
||||
rel, err := models.GetRelease(ctx.Repo.Repository.ID, tagName)
|
||||
if err != nil {
|
||||
if err == models.ErrReleaseNotExist {
|
||||
if models.IsErrReleaseNotExist(err) {
|
||||
ctx.Handle(404, "GetRelease", err)
|
||||
} else {
|
||||
ctx.Handle(500, "GetRelease", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
ctx.Data["Release"] = rel
|
||||
ctx.Data["tag_name"] = rel.TagName
|
||||
ctx.Data["tag_target"] = rel.Target
|
||||
ctx.Data["title"] = rel.Title
|
||||
ctx.Data["content"] = rel.Note
|
||||
ctx.Data["prerelease"] = rel.IsPrerelease
|
||||
|
||||
ctx.Data["Title"] = ctx.Tr("repo.release.edit_release")
|
||||
ctx.Data["IsRepoToolbarReleases"] = true
|
||||
ctx.HTML(200, RELEASE_EDIT)
|
||||
ctx.HTML(200, RELEASE_NEW)
|
||||
}
|
||||
|
||||
func EditReleasePost(ctx *middleware.Context, form auth.EditReleaseForm) {
|
||||
if !ctx.Repo.IsOwner() {
|
||||
ctx.Handle(403, "release.EditReleasePost", nil)
|
||||
return
|
||||
}
|
||||
ctx.Data["Title"] = ctx.Tr("repo.release.edit_release")
|
||||
ctx.Data["PageIsEditRelease"] = true
|
||||
|
||||
tagName := ctx.Params(":tagname")
|
||||
rel, err := models.GetRelease(ctx.Repo.Repository.ID, tagName)
|
||||
if err != nil {
|
||||
if err == models.ErrReleaseNotExist {
|
||||
if models.IsErrReleaseNotExist(err) {
|
||||
ctx.Handle(404, "GetRelease", err)
|
||||
} else {
|
||||
ctx.Handle(500, "GetRelease", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
ctx.Data["Release"] = rel
|
||||
ctx.Data["tag_name"] = rel.TagName
|
||||
ctx.Data["tag_target"] = rel.Target
|
||||
ctx.Data["title"] = rel.Title
|
||||
ctx.Data["content"] = rel.Note
|
||||
ctx.Data["prerelease"] = rel.IsPrerelease
|
||||
|
||||
if ctx.HasError() {
|
||||
ctx.HTML(200, RELEASE_EDIT)
|
||||
ctx.HTML(200, RELEASE_NEW)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Data["Title"] = ctx.Tr("repo.release.edit_release")
|
||||
ctx.Data["IsRepoToolbarReleases"] = true
|
||||
|
||||
rel.Title = form.Title
|
||||
rel.Note = form.Content
|
||||
rel.IsDraft = len(form.Draft) > 0
|
||||
|
|
|
@ -1 +1 @@
|
|||
0.7.11.1115 Beta
|
||||
0.7.12.1115 Beta
|
|
@ -1,59 +0,0 @@
|
|||
{{template "ng/base/head" .}}
|
||||
{{template "ng/base/header" .}}
|
||||
<div id="repo-wrapper">
|
||||
{{template "repo/header_old" .}}
|
||||
<div id="repo-content" class="clear container">
|
||||
<div id="repo-main" class="left grid-5-6">
|
||||
{{template "ng/base/alert" .}}
|
||||
<div id="release">
|
||||
<h4 id="release-head">{{.i18n.Tr "repo.release.edit_release"}}</h4>
|
||||
<form class="form" id="release-new-form" action="{{.RepoLink}}/releases/edit/{{.Release.TagName}}" method="post">
|
||||
{{.CsrfTokenHtml}}
|
||||
<div class="field">
|
||||
<b>{{.Release.TagName}}</b>
|
||||
<span class="target-at">@</span>
|
||||
<strong>{{.Repository.DefaultBranch}}</strong>
|
||||
</div>
|
||||
<div class="field">
|
||||
<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>
|
||||
</div>
|
||||
<br>
|
||||
<div class="field grid-4-5">
|
||||
<div class="md-help pull-right">
|
||||
{{.i18n.Tr "repo.release.content_with_md" "https://help.github.com/articles/markdown-basics" | Str2html}}
|
||||
</div>
|
||||
<div class="clear">
|
||||
<ul class="tab-nav list-unstyled">
|
||||
<li class="js-tab-nav js-tab-nav-show left" data-tab-target="#release-textarea">
|
||||
<button class="btn btn-medium btn-gray btn-left-radius">{{.i18n.Tr "repo.release.write"}}</button>
|
||||
</li>
|
||||
<li class="js-tab-nav left markdown-preview" id="release-preview-btn" data-tab-target="#release-preview" data-ajax="{{AppSubUrl}}/api/v1/markdown" data-ajax-name="release-preview" data-ajax-context="{{.RepoLink}}" data-ajax-method="post" data-preview="#release-preview">
|
||||
<button class="btn btn-medium btn-gray btn-right-radius">{{.i18n.Tr "repo.release.preview"}}</button>
|
||||
</li>
|
||||
</ul>
|
||||
</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>{{.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>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{{template "repo/sidebar" .}}
|
||||
</div>
|
||||
</div>
|
||||
{{template "ng/base/footer" .}}
|
|
@ -1,73 +1,80 @@
|
|||
{{template "ng/base/head" .}}
|
||||
{{template "ng/base/header" .}}
|
||||
<div id="repo-wrapper">
|
||||
{{template "repo/header_old" .}}
|
||||
<div id="repo-content" class="clear container">
|
||||
<div id="repo-main" class="left grid-5-6">
|
||||
<div id="release">
|
||||
<h4 id="release-head">
|
||||
<span class="release"><strong>{{.i18n.Tr "repo.release.releases"}}</strong></span><!-- /
|
||||
<a class="tag" href="{{AppSubUrl}}/{tag_link}">Tags</a> -->
|
||||
<!-- comment : if in tag page, show a.release and span.tag please -->
|
||||
{{template "base/head" .}}
|
||||
<div class="repository release">
|
||||
{{template "repo/header" .}}
|
||||
<div class="ui container">
|
||||
{{template "repo/sidebar" .}}
|
||||
<h2 class="ui header">
|
||||
{{.i18n.Tr "repo.release.releases"}}
|
||||
{{if .IsRepositoryAdmin}}
|
||||
<a class="btn" href="{{$.RepoLink}}/releases/new">
|
||||
<button class="btn btn-medium btn-blue btn-radius">
|
||||
<div class="ui right">
|
||||
<a class="ui small green button" href="{{$.RepoLink}}/releases/new">
|
||||
{{.i18n.Tr "repo.release.new_release"}}
|
||||
</button>
|
||||
</a>
|
||||
{{end}}
|
||||
</h4>
|
||||
<ul id="release-list" class="list-unstyled">
|
||||
{{range .Releases}}
|
||||
<li class="release-item clearfix" id="release-{{.Sha1}}">
|
||||
{{if .PublisherId}}
|
||||
<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>
|
||||
{{end}}
|
||||
</h2>
|
||||
<ul id="release-list">
|
||||
{{range .Releases}}
|
||||
<li class="ui grid">
|
||||
<div class="ui four wide column meta">
|
||||
{{if .PublisherID}}
|
||||
{{if .IsDraft}}
|
||||
<span class="ui yellow label">{{$.i18n.Tr "repo.release.draft"}}</span>
|
||||
{{else if .IsPrerelease}}
|
||||
<span class="ui orange label">{{$.i18n.Tr "repo.release.prerelease"}}</span>
|
||||
{{else}}
|
||||
<span class="ui green label">{{$.i18n.Tr "repo.release.stable"}}</span>
|
||||
{{end}}
|
||||
<span class="tag text blue">
|
||||
<a href="{{$.RepoLink}}/src/{{.TagName}}" rel="nofollow"><i class="tag icon"></i> {{.TagName}}</a>
|
||||
</span>
|
||||
{{end}}
|
||||
<span class="commit">
|
||||
<a href="{{$.RepoLink}}/src/{{.Sha1}}" rel="nofollow"><i class="code icon"></i> {{ShortSha .Sha1}}</a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="ui twelve wide column detail">
|
||||
{{if .PublisherID}}
|
||||
<h3>
|
||||
<a href="{{$.RepoLink}}/src/{{.TagName}}">{{.Title}}</a>
|
||||
<small>(<a href="{{$.RepoLink}}/releases/edit/{{.TagName}}" rel="nofollow">{{$.i18n.Tr "repo.release.edit"}}</a>)</small>
|
||||
</h3>
|
||||
<p class="text grey">
|
||||
<span class="author">
|
||||
<img class="img-10" 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 class="download">
|
||||
<h2>{{$.i18n.Tr "repo.release.downloads"}}</h2>
|
||||
<ul class="list">
|
||||
<li>
|
||||
<a href="{{$.RepoLink}}/archive/{{.TagName}}.zip" rel="nofollow"><i class="icon octicon octicon-file-zip"></i> {{$.i18n.Tr "repo.release.source_code"}} (ZIP)</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{$.RepoLink}}/archive/{{.TagName}}.tar.gz"><i class="icon octicon octicon-file-zip"></i> {{$.i18n.Tr "repo.release.source_code"}} (TAR.GZ)</a>
|
||||
</li>
|
||||
</ul>
|
||||
</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>
|
||||
<h4>
|
||||
<a href="{{$.RepoLink}}/src/{{.TagName}}" rel="nofollow"><i class="tag icon"></i> {{.TagName}}</a>
|
||||
</h4>
|
||||
<div class="download">
|
||||
<a href="{{$.RepoLink}}/archive/{{.TagName}}.zip" rel="nofollow"><i class="octicon octicon-file-zip"></i> ZIP</a>
|
||||
<a href="{{$.RepoLink}}/archive/{{.TagName}}.tar.gz"><i class="octicon octicon-file-zip"></i> TAR.GZ</a>
|
||||
</div>
|
||||
{{end}}
|
||||
<span class="dot"> </span>
|
||||
</div>
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{{template "repo/sidebar" .}}
|
||||
</div>
|
||||
</div>
|
||||
{{template "ng/base/footer" .}}
|
||||
{{template "base/footer" .}}
|
|
@ -1,68 +1,83 @@
|
|||
{{template "ng/base/head" .}}
|
||||
{{template "ng/base/header" .}}
|
||||
<div id="repo-wrapper">
|
||||
{{template "repo/header_old" .}}
|
||||
<div id="repo-content" class="clear container">
|
||||
<div id="repo-main" class="left grid-5-6">
|
||||
{{template "ng/base/alert" .}}
|
||||
<div id="release">
|
||||
<h4 id="release-head">{{.i18n.Tr "repo.release.new_release"}}</h4>
|
||||
<form class="form" id="release-new-form" action="{{.RepoLink}}/releases/new" method="post">
|
||||
{{.CsrfTokenHtml}}
|
||||
<div class="field">
|
||||
<input class="ipt ipt-large ipt-radius" name="tag_name" value="{{.tag_name}}" placeholder="{{.i18n.Tr "repo.release.tag_name"}}" required>
|
||||
<span class="target-at">@</span>
|
||||
<div class="inline-block drop">
|
||||
<button class="btn btn-gray btn-medium btn-radius drop-bottom">
|
||||
<i class="octicon octicon-git-branch"></i> {{.i18n.Tr "repo.release.target"}} :
|
||||
<strong id="repo-branch-current">{{.Repository.DefaultBranch}}</strong>
|
||||
</button>
|
||||
<ul class="drop-down menu menu-vertical menu-radius switching-list" id="release-new-target-branch-list">
|
||||
{{range .Branches}}
|
||||
<li {{if eq . $.tag_target}}class="checked"{{end}}><a><i class="octicon octicon-check"></i>{{.}}</a></li>
|
||||
{{template "base/head" .}}
|
||||
<div class="repository new release">
|
||||
{{template "repo/header" .}}
|
||||
<div class="ui container">
|
||||
{{template "repo/sidebar" .}}
|
||||
<h2 class="ui dividing header">
|
||||
{{if .PageIsEditRelease}}
|
||||
{{.i18n.Tr "repo.release.edit_release"}}
|
||||
<div class="sub header">{{.i18n.Tr "repo.release.edit_subheader"}}</div>
|
||||
{{else}}
|
||||
{{.i18n.Tr "repo.release.new_release"}}
|
||||
<div class="sub header">{{.i18n.Tr "repo.release.new_subheader"}}</div>
|
||||
{{end}}
|
||||
</ul>
|
||||
</h2>
|
||||
{{template "base/alert" .}}
|
||||
<form class="ui form grid" action="{{.Link}}" method="post">
|
||||
{{.CsrfTokenHtml}}
|
||||
<div class="ui seven wide column target">
|
||||
<div class="inline field {{if .Err_TagName}}error{{end}}">
|
||||
{{if .PageIsEditRelease}}
|
||||
<b>{{.tag_name}}</b><span class="at">@</span><strong>{{.tag_target}}</strong>
|
||||
{{else}}
|
||||
<input name="tag_name" value="{{.tag_name}}" placeholder="{{.i18n.Tr "repo.release.tag_name"}}" autofocus required>
|
||||
<span class="at">@</span>
|
||||
<div class="ui selection dropdown">
|
||||
<input type="hidden" name="tag_target" value="{{.tag_target}}"/>
|
||||
<i class="octicon octicon-git-branch"></i>
|
||||
<div class="text">
|
||||
{{.i18n.Tr "repo.release.target"}} :
|
||||
<strong id="repo-branch-current">{{.Repository.DefaultBranch}}</strong>
|
||||
</div>
|
||||
<input id="tag-target" type="hidden" name="tag_target" value="{{.tag_target}}"/>
|
||||
<i class="dropdown icon"></i>
|
||||
<div class="menu">
|
||||
{{range .Branches}}
|
||||
<div class="item" data-value="{{.}}">{{.}}</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
<span class="help">{{.i18n.Tr "repo.release.tag_helper"}}</span>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="eleven wide column">
|
||||
<div class="field {{if .Err_Title}}error{{end}}">
|
||||
<label>{{.i18n.Tr "repo.release.title"}}</label>
|
||||
<input name="title" placeholder="{{.i18n.Tr "repo.release.title"}}" value="{{.title}}" autofocus required>
|
||||
</div>
|
||||
<p class="help">{{.i18n.Tr "repo.release.tag_helper"}}</p>
|
||||
<div class="field">
|
||||
<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>
|
||||
<br>
|
||||
<div class="field grid-4-5">
|
||||
<div class="md-help pull-right">
|
||||
{{.i18n.Tr "repo.release.content_with_md" "https://help.github.com/articles/markdown-basics" | Str2html}}
|
||||
</div>
|
||||
<div class="clear">
|
||||
<ul class="tab-nav list-unstyled">
|
||||
<li class="js-tab-nav js-tab-nav-show left" data-tab-target="#release-textarea">
|
||||
<button class="btn btn-medium btn-gray btn-left-radius">{{.i18n.Tr "repo.release.write"}}</button>
|
||||
</li>
|
||||
<li class="js-tab-nav left markdown-preview" id="release-preview-btn" data-tab-target="#release-preview" data-ajax="{{AppSubUrl}}/api/v1/markdown" data-ajax-name="release-preview" data-ajax-context="{{.RepoLink}}" data-ajax-method="post" data-preview="#release-preview">
|
||||
<button class="btn btn-medium btn-gray btn-right-radius">{{.i18n.Tr "repo.release.preview"}}</button>
|
||||
</li>
|
||||
</ul>
|
||||
</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>
|
||||
<label>{{.i18n.Tr "repo.release.content"}}</label>
|
||||
<textarea name="content">{{.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 class="ui container">
|
||||
<div class="ui divider"></div>
|
||||
<div class="ui text right">
|
||||
<div class="prerelease field">
|
||||
<div class="ui checkbox">
|
||||
<input type="checkbox" name="prerelease" {{if .prerelease}}checked{{end}}>
|
||||
<label><strong>{{.i18n.Tr "repo.release.prerelease_desc"}}</strong></label>
|
||||
</div>
|
||||
</div>
|
||||
<span class="help">{{.i18n.Tr "repo.release.prerelease_helper"}}</span>
|
||||
<div class="field">
|
||||
{{if .PageIsEditRelease}}
|
||||
<a class="ui blue basic button" href="{{.RepoLink}}/releases">
|
||||
{{.i18n.Tr "repo.release.cancel"}}
|
||||
</a>
|
||||
<button class="ui green button">
|
||||
{{.i18n.Tr "repo.release.edit_release"}}
|
||||
</button>
|
||||
{{else}}
|
||||
<button class="ui green button">
|
||||
{{.i18n.Tr "repo.release.publish"}}
|
||||
</button>
|
||||
<input class="ui grey button" type="submit" name="draft" value="{{.i18n.Tr "repo.release.save_draft"}}"/>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{{template "repo/sidebar" .}}
|
||||
</div>
|
||||
</div>
|
||||
{{template "ng/base/footer" .}}
|
||||
{{template "base/footer" .}}
|
Loading…
Reference in a new issue