Skip to content

Commit 68972a9

Browse files
authored
Clean up legacy form CSS styles (#33081)
1 parent a739c78 commit 68972a9

21 files changed

+229
-680
lines changed

routers/web/repo/repo.go

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -147,27 +147,33 @@ func getRepoPrivate(ctx *context.Context) bool {
147147
}
148148
}
149149

150-
// Create render creating repository page
151-
func Create(ctx *context.Context) {
150+
func createCommon(ctx *context.Context) {
152151
ctx.Data["Title"] = ctx.Tr("new_repo")
153-
154-
// Give default value for template to render.
155152
ctx.Data["Gitignores"] = repo_module.Gitignores
156153
ctx.Data["LabelTemplateFiles"] = repo_module.LabelTemplateFiles
157154
ctx.Data["Licenses"] = repo_module.Licenses
158155
ctx.Data["Readmes"] = repo_module.Readmes
159-
ctx.Data["readme"] = "Default"
160-
ctx.Data["private"] = getRepoPrivate(ctx)
161156
ctx.Data["IsForcedPrivate"] = setting.Repository.ForcePrivate
162-
ctx.Data["default_branch"] = setting.Repository.DefaultBranch
157+
ctx.Data["CanCreateRepo"] = ctx.Doer.CanCreateRepo()
158+
ctx.Data["MaxCreationLimit"] = ctx.Doer.MaxCreationLimit()
159+
ctx.Data["SupportedObjectFormats"] = git.DefaultFeatures().SupportedObjectFormats
160+
ctx.Data["DefaultObjectFormat"] = git.Sha1ObjectFormat
161+
}
163162

163+
// Create render creating repository page
164+
func Create(ctx *context.Context) {
165+
createCommon(ctx)
164166
ctxUser := checkContextUser(ctx, ctx.FormInt64("org"))
165167
if ctx.Written() {
166168
return
167169
}
168170
ctx.Data["ContextUser"] = ctxUser
169171

172+
ctx.Data["readme"] = "Default"
173+
ctx.Data["private"] = getRepoPrivate(ctx)
174+
ctx.Data["default_branch"] = setting.Repository.DefaultBranch
170175
ctx.Data["repo_template_name"] = ctx.Tr("repo.template_select")
176+
171177
templateID := ctx.FormInt64("template_id")
172178
if templateID > 0 {
173179
templateRepo, err := repo_model.GetRepositoryByID(ctx, templateID)
@@ -177,11 +183,6 @@ func Create(ctx *context.Context) {
177183
}
178184
}
179185

180-
ctx.Data["CanCreateRepo"] = ctx.Doer.CanCreateRepo()
181-
ctx.Data["MaxCreationLimit"] = ctx.Doer.MaxCreationLimit()
182-
ctx.Data["SupportedObjectFormats"] = git.DefaultFeatures().SupportedObjectFormats
183-
ctx.Data["DefaultObjectFormat"] = git.Sha1ObjectFormat
184-
185186
ctx.HTML(http.StatusOK, tplCreate)
186187
}
187188

@@ -219,23 +220,23 @@ func handleCreateError(ctx *context.Context, owner *user_model.User, err error,
219220

220221
// CreatePost response for creating repository
221222
func CreatePost(ctx *context.Context) {
223+
createCommon(ctx)
222224
form := web.GetForm(ctx).(*forms.CreateRepoForm)
223-
ctx.Data["Title"] = ctx.Tr("new_repo")
224-
225-
ctx.Data["Gitignores"] = repo_module.Gitignores
226-
ctx.Data["LabelTemplateFiles"] = repo_module.LabelTemplateFiles
227-
ctx.Data["Licenses"] = repo_module.Licenses
228-
ctx.Data["Readmes"] = repo_module.Readmes
229-
230-
ctx.Data["CanCreateRepo"] = ctx.Doer.CanCreateRepo()
231-
ctx.Data["MaxCreationLimit"] = ctx.Doer.MaxCreationLimit()
232225

233226
ctxUser := checkContextUser(ctx, form.UID)
234227
if ctx.Written() {
235228
return
236229
}
237230
ctx.Data["ContextUser"] = ctxUser
238231

232+
if form.RepoTemplate > 0 {
233+
templateRepo, err := repo_model.GetRepositoryByID(ctx, form.RepoTemplate)
234+
if err == nil && access_model.CheckRepoUnitUser(ctx, templateRepo, ctxUser, unit.TypeCode) {
235+
ctx.Data["repo_template"] = form.RepoTemplate
236+
ctx.Data["repo_template_name"] = templateRepo.Name
237+
}
238+
}
239+
239240
if ctx.HasError() {
240241
ctx.HTML(http.StatusOK, tplCreate)
241242
return

templates/org/create.tmpl

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
<div role="main" aria-label="{{.Title}}" class="page-content organization new org">
33
<div class="ui middle very relaxed page grid">
44
<div class="column">
5-
<form class="ui form" action="{{.Link}}" method="post">
6-
{{.CsrfTokenHtml}}
7-
<h3 class="ui top attached header">
8-
{{ctx.Locale.Tr "new_org"}}
9-
</h3>
10-
<div class="ui attached segment">
11-
{{template "base/alert" .}}
5+
{{template "base/alert" .}}
6+
<h3 class="ui top attached header">
7+
{{ctx.Locale.Tr "new_org"}}
8+
</h3>
9+
<div class="ui attached segment">
10+
<form class="ui form left-right-form" action="{{.Link}}" method="post">
11+
{{.CsrfTokenHtml}}
1212
<div class="inline required field {{if .Err_OrgName}}error{{end}}">
1313
<label for="org_name">{{ctx.Locale.Tr "org.org_name_holder"}}</label>
1414
<input id="org_name" name="org_name" value="{{.org_name}}" autofocus required maxlength="40">
1515
<span class="help">{{ctx.Locale.Tr "org.org_name_helper"}}</span>
1616
</div>
1717

18-
<div class="inline field {{if .Err_OrgVisibility}}error{{end}}">
19-
<span class="inline required field"><label for="visibility">{{ctx.Locale.Tr "org.settings.visibility"}}</label></span>
20-
<div class="inline-grouped-list">
18+
<div class="inline field required {{if .Err_OrgVisibility}}error{{end}}">
19+
<label for="visibility">{{ctx.Locale.Tr "org.settings.visibility"}}</label>
20+
<div class="inline-right">
2121
<div class="ui radio checkbox">
2222
<input class="enable-system-radio" name="visibility" type="radio" value="0" {{if .DefaultOrgVisibilityMode.IsPublic}}checked{{end}}>
2323
<label>{{ctx.Locale.Tr "org.settings.visibility.public"}}</label>
@@ -35,11 +35,9 @@
3535

3636
<div class="inline field" id="permission_box">
3737
<label>{{ctx.Locale.Tr "org.settings.permission"}}</label>
38-
<div class="inline-grouped-list">
39-
<div class="ui checkbox">
40-
<input type="checkbox" name="repo_admin_change_team_access" checked>
41-
<label>{{ctx.Locale.Tr "org.settings.repoadminchangeteam"}}</label>
42-
</div>
38+
<div class="ui checkbox">
39+
<input type="checkbox" name="repo_admin_change_team_access" checked>
40+
<label>{{ctx.Locale.Tr "org.settings.repoadminchangeteam"}}</label>
4341
</div>
4442
</div>
4543

@@ -49,8 +47,8 @@
4947
{{ctx.Locale.Tr "org.create_org"}}
5048
</button>
5149
</div>
52-
</div>
53-
</form>
50+
</form>
51+
</div>
5452
</div>
5553
</div>
5654
</div>

templates/repo/create.tmpl

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
<div role="main" aria-label="{{.Title}}" class="page-content repository new-repo">
33
<div class="ui middle very relaxed page one column grid">
44
<div class="column">
5-
<form class="ui form new-repo-form" action="{{.Link}}" method="post">
6-
{{.CsrfTokenHtml}}
7-
<h3 class="ui top attached header">
8-
{{ctx.Locale.Tr "new_repo"}}
9-
</h3>
10-
<div class="ui attached segment">
11-
{{template "base/alert" .}}
12-
{{template "repo/create_helper" .}}
5+
<h3 class="ui top attached header">
6+
{{ctx.Locale.Tr "new_repo"}}
7+
</h3>
8+
<div class="ui attached segment">
9+
{{template "base/alert" .}}
10+
{{template "repo/create_helper" .}}
1311

14-
{{if not .CanCreateRepo}}
15-
<div class="ui negative message">
16-
<p>{{ctx.Locale.TrN .MaxCreationLimit "repo.form.reach_limit_of_creation_1" "repo.form.reach_limit_of_creation_n" .MaxCreationLimit}}</p>
17-
</div>
18-
{{end}}
12+
{{if not .CanCreateRepo}}
13+
<div class="ui negative message">
14+
<p>{{ctx.Locale.TrN .MaxCreationLimit "repo.form.reach_limit_of_creation_1" "repo.form.reach_limit_of_creation_n" .MaxCreationLimit}}</p>
15+
</div>
16+
{{end}}
17+
<form class="ui form left-right-form new-repo-form" action="{{.Link}}" method="post">
18+
{{.CsrfTokenHtml}}
1919
<div class="inline required field {{if .Err_Owner}}error{{end}}">
2020
<label>{{ctx.Locale.Tr "repo.owner"}}</label>
2121
<div class="ui selection owner dropdown">
@@ -69,7 +69,7 @@
6969
<div class="inline field">
7070
<label>{{ctx.Locale.Tr "repo.template"}}</label>
7171
<div id="repo_template_search" class="ui search selection dropdown">
72-
<input type="hidden" id="repo_template" name="repo_template" value="{{.repo_template}}">
72+
<input type="hidden" id="repo_template" name="repo_template" value="{{or .repo_template ""}}">
7373
<div class="default text">{{.repo_template_name}}</div>
7474
<div class="menu">
7575
</div>
@@ -178,6 +178,7 @@
178178
<span class="help">{{ctx.Locale.Tr "repo.readme_helper_desc"}}</span>
179179
</div>
180180
<div class="inline field">
181+
<label></label>
181182
<div class="ui checkbox" id="auto-init">
182183
<input name="auto_init" type="checkbox" {{if .auto_init}}checked{{end}}>
183184
<label>{{ctx.Locale.Tr "repo.auto_init"}}</label>
@@ -191,7 +192,7 @@
191192
<div class="inline field">
192193
<label>{{ctx.Locale.Tr "repo.object_format"}}</label>
193194
<div class="ui selection owner dropdown">
194-
<input type="hidden" id="object_format_name" name="object_format_name" value="{{.DefaultObjectFormat.Name}}" required>
195+
<input type="hidden" id="object_format_name" name="object_format_name" value="{{or .object_format_name .DefaultObjectFormat.Name}}" required>
195196
<div class="default text">{{.DefaultObjectFormat.Name}}</div>
196197
<div class="menu">
197198
{{range .SupportedObjectFormats}}
@@ -216,8 +217,8 @@
216217
{{ctx.Locale.Tr "repo.create_repo"}}
217218
</button>
218219
</div>
219-
</div>
220-
</form>
220+
</form>
221+
</div>
221222
</div>
222223
</div>
223224
</div>

templates/repo/migrate/codebase.tmpl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<div role="main" aria-label="{{.Title}}" class="page-content repository new migrate">
33
<div class="ui middle very relaxed page grid">
44
<div class="column">
5-
<form class="ui form" action="{{.Link}}" method="post">
6-
{{template "base/disable_form_autofill"}}
7-
{{.CsrfTokenHtml}}
8-
<h3 class="ui top attached header">
9-
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
10-
<input id="service_type" type="hidden" name="service" value="{{.service}}">
11-
</h3>
12-
<div class="ui attached segment">
13-
{{template "base/alert" .}}
5+
<h3 class="ui top attached header">
6+
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
7+
<input id="service_type" type="hidden" name="service" value="{{.service}}">
8+
</h3>
9+
<div class="ui attached segment">
10+
{{template "base/alert" .}}
11+
<form class="ui form left-right-form" action="{{.Link}}" method="post">
12+
{{template "base/disable_form_autofill"}}
13+
{{.CsrfTokenHtml}}
1414
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
1515
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
1616
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
@@ -108,8 +108,8 @@
108108
{{ctx.Locale.Tr "repo.migrate_repo"}}
109109
</button>
110110
</div>
111-
</div>
112-
</form>
111+
</form>
112+
</div>
113113
</div>
114114
</div>
115115
</div>

templates/repo/migrate/codecommit.tmpl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<div role="main" aria-label="{{.Title}}" class="page-content repository new migrate">
33
<div class="ui middle very relaxed page grid">
44
<div class="column">
5-
<form class="ui form" action="{{.Link}}" method="post">
6-
{{template "base/disable_form_autofill"}}
7-
{{.CsrfTokenHtml}}
8-
<h3 class="ui top attached header">
9-
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
10-
<input id="service_type" type="hidden" name="service" value="{{.service}}">
11-
</h3>
12-
<div class="ui attached segment">
13-
{{template "base/alert" .}}
5+
<h3 class="ui top attached header">
6+
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
7+
<input id="service_type" type="hidden" name="service" value="{{.service}}">
8+
</h3>
9+
<div class="ui attached segment">
10+
{{template "base/alert" .}}
11+
<form class="ui form left-right-form" action="{{.Link}}" method="post">
12+
{{template "base/disable_form_autofill"}}
13+
{{.CsrfTokenHtml}}
1414
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
1515
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
1616
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
@@ -109,8 +109,8 @@
109109
{{ctx.Locale.Tr "repo.migrate_repo"}}
110110
</button>
111111
</div>
112-
</div>
113-
</form>
112+
</form>
113+
</div>
114114
</div>
115115
</div>
116116
</div>

templates/repo/migrate/git.tmpl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<div role="main" aria-label="{{.Title}}" class="page-content repository new migrate">
33
<div class="ui middle very relaxed page grid">
44
<div class="column">
5-
<form class="ui form" action="{{.Link}}" method="post">
6-
{{template "base/disable_form_autofill"}}
7-
{{.CsrfTokenHtml}}
8-
<h3 class="ui top attached header">
9-
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
10-
<input id="service_type" type="hidden" name="service" value="{{.service}}">
11-
</h3>
12-
<div class="ui attached segment">
13-
{{template "base/alert" .}}
5+
<h3 class="ui top attached header">
6+
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
7+
<input id="service_type" type="hidden" name="service" value="{{.service}}">
8+
</h3>
9+
<div class="ui attached segment">
10+
{{template "base/alert" .}}
11+
<form class="ui form left-right-form" action="{{.Link}}" method="post">
12+
{{template "base/disable_form_autofill"}}
13+
{{.CsrfTokenHtml}}
1414
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
1515
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
1616
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
@@ -82,8 +82,8 @@
8282
{{ctx.Locale.Tr "repo.migrate_repo"}}
8383
</button>
8484
</div>
85-
</div>
86-
</form>
85+
</form>
86+
</div>
8787
</div>
8888
</div>
8989
</div>

templates/repo/migrate/gitbucket.tmpl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<div role="main" aria-label="{{.Title}}" class="page-content repository new migrate">
33
<div class="ui middle very relaxed page grid">
44
<div class="column">
5-
<form class="ui form" action="{{.Link}}" method="post">
6-
{{template "base/disable_form_autofill"}}
7-
{{.CsrfTokenHtml}}
8-
<h3 class="ui top attached header">
9-
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
10-
<input id="service_type" type="hidden" name="service" value="{{.service}}">
11-
</h3>
12-
<div class="ui attached segment">
13-
{{template "base/alert" .}}
5+
<h3 class="ui top attached header">
6+
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
7+
<input id="service_type" type="hidden" name="service" value="{{.service}}">
8+
</h3>
9+
<div class="ui attached segment">
10+
{{template "base/alert" .}}
11+
<form class="ui form left-right-form" action="{{.Link}}" method="post">
12+
{{template "base/disable_form_autofill"}}
13+
{{.CsrfTokenHtml}}
1414
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
1515
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
1616
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
@@ -38,7 +38,7 @@
3838
</div>
3939
</div>
4040

41-
<div id="migrate_items">
41+
<div id="migrate_items" class="inline field">
4242
<span class="help">{{ctx.Locale.Tr "repo.migrate.migrate_items_options"}}</span>
4343
<div class="inline field">
4444
<label></label>
@@ -124,8 +124,8 @@
124124
{{ctx.Locale.Tr "repo.migrate_repo"}}
125125
</button>
126126
</div>
127-
</div>
128-
</form>
127+
</form>
128+
</div>
129129
</div>
130130
</div>
131131
</div>

0 commit comments

Comments
 (0)