Skip to content

Commit d268c40

Browse files
committed
fix UpdateOrgSettingForm
1 parent 6a2262d commit d268c40

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

routers/web/org/setting.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,16 @@ func Settings(ctx *context.Context) {
4848
ctx.Data["Title"] = ctx.Tr("org.settings")
4949
ctx.Data["PageIsOrgSettings"] = true
5050
ctx.Data["PageIsSettingsOptions"] = true
51-
ctx.Data["CurrentVisibility"] = ctx.Org.Organization.Visibility
52-
ctx.Data["RepoAdminChangeTeamAccess"] = ctx.Org.Organization.RepoAdminChangeTeamAccess
51+
ctx.Data["Form"] = forms.UpdateOrgSettingForm{
52+
Name: ctx.Org.Organization.Name,
53+
FullName: ctx.Org.Organization.FullName,
54+
Description: ctx.Org.Organization.Description,
55+
Website: ctx.Org.Organization.Website,
56+
Location: ctx.Org.Organization.Location,
57+
Visibility: ctx.Org.Organization.Visibility,
58+
MaxRepoCreation: ctx.Org.Organization.MaxRepoCreation,
59+
RepoAdminChangeTeamAccess: ctx.Org.Organization.RepoAdminChangeTeamAccess,
60+
}
5361
ctx.HTML(http.StatusOK, tplSettingsOptions)
5462
}
5563

@@ -59,7 +67,6 @@ func SettingsPost(ctx *context.Context) {
5967
ctx.Data["Title"] = ctx.Tr("org.settings")
6068
ctx.Data["PageIsOrgSettings"] = true
6169
ctx.Data["PageIsSettingsOptions"] = true
62-
ctx.Data["CurrentVisibility"] = ctx.Org.Organization.Visibility
6370

6471
if ctx.HasError() {
6572
ctx.HTML(http.StatusOK, tplSettingsOptions)

templates/org/settings/options.tmpl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,43 +17,43 @@
1717
<span class="text red gt-hidden" id="org-name-change-prompt"> {{.locale.Tr "org.settings.change_orgname_prompt"}}</span>
1818
<span class="text red gt-hidden" id="org-name-change-redirect-prompt"> {{.locale.Tr "org.settings.change_orgname_redirect_prompt"}}</span>
1919
</label>
20-
<input id="org_name" name="name" value="{{.Org.Name}}" data-org-name="{{.Org.Name}}" autofocus required>
20+
<input id="org_name" name="name" value="{{.Form.Name}}" data-org-name="{{.Form.Name}}" autofocus required>
2121
</div>
2222
<div class="field {{if .Err_FullName}}error{{end}}">
2323
<label for="full_name">{{.locale.Tr "org.org_full_name_holder"}}</label>
24-
<input id="full_name" name="full_name" value="{{.Org.FullName}}">
24+
<input id="full_name" name="full_name" value="{{.Form.FullName}}">
2525
</div>
2626
<div class="field {{if .Err_Description}}error{{end}}">
2727
<label for="description">{{$.locale.Tr "org.org_desc"}}</label>
28-
<textarea id="description" name="description" rows="2">{{.Org.Description}}</textarea>
28+
<textarea id="description" name="description" rows="2">{{.Form.Description}}</textarea>
2929
</div>
3030
<div class="field {{if .Err_Website}}error{{end}}">
3131
<label for="website">{{.locale.Tr "org.settings.website"}}</label>
32-
<input id="website" name="website" type="url" value="{{.Org.Website}}">
32+
<input id="website" name="website" type="url" value="{{.Form.Website}}">
3333
</div>
3434
<div class="field">
3535
<label for="location">{{.locale.Tr "org.settings.location"}}</label>
36-
<input id="location" name="location" value="{{.Org.Location}}">
36+
<input id="location" name="location" value="{{.Form.Location}}">
3737
</div>
3838

3939
<div class="ui divider"></div>
4040
<div class="field" id="visibility_box">
4141
<label for="visibility">{{.locale.Tr "org.settings.visibility"}}</label>
4242
<div class="field">
4343
<div class="ui radio checkbox">
44-
<input class="enable-system-radio" tabindex="0" name="visibility" type="radio" value="0" {{if eq .CurrentVisibility 0}}checked{{end}}>
44+
<input class="enable-system-radio" tabindex="0" name="visibility" type="radio" value="0" {{if eq .Form.Visibility 0}}checked{{end}}>
4545
<label>{{.locale.Tr "org.settings.visibility.public"}}</label>
4646
</div>
4747
</div>
4848
<div class="field">
4949
<div class="ui radio checkbox">
50-
<input class="enable-system-radio" tabindex="0" name="visibility" type="radio" value="1" {{if eq .CurrentVisibility 1}}checked{{end}}>
50+
<input class="enable-system-radio" tabindex="0" name="visibility" type="radio" value="1" {{if eq .Form.Visibility 1}}checked{{end}}>
5151
<label>{{.locale.Tr "org.settings.visibility.limited"}}</label>
5252
</div>
5353
</div>
5454
<div class="field">
5555
<div class="ui radio checkbox">
56-
<input class="enable-system-radio" tabindex="0" name="visibility" type="radio" value="2" {{if eq .CurrentVisibility 2}}checked{{end}}>
56+
<input class="enable-system-radio" tabindex="0" name="visibility" type="radio" value="2" {{if eq .Form.Visibility 2}}checked{{end}}>
5757
<label>{{.locale.Tr "org.settings.visibility.private"}}</label>
5858
</div>
5959
</div>
@@ -63,7 +63,7 @@
6363
<label>{{.locale.Tr "org.settings.permission"}}</label>
6464
<div class="field">
6565
<div class="ui checkbox">
66-
<input type="checkbox" name="repo_admin_change_team_access" {{if .RepoAdminChangeTeamAccess}}checked{{end}}>
66+
<input type="checkbox" name="repo_admin_change_team_access" {{if .Form.RepoAdminChangeTeamAccess}}checked{{end}}>
6767
<label>{{.locale.Tr "org.settings.repoadminchangeteam"}}</label>
6868
</div>
6969
</div>
@@ -74,7 +74,7 @@
7474

7575
<div class="inline field {{if .Err_MaxRepoCreation}}error{{end}}">
7676
<label for="max_repo_creation">{{.locale.Tr "admin.users.max_repo_creation"}}</label>
77-
<input id="max_repo_creation" name="max_repo_creation" type="number" value="{{.Org.MaxRepoCreation}}">
77+
<input id="max_repo_creation" name="max_repo_creation" type="number" value="{{.Form.MaxRepoCreation}}">
7878
<p class="help">{{.locale.Tr "admin.users.max_repo_creation_desc"}}</p>
7979
</div>
8080
{{end}}

0 commit comments

Comments
 (0)