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")
|
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.
|
// User represents the object of individual and member of organization.
|
||||||
type User struct {
|
type User struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64 `xorm:"pk autoincr"`
|
||||||
|
@ -129,8 +143,9 @@ type User struct {
|
||||||
Description string
|
Description string
|
||||||
NumTeams int
|
NumTeams int
|
||||||
NumMembers int
|
NumMembers int
|
||||||
Teams []*Team `xorm:"-"`
|
Teams []*Team `xorm:"-"`
|
||||||
Members []*User `xorm:"-"`
|
Members []*User `xorm:"-"`
|
||||||
|
Visibility VisibleType `xorm:"DEFAULT 1"`
|
||||||
|
|
||||||
// Preferences
|
// Preferences
|
||||||
DiffViewStyle string `xorm:"NOT NULL DEFAULT ''"`
|
DiffViewStyle string `xorm:"NOT NULL DEFAULT ''"`
|
||||||
|
|
|
@ -35,6 +35,7 @@ type UpdateOrgSettingForm struct {
|
||||||
Description string `binding:"MaxSize(255)"`
|
Description string `binding:"MaxSize(255)"`
|
||||||
Website string `binding:"ValidUrl;MaxSize(255)"`
|
Website string `binding:"ValidUrl;MaxSize(255)"`
|
||||||
Location string `binding:"MaxSize(50)"`
|
Location string `binding:"MaxSize(50)"`
|
||||||
|
Visibility models.VisibleType
|
||||||
MaxRepoCreation int
|
MaxRepoCreation int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -992,6 +992,11 @@ settings.options = Options
|
||||||
settings.full_name = Full Name
|
settings.full_name = Full Name
|
||||||
settings.website = Website
|
settings.website = Website
|
||||||
settings.location = Location
|
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_settings = Update Settings
|
||||||
settings.update_setting_success = Organization settings have been updated.
|
settings.update_setting_success = Organization settings have been updated.
|
||||||
settings.change_orgname_prompt = This change will change the links to the organization.
|
settings.change_orgname_prompt = This change will change the links to the organization.
|
||||||
|
@ -1424,4 +1429,4 @@ error.failed_retrieval_gpg_keys = "Failed to retrieve any key attached to the co
|
||||||
|
|
||||||
[units]
|
[units]
|
||||||
error.no_unit_allowed_repo = Cannot find any unit allowed on this repository
|
error.no_unit_allowed_repo = Cannot find any unit allowed on this repository
|
||||||
error.unit_not_allowed = You have not allowed to visit this repository unit
|
error.unit_not_allowed = You have not allowed to visit this repository unit
|
||||||
|
|
|
@ -29,6 +29,7 @@ const (
|
||||||
func Settings(ctx *context.Context) {
|
func Settings(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("org.settings")
|
ctx.Data["Title"] = ctx.Tr("org.settings")
|
||||||
ctx.Data["PageIsSettingsOptions"] = true
|
ctx.Data["PageIsSettingsOptions"] = true
|
||||||
|
ctx.Data["CurrentVisibility"] = models.VisibleType(ctx.Org.Organization.Visibility)
|
||||||
ctx.HTML(200, tplSettingsOptions)
|
ctx.HTML(200, tplSettingsOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,6 +80,7 @@ func SettingsPost(ctx *context.Context, form auth.UpdateOrgSettingForm) {
|
||||||
org.Description = form.Description
|
org.Description = form.Description
|
||||||
org.Website = form.Website
|
org.Website = form.Website
|
||||||
org.Location = form.Location
|
org.Location = form.Location
|
||||||
|
org.Visibility = form.Visibility
|
||||||
if err := models.UpdateUser(org); err != nil {
|
if err := models.UpdateUser(org); err != nil {
|
||||||
ctx.Handle(500, "UpdateUser", err)
|
ctx.Handle(500, "UpdateUser", err)
|
||||||
return
|
return
|
||||||
|
|
|
@ -33,6 +33,29 @@
|
||||||
<input id="location" name="location" value="{{.Org.Location}}">
|
<input id="location" name="location" value="{{.Org.Location}}">
|
||||||
</div>
|
</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}}
|
{{if .SignedUser.IsAdmin}}
|
||||||
<div class="ui divider"></div>
|
<div class="ui divider"></div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user