mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-24 10:46:10 +01:00
add release-new route
This commit is contained in:
parent
75db79b4b6
commit
3ede496383
|
@ -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")
|
||||
}
|
||||
|
|
15
templates/release/new.tmpl
Normal file
15
templates/release/new.tmpl
Normal file
|
@ -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>
|
||||
|
|
1
web.go
1
web.go
|
@ -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…
Reference in a new issue