Add UI visibility in organization settings
This commit is contained in:
parent
977dcf96e0
commit
c2a75b3762
|
@ -72,6 +72,20 @@ var (
|
|||
ErrUnsupportedLoginType = errors.New("Login source is unknown")
|
||||
)
|
||||
|
||||
// VisibleType define the visibility (Organization only)
|
||||
type VisibleType int
|
||||
|
||||
const (
|
||||
// VisibleType Visible for everyone
|
||||
VisibleTypePublic VisibleType = iota + 1
|
||||
|
||||
// VisibleTypeLimited Visible for every connected user
|
||||
VisibleTypeLimited
|
||||
|
||||
// VisibleTypePrivate Visible only for organization's members
|
||||
VisibleTypePrivate
|
||||
)
|
||||
|
||||
// User represents the object of individual and member of organization.
|
||||
type User struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
|
@ -131,6 +145,7 @@ type User struct {
|
|||
NumMembers int
|
||||
Teams []*Team `xorm:"-"`
|
||||
Members []*User `xorm:"-"`
|
||||
Visibility VisibleType `xorm:"DEFAULT 1"`
|
||||
|
||||
// Preferences
|
||||
DiffViewStyle string `xorm:"NOT NULL DEFAULT ''"`
|
||||
|
|
|
@ -35,6 +35,7 @@ type UpdateOrgSettingForm struct {
|
|||
Description string `binding:"MaxSize(255)"`
|
||||
Website string `binding:"ValidUrl;MaxSize(255)"`
|
||||
Location string `binding:"MaxSize(50)"`
|
||||
Visibility models.VisibleType
|
||||
MaxRepoCreation int
|
||||
}
|
||||
|
||||
|
|
|
@ -992,6 +992,11 @@ settings.options = Options
|
|||
settings.full_name = Full Name
|
||||
settings.website = Website
|
||||
settings.location = Location
|
||||
settings.visibility = Visibility
|
||||
settings.visibility.public = Public
|
||||
settings.visibility.limited = Limited (Visible to connected user only)
|
||||
settings.visibility.private = Private (Visible only to organization members)
|
||||
|
||||
settings.update_settings = Update Settings
|
||||
settings.update_setting_success = Organization settings have been updated.
|
||||
settings.change_orgname_prompt = This change will change the links to the organization.
|
||||
|
|
|
@ -29,6 +29,7 @@ const (
|
|||
func Settings(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("org.settings")
|
||||
ctx.Data["PageIsSettingsOptions"] = true
|
||||
ctx.Data["CurrentVisibility"] = models.VisibleType(ctx.Org.Organization.Visibility)
|
||||
ctx.HTML(200, tplSettingsOptions)
|
||||
}
|
||||
|
||||
|
@ -79,6 +80,7 @@ func SettingsPost(ctx *context.Context, form auth.UpdateOrgSettingForm) {
|
|||
org.Description = form.Description
|
||||
org.Website = form.Website
|
||||
org.Location = form.Location
|
||||
org.Visibility = form.Visibility
|
||||
if err := models.UpdateUser(org); err != nil {
|
||||
ctx.Handle(500, "UpdateUser", err)
|
||||
return
|
||||
|
|
|
@ -33,6 +33,29 @@
|
|||
<input id="location" name="location" value="{{.Org.Location}}">
|
||||
</div>
|
||||
|
||||
<div class="ui divider"></div>
|
||||
<div class="field" id="visibility_box">
|
||||
<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 .CurrentVisibility 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 .CurrentVisibility 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 .CurrentVisibility 3}}checked{{end}}/>
|
||||
<label>{{.i18n.Tr "org.settings.visibility.private"}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{if .SignedUser.IsAdmin}}
|
||||
<div class="ui divider"></div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user