add organization create page

This commit is contained in:
fuxiaohei 2014-06-23 11:40:49 +08:00
parent 314193029a
commit ea507e20d4
4 changed files with 61 additions and 8 deletions

View file

@ -189,6 +189,7 @@ func runWeb(*cli.Context) {
reqOwner := middleware.RequireOwner() reqOwner := middleware.RequireOwner()
m.Group("/o", func(r martini.Router) { m.Group("/o", func(r martini.Router) {
r.Get("/create",org.New)
r.Get("/:org", org.Organization) r.Get("/:org", org.Organization)
r.Get("/:org/members", org.Members) r.Get("/:org/members", org.Members)
r.Get("/:org/teams", org.Teams) r.Get("/:org/teams", org.Teams)

View file

@ -372,7 +372,7 @@ html, body {
/* gogits repo create */ /* gogits repo create */
#repo-create { #repo-create, #org-create {
width: 800px; width: 800px;
} }

View file

@ -6,17 +6,21 @@ import (
) )
func Organization(ctx *middleware.Context, params martini.Params) { func Organization(ctx *middleware.Context, params martini.Params) {
ctx.Data["Title"] = "Organization " + params["org"] ctx.Data["Title"] = "Organization "+params["org"]
ctx.HTML(200, "org/org") ctx.HTML(200, "org/org")
} }
func Members(ctx *middleware.Context,params martini.Params){ func Members(ctx *middleware.Context, params martini.Params) {
ctx.Data["Title"] = "Organization " + params["org"]+" Members" ctx.Data["Title"] = "Organization "+params["org"]+" Members"
ctx.HTML(200,"org/members") ctx.HTML(200, "org/members")
} }
func Teams(ctx *middleware.Context,params martini.Params){ func Teams(ctx *middleware.Context, params martini.Params) {
ctx.Data["Title"] = "Organization " + params["org"]+" Teams" ctx.Data["Title"] = "Organization "+params["org"]+" Teams"
ctx.HTML(200,"org/teams") ctx.HTML(200, "org/teams")
} }
func New(ctx *middleware.Context) {
ctx.Data["Title"] = "Create an Organization"
ctx.HTML(200, "org/new")
}

48
templates/org/new.tmpl Normal file
View file

@ -0,0 +1,48 @@
{{template "base/head" .}}
{{template "base/navbar" .}}
<div class="container" id="body">
<form action="/repo/create" method="post" class="form-horizontal card" id="org-create">
{{.CsrfTokenHtml}}
<h3>Create New Organization</h3>
{{template "base/alert" .}}
<div class="form-group">
<label class="col-md-2 control-label">Owner<strong class="text-danger">*</strong></label>
<div class="col-md-8">
<p class="form-control-static">{{.SignedUserName}}</p>
<input type="hidden" value="{{.SignedUserId}}" name="userId"/>
</div>
</div>
<div class="form-group {{if .Err_RepoName}}has-error has-feedback{{end}}">
<label class="col-md-2 control-label">Organization<strong class="text-danger">*</strong></label>
<div class="col-md-8">
<input name="repo" type="text" class="form-control" placeholder="Type your repository name" value="{{.repo}}" required="required">
<span class="help-block">Great organization names are short and memorable. </span>
</div>
</div>
<div class="form-group {{if .Err_Email}}has-error has-feedback{{end}}">
<label class="col-md-2 control-label">Email<strong class="text-danger">*</strong></label>
<div class="col-md-8">
<input name="email" type="text" class="form-control" placeholder="Type organization's email" value="" required="required">
<span class="help-block">Organization's Email receives all notifications and confirmations.</span>
</div>
</div>
<!--
<div class="form-group">
<label class="col-md-2 control-label">Owners<strong class="text-danger">*</strong></label>
<div class="col-md-8">
owners
</div>
</div>-->
<div class="form-group">
<div class="col-md-offset-2 col-md-8">
<button type="submit" class="btn btn-lg btn-primary">Create An Organization</button>
<a href="/" class="text-danger">Cancel</a>
</div>
</div>
</form>
</div>
{{template "base/footer" .}}