add release-new route

pull/197/head
FuXiaoHei 11 years ago
parent 75db79b4b6
commit 3ede496383
  1. 8
      routers/repo/release.go
  2. 15
      templates/release/new.tmpl
  3. 2
      templates/repo/toolbar.tmpl
  4. 1
      web.go

@ -12,6 +12,7 @@ import (
func Releases(ctx *middleware.Context) {
ctx.Data["Title"] = "Releases"
ctx.Data["IsRepoToolbarReleases"] = true
ctx.Data["IsRepoReleaseNew"] = false
tags, err := models.GetTags(ctx.Repo.Owner.Name, ctx.Repo.Repository.Name)
if err != nil {
ctx.Handle(404, "repo.Releases(GetTags)", err)
@ -20,3 +21,10 @@ func Releases(ctx *middleware.Context) {
ctx.Data["Releases"] = tags
ctx.HTML(200, "release/list")
}
func ReleasesNew(ctx *middleware.Context) {
ctx.Data["Title"] = "New Release"
ctx.Data["IsRepoToolbarReleases"] = true
ctx.Data["IsRepoReleaseNew"] = true
ctx.HTML(200, "release/new")
}

@ -0,0 +1,15 @@
{{template "base/head" .}}
{{template "base/navbar" .}}
{{template "repo/nav" .}}
{{template "repo/toolbar" .}}
<div id="body" class="container">
<div id="release">
<h4 id="release-head">New Release</h4>
<form id="release-new-form" action="" class="form form-inline">
<div class="form-group">
<input id="release-tag-name" type="text" class="form-control" placeholder="tag name"/>
</div>
</form>
</div>
</div>
{{template "base/footer" .}}

@ -15,7 +15,7 @@
{{end}}
<li class="{{if .IsRepoToolbarReleases}}active{{end}}"><a href="{{.RepoLink}}/releases">{{if .Repository.NumReleases}}<span class="badge">{{.Repository.NumReleases}}</span> {{end}}Releases</a></li>
{{if .IsRepoToolbarReleases}}
<li class="tmp"><a href="{{.RepoLink}}/releases/new"><button class="btn btn-primary btn-sm">New Release</button></a></li>
<li class="tmp">{{if not .IsRepoReleaseNew}}<a href="{{.RepoLink}}/releases/new"><button class="btn btn-primary btn-sm">New Release</button></a>{{end}}</li>
{{end}}
<!-- <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">More <b class="caret"></b></a>

@ -148,6 +148,7 @@ func runWeb(*cli.Context) {
r.Get("/issues", repo.Issues)
r.Get("/issues/:index", repo.ViewIssue)
r.Get("/releases", repo.Releases)
r.Any("/releases/new",repo.ReleasesNew)
r.Get("/pulls", repo.Pulls)
r.Get("/branches", repo.Branches)
}, ignSignIn, middleware.RepoAssignment(true))

Loading…
Cancel
Save