This commit is contained in:
Unknwon 2015-11-15 23:52:46 -05:00
parent 1a901433e2
commit 18de67380c
15 changed files with 417 additions and 278 deletions

View file

@ -5,7 +5,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
![](public/img/gogs-large-resize.png) ![](public/img/gogs-large-resize.png)
##### Current version: 0.7.11 Beta ##### Current version: 0.7.12 Beta
<table> <table>
<tr> <tr>

View file

@ -368,9 +368,7 @@ fork_from_self = You cannot fork repository you already owned!
copy_link = Copy copy_link = Copy
copy_link_success = Copied! copy_link_success = Copied!
copy_link_error = Press ⌘-C or Ctrl-C to copy copy_link_error = Press ⌘-C or Ctrl-C to copy
click_to_copy = Copy to clipboard
copied = Copied OK copied = Copied OK
clone_helper = Need help cloning? Visit <a target="_blank" href="%s">Help</a>!
unwatch = Unwatch unwatch = Unwatch
watch = Watch watch = Watch
unstar = Unstar unstar = Unstar
@ -634,21 +632,21 @@ release.stable = Stable
release.edit = edit release.edit = edit
release.ahead = <strong>%d</strong> commits to %s since this release release.ahead = <strong>%d</strong> commits to %s since this release
release.source_code = Source Code 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.tag_name = Tag name
release.target = Target release.target = Target
release.tag_helper = Choose an existing tag, or create a new tag on publish. release.tag_helper = Choose an existing tag, or create a new tag on publish.
release.release_title = Release title release.title = Title
release.content_with_md = Content with <a href="%s">Markdown</a> release.content = Content
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_desc = This is a pre-release
release.prerelease_helper = Well point out that this release is not production-ready. release.prerelease_helper = Well point out that this release is not production-ready.
release.cancel = Cancel
release.publish = Publish Release release.publish = Publish Release
release.save_draft = Save Draft release.save_draft = Save Draft
release.edit_release = Edit Release release.edit_release = Edit Release
release.tag_name_already_exist = Release with this tag name has already existed. release.tag_name_already_exist = Release with this tag name has already existed.
release.downloads = Downloads
[org] [org]
org_name_holder = Organization Name org_name_holder = Organization Name

View file

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.7.11.1115 Beta" const APP_VER = "0.7.12.1115 Beta"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

View file

@ -288,6 +288,32 @@ func (err ErrUpdateTaskNotExist) Error() string {
return fmt.Sprintf("update task does not exist [uuid: %s]", err.UUID) 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)
}
// __ __ ___. .__ __ // __ __ ___. .__ __
// / \ / \ ____\_ |__ | |__ ____ ____ | | __ // / \ / \ ____\_ |__ | |__ ____ ____ | | __
// \ \/\/ // __ \| __ \| | \ / _ \ / _ \| |/ / // \ \/\/ // __ \| __ \| | \ / _ \ / _ \| |/ /

View file

@ -5,7 +5,6 @@
package models package models
import ( import (
"errors"
"sort" "sort"
"strings" "strings"
"time" "time"
@ -15,16 +14,11 @@ import (
"github.com/gogits/gogs/modules/git" "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. // Release represents a release of repository.
type Release struct { type Release struct {
Id int64 ID int64 `xorm:"pk autoincr"`
RepoId int64 RepoID int64
PublisherId int64 PublisherID int64
Publisher *User `xorm:"-"` Publisher *User `xorm:"-"`
TagName string TagName string
LowerTagName 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. // 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 { if len(tagName) == 0 {
return false, nil 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 { 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. // CreateRelease creates a new release of repository.
func CreateRelease(gitRepo *git.Repository, rel *Release) error { 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 { if err != nil {
return err return err
} else if isExist { } else if isExist {
return ErrReleaseAlreadyExist return ErrReleaseAlreadyExist{rel.TagName}
} }
if err = createTag(gitRepo, rel); err != nil { 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. // GetRelease returns release by given ID.
func GetRelease(repoId int64, tagName string) (*Release, error) { func GetRelease(repoID int64, tagName string) (*Release, error) {
isExist, err := IsReleaseExist(repoId, tagName) isExist, err := IsReleaseExist(repoID, tagName)
if err != nil { if err != nil {
return nil, err return nil, err
} else if !isExist { } 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) _, err = x.Get(rel)
return rel, err return rel, err
} }
// GetReleasesByRepoId returns a list of releases of repository. // GetReleasesByRepoId returns a list of releases of repository.
func GetReleasesByRepoId(repoId int64) (rels []*Release, err error) { func GetReleasesByRepoId(repoID int64) (rels []*Release, err error) {
err = x.Desc("created").Find(&rels, Release{RepoId: repoId}) err = x.Desc("created").Find(&rels, Release{RepoID: repoID})
return rels, err return rels, err
} }
@ -150,6 +144,6 @@ func UpdateRelease(gitRepo *git.Repository, rel *Release) (err error) {
if err = createTag(gitRepo, rel); err != nil { if err = createTag(gitRepo, rel); err != nil {
return err return err
} }
_, err = x.Id(rel.Id).AllCols().Update(rel) _, err = x.Id(rel.ID).AllCols().Update(rel)
return err return err
} }

View file

@ -1116,7 +1116,7 @@ func DeleteRepository(uid, repoID int64) error {
return err return err
} else if _, err = sess.Delete(&Milestone{RepoID: repoID}); err != nil { } else if _, err = sess.Delete(&Milestone{RepoID: repoID}); err != nil {
return err return err
} else if _, err = sess.Delete(&Release{RepoId: repoID}); err != nil { } else if _, err = sess.Delete(&Release{RepoID: repoID}); err != nil {
return err return err
} else if _, err = sess.Delete(&Collaboration{RepoID: repoID}); err != nil { } else if _, err = sess.Delete(&Collaboration{RepoID: repoID}); err != nil {
return err return err

View file

@ -215,12 +215,12 @@ func (f *CreateLabelForm) Validate(ctx *macaron.Context, errs binding.Errors) bi
// \/ \/ \/ \/ \/ \/ // \/ \/ \/ \/ \/ \/
type NewReleaseForm struct { type NewReleaseForm struct {
TagName string `form:"tag_name" binding:"Required"` TagName string `binding:"Required"`
Target string `form:"tag_target" binding:"Required"` Target string `form:"tag_target" binding:"Required"`
Title string `form:"title" binding:"Required"` Title string `binding:"Required"`
Content string `form:"content" binding:"Required"` Content string
Draft string `form:"draft"` Draft string
Prerelease bool `form:"prerelease"` Prerelease bool
} }
func (f *NewReleaseForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { func (f *NewReleaseForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {

File diff suppressed because one or more lines are too long

View file

@ -2393,6 +2393,85 @@ footer .container .links > *:first-child {
padding: 5px 10px; padding: 5px 10px;
font-size: 1.2em; 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 { .issue.list {
list-style: none; list-style: none;
padding-top: 15px; padding-top: 15px;

View file

@ -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 // End of .repository

View file

@ -15,13 +15,10 @@ import (
const ( const (
RELEASES base.TplName = "repo/release/list" RELEASES base.TplName = "repo/release/list"
RELEASE_NEW base.TplName = "repo/release/new" RELEASE_NEW base.TplName = "repo/release/new"
RELEASE_EDIT base.TplName = "repo/release/edit"
) )
func Releases(ctx *middleware.Context) { func Releases(ctx *middleware.Context) {
ctx.Data["Title"] = ctx.Tr("repo.release.releases") ctx.Data["Title"] = ctx.Tr("repo.release.releases")
ctx.Data["IsRepoToolbarReleases"] = true
ctx.Data["IsRepoReleaseNew"] = false
rawTags, err := ctx.Repo.GitRepo.GetTags() rawTags, err := ctx.Repo.GitRepo.GetTags()
if err != nil { if err != nil {
@ -45,7 +42,7 @@ func Releases(ctx *middleware.Context) {
continue continue
} }
if rel.TagName == rawTag { if rel.TagName == rawTag {
rel.Publisher, err = models.GetUserByID(rel.PublisherId) rel.Publisher, err = models.GetUserByID(rel.PublisherID)
if err != nil { if err != nil {
ctx.Handle(500, "GetUserById", err) ctx.Handle(500, "GetUserById", err)
return return
@ -105,7 +102,7 @@ func Releases(ctx *middleware.Context) {
continue continue
} }
rel.Publisher, err = models.GetUserByID(rel.PublisherId) rel.Publisher, err = models.GetUserByID(rel.PublisherID)
if err != nil { if err != nil {
ctx.Handle(500, "GetUserById", err) ctx.Handle(500, "GetUserById", err)
return return
@ -140,27 +137,13 @@ func Releases(ctx *middleware.Context) {
} }
func NewRelease(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["Title"] = ctx.Tr("repo.release.new_release")
ctx.Data["tag_target"] = ctx.Repo.Repository.DefaultBranch ctx.Data["tag_target"] = ctx.Repo.Repository.DefaultBranch
ctx.Data["IsRepoToolbarReleases"] = true
ctx.Data["IsRepoReleaseNew"] = true
ctx.HTML(200, RELEASE_NEW) ctx.HTML(200, RELEASE_NEW)
} }
func NewReleasePost(ctx *middleware.Context, form auth.NewReleaseForm) { 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["Title"] = ctx.Tr("repo.release.new_release")
ctx.Data["IsRepoToolbarReleases"] = true
ctx.Data["IsRepoReleaseNew"] = true
if ctx.HasError() { if ctx.HasError() {
ctx.HTML(200, RELEASE_NEW) ctx.HTML(200, RELEASE_NEW)
@ -185,8 +168,8 @@ func NewReleasePost(ctx *middleware.Context, form auth.NewReleaseForm) {
} }
rel := &models.Release{ rel := &models.Release{
RepoId: ctx.Repo.Repository.ID, RepoID: ctx.Repo.Repository.ID,
PublisherId: ctx.User.Id, PublisherID: ctx.User.Id,
Title: form.Title, Title: form.Title,
TagName: form.TagName, TagName: form.TagName,
Target: form.Target, 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.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) ctx.RenderWithErr(ctx.Tr("repo.release.tag_name_already_exist"), RELEASE_NEW, &form)
} else { } else {
ctx.Handle(500, "CreateRelease", err) ctx.Handle(500, "CreateRelease", err)
} }
return 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") ctx.Redirect(ctx.Repo.RepoLink + "/releases")
} }
func EditRelease(ctx *middleware.Context) { func EditRelease(ctx *middleware.Context) {
if !ctx.Repo.IsOwner() { ctx.Data["Title"] = ctx.Tr("repo.release.edit_release")
ctx.Handle(403, "release.ReleasesEdit", nil) ctx.Data["PageIsEditRelease"] = true
return
}
tagName := ctx.Params(":tagname") tagName := ctx.Params(":tagname")
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 models.IsErrReleaseNotExist(err) {
ctx.Handle(404, "GetRelease", err) ctx.Handle(404, "GetRelease", err)
} else { } else {
ctx.Handle(500, "GetRelease", err) ctx.Handle(500, "GetRelease", err)
} }
return 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.HTML(200, RELEASE_NEW)
ctx.Data["IsRepoToolbarReleases"] = true
ctx.HTML(200, RELEASE_EDIT)
} }
func EditReleasePost(ctx *middleware.Context, form auth.EditReleaseForm) { func EditReleasePost(ctx *middleware.Context, form auth.EditReleaseForm) {
if !ctx.Repo.IsOwner() { ctx.Data["Title"] = ctx.Tr("repo.release.edit_release")
ctx.Handle(403, "release.EditReleasePost", nil) ctx.Data["PageIsEditRelease"] = true
return
}
tagName := ctx.Params(":tagname") tagName := ctx.Params(":tagname")
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 models.IsErrReleaseNotExist(err) {
ctx.Handle(404, "GetRelease", err) ctx.Handle(404, "GetRelease", err)
} else { } else {
ctx.Handle(500, "GetRelease", err) ctx.Handle(500, "GetRelease", err)
} }
return 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() { if ctx.HasError() {
ctx.HTML(200, RELEASE_EDIT) ctx.HTML(200, RELEASE_NEW)
return return
} }
ctx.Data["Title"] = ctx.Tr("repo.release.edit_release")
ctx.Data["IsRepoToolbarReleases"] = true
rel.Title = form.Title rel.Title = form.Title
rel.Note = form.Content rel.Note = form.Content
rel.IsDraft = len(form.Draft) > 0 rel.IsDraft = len(form.Draft) > 0

View file

@ -1 +1 @@
0.7.11.1115 Beta 0.7.12.1115 Beta

View file

@ -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" .}}

View file

@ -1,73 +1,80 @@
{{template "ng/base/head" .}} {{template "base/head" .}}
{{template "ng/base/header" .}} <div class="repository release">
<div id="repo-wrapper"> {{template "repo/header" .}}
{{template "repo/header_old" .}} <div class="ui container">
<div id="repo-content" class="clear container"> {{template "repo/sidebar" .}}
<div id="repo-main" class="left grid-5-6"> <h2 class="ui header">
<div id="release"> {{.i18n.Tr "repo.release.releases"}}
<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 -->
{{if .IsRepositoryAdmin}} {{if .IsRepositoryAdmin}}
<a class="btn" href="{{$.RepoLink}}/releases/new"> <div class="ui right">
<button class="btn btn-medium btn-blue btn-radius"> <a class="ui small green button" href="{{$.RepoLink}}/releases/new">
{{.i18n.Tr "repo.release.new_release"}} {{.i18n.Tr "repo.release.new_release"}}
</button>
</a> </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>
<div class="grid-9-12 release-detail left"> {{end}}
<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> </h2>
<p class="info"> <ul id="release-list">
<span class="author"><img class="avatar-20" src="{{.Publisher.AvatarLink}}">&nbsp;&nbsp; {{range .Releases}}
<a href="{{AppSubUrl}}/{{.Publisher.Name}}">{{.Publisher.Name}}</a></span> <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}} {{if .Created}}<span class="time">{{TimeSince .Created $.Lang}}</span>{{end}}
<span class="ahead">{{$.i18n.Tr "repo.release.ahead" .NumCommitsBehind .Target | Str2html}}</span> <span class="ahead">{{$.i18n.Tr "repo.release.ahead" .NumCommitsBehind .Target | Str2html}}</span>
</p> </p>
<div class="markdown desc"> <div class="markdown desc">
{{Str2html .Note}} {{Str2html .Note}}
</div> </div>
<p class="download"> <div 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> <h2>{{$.i18n.Tr "repo.release.downloads"}}</h2>
<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> <ul class="list">
</p> <li>
<span class="dot">&nbsp;</span> <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> </div>
{{else}} {{else}}
<div class="grid-1-6 text-right release-meta"> <h4>
<a class="commit" href="{{$.RepoLink}}/src/{{.Sha1}}" rel="nofollow"><i class="fa fa-code"></i> {{ShortSha .Sha1}}</a> <a href="{{$.RepoLink}}/src/{{.TagName}}" rel="nofollow"><i class="tag icon"></i> {{.TagName}}</a>
</div> </h4>
<div class="grid-9-12 release-detail left"> <div class="download">
<h5 class="title"><a href="{{$.RepoLink}}/src/{{.TagName}}" rel="nofollow">{{.TagName}}</a> <i class="fa fa-tag"></i></h5> <a href="{{$.RepoLink}}/archive/{{.TagName}}.zip" rel="nofollow"><i class="octicon octicon-file-zip"></i> ZIP</a>
<p class="download"> <a href="{{$.RepoLink}}/archive/{{.TagName}}.tar.gz"><i class="octicon octicon-file-zip"></i> TAR.GZ</a>
<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">&nbsp;</span>
</div> </div>
{{end}} {{end}}
<span class="dot">&nbsp;</span>
</div>
</li> </li>
{{end}} {{end}}
</ul> </ul>
</div> </div>
</div> </div>
{{template "repo/sidebar" .}} {{template "base/footer" .}}
</div>
</div>
{{template "ng/base/footer" .}}

View file

@ -1,68 +1,83 @@
{{template "ng/base/head" .}} {{template "base/head" .}}
{{template "ng/base/header" .}} <div class="repository new release">
<div id="repo-wrapper"> {{template "repo/header" .}}
{{template "repo/header_old" .}} <div class="ui container">
<div id="repo-content" class="clear container"> {{template "repo/sidebar" .}}
<div id="repo-main" class="left grid-5-6"> <h2 class="ui dividing header">
{{template "ng/base/alert" .}} {{if .PageIsEditRelease}}
<div id="release"> {{.i18n.Tr "repo.release.edit_release"}}
<h4 id="release-head">{{.i18n.Tr "repo.release.new_release"}}</h4> <div class="sub header">{{.i18n.Tr "repo.release.edit_subheader"}}</div>
<form class="form" id="release-new-form" action="{{.RepoLink}}/releases/new" method="post"> {{else}}
{{.CsrfTokenHtml}} {{.i18n.Tr "repo.release.new_release"}}
<div class="field"> <div class="sub header">{{.i18n.Tr "repo.release.new_subheader"}}</div>
<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>
{{end}} {{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> </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> </div>
<p class="help">{{.i18n.Tr "repo.release.tag_helper"}}</p>
<div class="field"> <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> <label>{{.i18n.Tr "repo.release.content"}}</label>
</div> <textarea name="content">{{.content}}</textarea>
<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>
</div> </div>
</div> </div>
<div class="markdown hide" id="release-preview">{{.i18n.Tr "repo.release.loading"}}</div> <div class="ui container">
<hr> <div class="ui divider"></div>
<div class="text-right"> <div class="ui text right">
<input class="ipt-chk" name="prerelease" type="checkbox" {{if .prerelease}}checked{{end}}/> <div class="prerelease field">
<span><strong>{{.i18n.Tr "repo.release.prerelease_desc"}}</strong></span> <div class="ui checkbox">
<p>{{.i18n.Tr "repo.release.prerelease_helper"}}</p> <input type="checkbox" name="prerelease" {{if .prerelease}}checked{{end}}>
<button class="btn btn-large btn-green btn-radius">{{.i18n.Tr "repo.release.publish"}}</button> <label><strong>{{.i18n.Tr "repo.release.prerelease_desc"}}</strong></label>
<input class="btn btn-large btn-gary btn-radius" type="submit" name="draft" value="{{.i18n.Tr "repo.release.save_draft"}}"/> </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>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
{{template "repo/sidebar" .}} {{template "base/footer" .}}
</div>
</div>
{{template "ng/base/footer" .}}