Browse Source

Fix can not save release draft as draft again (#3669)

But release was not saved as draft in the first time, is not
possible to be draft afterwards because the Git tag was created.
pull/4070/head
Unknwon 8 years ago
parent
commit
7463d9c51d
No known key found for this signature in database
GPG Key ID: FB9F411CDD69BEC1
  1. 2
      gogs.go
  2. 2
      routers/repo/release.go
  3. 2
      templates/.VERSION
  4. 17
      templates/repo/release/new.tmpl

2
gogs.go

@ -16,7 +16,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.9.127.0130" const APP_VER = "0.9.128.0130"
func init() { func init() {
setting.AppVer = APP_VER setting.AppVer = APP_VER

2
routers/repo/release.go

@ -240,6 +240,7 @@ func EditRelease(ctx *context.Context) {
ctx.Data["title"] = rel.Title ctx.Data["title"] = rel.Title
ctx.Data["content"] = rel.Note ctx.Data["content"] = rel.Note
ctx.Data["prerelease"] = rel.IsPrerelease ctx.Data["prerelease"] = rel.IsPrerelease
ctx.Data["IsDraft"] = rel.IsDraft
ctx.HTML(200, RELEASE_NEW) ctx.HTML(200, RELEASE_NEW)
} }
@ -264,6 +265,7 @@ func EditReleasePost(ctx *context.Context, form auth.EditReleaseForm) {
ctx.Data["title"] = rel.Title ctx.Data["title"] = rel.Title
ctx.Data["content"] = rel.Note ctx.Data["content"] = rel.Note
ctx.Data["prerelease"] = rel.IsPrerelease ctx.Data["prerelease"] = rel.IsPrerelease
ctx.Data["IsDraft"] = rel.IsDraft
if ctx.HasError() { if ctx.HasError() {
ctx.HTML(200, RELEASE_NEW) ctx.HTML(200, RELEASE_NEW)

2
templates/.VERSION

@ -1 +1 @@
0.9.127.0130 0.9.128.0130

17
templates/repo/release/new.tmpl

@ -60,12 +60,20 @@
</div> </div>
<span class="help">{{.i18n.Tr "repo.release.prerelease_helper"}}</span> <span class="help">{{.i18n.Tr "repo.release.prerelease_helper"}}</span>
<div class="field"> <div class="field">
<a class="ui blue basic button" href="{{.RepoLink}}/releases">
{{.i18n.Tr "repo.release.cancel"}}
</a>
{{/* Release didn't save as draft at first time is not possible to be draft again because the Git tag had been created. */}}
{{if or (not .PageIsEditRelease) .IsDraft}}
<input class="ui grey button" type="submit" name="draft" value="{{.i18n.Tr "repo.release.save_draft"}}"/>
{{end}}
{{if .PageIsEditRelease}} {{if .PageIsEditRelease}}
<a class="ui blue basic button" href="{{.RepoLink}}/releases">
{{.i18n.Tr "repo.release.cancel"}}
</a>
<button class="ui green button"> <button class="ui green button">
{{.i18n.Tr "repo.release.edit_release"}} {{if .IsDraft}}
{{.i18n.Tr "repo.release.publish"}}
{{else}}
{{.i18n.Tr "repo.release.edit_release"}}
{{end}}
</button> </button>
<a class="ui red button delete-button" data-url="{{$.RepoLink}}/releases/delete" data-id="{{.ID}}"> <a class="ui red button delete-button" data-url="{{$.RepoLink}}/releases/delete" data-id="{{.ID}}">
{{$.i18n.Tr "repo.release.delete_release"}} {{$.i18n.Tr "repo.release.delete_release"}}
@ -74,7 +82,6 @@
<button class="ui green button"> <button class="ui green button">
{{.i18n.Tr "repo.release.publish"}} {{.i18n.Tr "repo.release.publish"}}
</button> </button>
<input class="ui grey button" type="submit" name="draft" value="{{.i18n.Tr "repo.release.save_draft"}}"/>
{{end}} {{end}}
</div> </div>
</div> </div>

Loading…
Cancel
Save