Chose visibility when creating org

This commit is contained in:
Matti Ranta 2018-06-29 19:16:34 -04:00
parent 6db8162c04
commit d4c63672a7
No known key found for this signature in database
GPG Key ID: D9B5613BEB813F99
3 changed files with 24 additions and 1 deletions

View File

@ -127,7 +127,6 @@ func CreateOrganization(org, owner *User) (err error) {
org.NumTeams = 1
org.NumMembers = 1
org.Type = UserTypeOrganization
org.Visibility = VisibleType(setting.Service.DefaultVisibilityMode)
sess := x.NewSession()
defer sess.Close()

View File

@ -1,4 +1,5 @@
// Copyright 2014 The Gogs Authors. All rights reserved.
// Copyright 2018 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
@ -23,6 +24,7 @@ const (
// Create render the page for create organization
func Create(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("new_org")
ctx.Data["DefaultVisibilityMode"] = Setting.Service.DefaultVisibilityMode
if !ctx.User.CanCreateOrganization() {
ctx.ServerError("Not allowed", errors.New(ctx.Tr("org.form.create_org_not_allowed")))
return

View File

@ -15,6 +15,28 @@
<span class="help">{{.i18n.Tr "org.org_name_helper"}}</span>
</div>
<div class="inline required field {{if .Err_OrgVisibility}}error{{end}}">
<label for="visibility">{{.i18n.Tr "org.settings.visibility"}}</label>
<div class="field">
<div class="ui radio checkbox">
<input class="hidden enable-system-radio" tabindex="0" name="visibility" type="radio" value="1" {{if eq .DefaultVisibilityMode 1}}checked{{end}}/>
<label>{{.i18n.Tr "org.settings.visibility.public"}}</label>
</div>
</div>
<div class="field">
<div class="ui radio checkbox">
<input class="hidden enable-system-radio" tabindex="0" name="visibility" type="radio" value="2" {{if eq .DefaultVisibilityMode 2}}checked{{end}}/>
<label>{{.i18n.Tr "org.settings.visibility.limited"}}</label>
</div>
</div>
<div class="field">
<div class="ui radio checkbox">
<input class="hidden enable-system-radio" tabindex="0" name="visibility" type="radio" value="3" {{if eq .DefaultVisibilityMode 3}}checked{{end}}/>
<label>{{.i18n.Tr "org.settings.visibility.private"}}</label>
</div>
</div>
</div>
<div class="inline field">
<label></label>
<button class="ui green button">