tokarchuk/v1.17
Unknwon 9 years ago
parent 1a901433e2
commit 18de67380c
  1. 2
      README.md
  2. 14
      conf/locale/locale_en-US.ini
  3. 2
      gogs.go
  4. 26
      models/error.go
  5. 34
      models/release.go
  6. 2
      models/repo.go
  7. 10
      modules/auth/repo_form.go
  8. 4
      modules/bindata/bindata.go
  9. 79
      public/css/gogs.css
  10. 96
      public/less/_repository.less
  11. 71
      routers/repo/release.go
  12. 2
      templates/.VERSION
  13. 59
      templates/repo/release/edit.tmpl
  14. 147
      templates/repo/release/list.tmpl
  15. 145
      templates/repo/release/new.tmpl

@ -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>

@ -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 = We’ll point out that this release is not production-ready. release.prerelease_helper = We’ll 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

@ -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())

@ -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)
}
// __ __ ___. .__ __ // __ __ ___. .__ __
// / \ / \ ____\_ |__ | |__ ____ ____ | | __ // / \ / \ ____\_ |__ | |__ ____ ____ | | __
// \ \/\/ // __ \| __ \| | \ / _ \ / _ \| |/ / // \ \/\/ // __ \| __ \| | \ / _ \ / _ \| |/ /

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

@ -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

@ -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

@ -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;

@ -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

@ -13,15 +13,12 @@ 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

@ -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 "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"> {{if .IsRepositoryAdmin}}
<span class="release"><strong>{{.i18n.Tr "repo.release.releases"}}</strong></span><!-- / <div class="ui right">
<a class="tag" href="{{AppSubUrl}}/{tag_link}">Tags</a> --> <a class="ui small green button" href="{{$.RepoLink}}/releases/new">
<!-- comment : if in tag page, show a.release and span.tag please --> {{.i18n.Tr "repo.release.new_release"}}
{{if .IsRepositoryAdmin}} </a>
<a class="btn" href="{{$.RepoLink}}/releases/new"> </div>
<button class="btn btn-medium btn-blue btn-radius"> {{end}}
{{.i18n.Tr "repo.release.new_release"}} </h2>
</button> <ul id="release-list">
</a> {{range .Releases}}
{{end}} <li class="ui grid">
</h4> <div class="ui four wide column meta">
<ul id="release-list" class="list-unstyled"> {{if .PublisherID}}
{{range .Releases}} {{if .IsDraft}}
<li class="release-item clearfix" id="release-{{.Sha1}}"> <span class="ui yellow label">{{$.i18n.Tr "repo.release.draft"}}</span>
{{if .PublisherId}} {{else if .IsPrerelease}}
<div class="grid-1-6 text-right release-meta"> <span class="ui orange label">{{$.i18n.Tr "repo.release.prerelease"}}</span>
{{if .IsDraft}} {{else}}
<span class="label label-blue label-radius">{{$.i18n.Tr "repo.release.draft"}}</span> <span class="ui green label">{{$.i18n.Tr "repo.release.stable"}}</span>
{{else if .IsPrerelease}} {{end}}
<span class="label label-orange label-radius">{{$.i18n.Tr "repo.release.prerelease"}}</span> <span class="tag text blue">
{{else}} <a href="{{$.RepoLink}}/src/{{.TagName}}" rel="nofollow"><i class="tag icon"></i> {{.TagName}}</a>
<span class="label label-green label-radius">{{$.i18n.Tr "repo.release.stable"}}</span> </span>
{{end}} {{end}}
<a class="tag" href="{{$.RepoLink}}/src/{{.TagName}}" rel="nofollow"><i class="fa fa-tag"></i> {{.TagName}}</a> <span class="commit">
<a class="commit" href="{{$.RepoLink}}/src/{{.Sha1}}" rel="nofollow"><i class="fa fa-code"></i> {{ShortSha .Sha1}}</a> <a href="{{$.RepoLink}}/src/{{.Sha1}}" rel="nofollow"><i class="code icon"></i> {{ShortSha .Sha1}}</a>
</div> </span>
<div class="grid-9-12 release-detail left"> </div>
<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> <div class="ui twelve wide column detail">
<p class="info"> {{if .PublisherID}}
<span class="author"><img class="avatar-20" src="{{.Publisher.AvatarLink}}">&nbsp;&nbsp; <h3>
<a href="{{AppSubUrl}}/{{.Publisher.Name}}">{{.Publisher.Name}}</a></span> <a href="{{$.RepoLink}}/src/{{.TagName}}">{{.Title}}</a>
{{if .Created}}<span class="time">{{TimeSince .Created $.Lang}}</span>{{end}} <small>(<a href="{{$.RepoLink}}/releases/edit/{{.TagName}}" rel="nofollow">{{$.i18n.Tr "repo.release.edit"}}</a>)</small>
<span class="ahead">{{$.i18n.Tr "repo.release.ahead" .NumCommitsBehind .Target | Str2html}}</span> </h3>
</p> <p class="text grey">
<div class="markdown desc"> <span class="author">
{{Str2html .Note}} <img class="img-10" src="{{.Publisher.AvatarLink}}">
</div> <a href="{{AppSubUrl}}/{{.Publisher.Name}}">{{.Publisher.Name}}</a>
<p class="download"> </span>
<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> {{if .Created}}<span class="time">{{TimeSince .Created $.Lang}}</span>{{end}}
<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> <span class="ahead">{{$.i18n.Tr "repo.release.ahead" .NumCommitsBehind .Target | Str2html}}</span>
</p> </p>
<span class="dot">&nbsp;</span> <div class="markdown desc">
</div> {{Str2html .Note}}
{{else}} </div>
<div class="grid-1-6 text-right release-meta"> <div class="download">
<a class="commit" href="{{$.RepoLink}}/src/{{.Sha1}}" rel="nofollow"><i class="fa fa-code"></i> {{ShortSha .Sha1}}</a> <h2>{{$.i18n.Tr "repo.release.downloads"}}</h2>
</div> <ul class="list">
<div class="grid-9-12 release-detail left"> <li>
<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="icon octicon octicon-file-zip"></i> {{$.i18n.Tr "repo.release.source_code"}} (ZIP)</a>
<p class="download"> </li>
<a class="download-link" href="{{$.RepoLink}}/archive/{{.TagName}}.zip" rel="nofollow"><i class="fa fa-download"></i> ZIP</a> <li>
<a class="download-link" href="{{$.RepoLink}}/archive/{{.TagName}}.tar.gz"><i class="fa fa-download"></i> TAR.GZ</a> <a href="{{$.RepoLink}}/archive/{{.TagName}}.tar.gz"><i class="icon octicon octicon-file-zip"></i> {{$.i18n.Tr "repo.release.source_code"}} (TAR.GZ)</a>
</p> </li>
<span class="dot">&nbsp;</span> </ul>
</div> </div>
{{end}} {{else}}
</li> <h4>
{{end}} <a href="{{$.RepoLink}}/src/{{.TagName}}" rel="nofollow"><i class="tag icon"></i> {{.TagName}}</a>
</ul> </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> </div>
{{end}}
<span class="dot">&nbsp;</span>
</div> </div>
{{template "repo/sidebar" .}} </li>
</div> {{end}}
</ul>
</div>
</div> </div>
{{template "ng/base/footer" .}} {{template "base/footer" .}}

@ -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> {{end}}
<span class="target-at">@</span> </h2>
<div class="inline-block drop"> {{template "base/alert" .}}
<button class="btn btn-gray btn-medium btn-radius drop-bottom"> <form class="ui form grid" action="{{.Link}}" method="post">
<i class="octicon octicon-git-branch"></i> {{.i18n.Tr "repo.release.target"}} : {{.CsrfTokenHtml}}
<strong id="repo-branch-current">{{.Repository.DefaultBranch}}</strong> <div class="ui seven wide column target">
</button> <div class="inline field {{if .Err_TagName}}error{{end}}">
<ul class="drop-down menu menu-vertical menu-radius switching-list" id="release-new-target-branch-list"> {{if .PageIsEditRelease}}
{{range .Branches}} <b>{{.tag_name}}</b><span class="at">@</span><strong>{{.tag_target}}</strong>
<li {{if eq . $.tag_target}}class="checked"{{end}}><a><i class="octicon octicon-check"></i>{{.}}</a></li> {{else}}
{{end}} <input name="tag_name" value="{{.tag_name}}" placeholder="{{.i18n.Tr "repo.release.tag_name"}}" autofocus required>
</ul> <span class="at">@</span>
</div> <div class="ui selection dropdown">
<input id="tag-target" type="hidden" name="tag_target" value="{{.tag_target}}"/> <input type="hidden" name="tag_target" value="{{.tag_target}}"/>
</div> <i class="octicon octicon-git-branch"></i>
<p class="help">{{.i18n.Tr "repo.release.tag_helper"}}</p> <div class="text">
<div class="field"> {{.i18n.Tr "repo.release.target"}} :
<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> <strong id="repo-branch-current">{{.Repository.DefaultBranch}}</strong>
</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>
</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>
</form>
</div> </div>
<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 class="field">
<label>{{.i18n.Tr "repo.release.content"}}</label>
<textarea name="content">{{.content}}</textarea>
</div>
</div>
<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>
{{template "repo/sidebar" .}} </div>
</div> </form>
</div>
</div> </div>
{{template "ng/base/footer" .}} {{template "base/footer" .}}
Loading…
Cancel
Save