mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-11-04 08:21:11 +00:00 
			
		
		
		
	Restore form inputs on organization create error (#34201)
Keeps the entered inputs when the "organization create" request returns an error. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> (cherry picked from commit 18a673bad1d036502baca4491a16679692c42320)
This commit is contained in:
		
					parent
					
						
							
								603d655ec4
							
						
					
				
			
			
				commit
				
					
						64555d6efb
					
				
			
		
					 2 changed files with 8 additions and 5 deletions
				
			
		| 
						 | 
					@ -27,11 +27,14 @@ const (
 | 
				
			||||||
// Create render the page for create organization
 | 
					// Create render the page for create organization
 | 
				
			||||||
func Create(ctx *context.Context) {
 | 
					func Create(ctx *context.Context) {
 | 
				
			||||||
	ctx.Data["Title"] = ctx.Tr("new_org.title")
 | 
						ctx.Data["Title"] = ctx.Tr("new_org.title")
 | 
				
			||||||
	ctx.Data["DefaultOrgVisibilityMode"] = setting.Service.DefaultOrgVisibilityMode
 | 
					 | 
				
			||||||
	if !ctx.Doer.CanCreateOrganization() {
 | 
						if !ctx.Doer.CanCreateOrganization() {
 | 
				
			||||||
		ctx.ServerError("Not allowed", errors.New(ctx.Locale.TrString("org.form.create_org_not_allowed")))
 | 
							ctx.ServerError("Not allowed", errors.New(ctx.Locale.TrString("org.form.create_org_not_allowed")))
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ctx.Data["visibility"] = setting.Service.DefaultOrgVisibilityMode
 | 
				
			||||||
 | 
						ctx.Data["repo_admin_change_team_access"] = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ctx.HTML(http.StatusOK, tplCreateOrg)
 | 
						ctx.HTML(http.StatusOK, tplCreateOrg)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,15 +19,15 @@
 | 
				
			||||||
						<span class="inline required field"><label for="visibility">{{ctx.Locale.Tr "org.settings.visibility"}}</label></span>
 | 
											<span class="inline required field"><label for="visibility">{{ctx.Locale.Tr "org.settings.visibility"}}</label></span>
 | 
				
			||||||
						<div class="inline-grouped-list">
 | 
											<div class="inline-grouped-list">
 | 
				
			||||||
							<div class="ui radio checkbox">
 | 
												<div class="ui radio checkbox">
 | 
				
			||||||
								<input class="enable-system-radio" name="visibility" type="radio" value="0" {{if .DefaultOrgVisibilityMode.IsPublic}}checked{{end}}>
 | 
													<input class="enable-system-radio" name="visibility" type="radio" value="0" {{if .visibility.IsPublic}}checked{{end}}>
 | 
				
			||||||
								<label>{{ctx.Locale.Tr "org.settings.visibility.public"}}</label>
 | 
													<label>{{ctx.Locale.Tr "org.settings.visibility.public"}}</label>
 | 
				
			||||||
							</div>
 | 
												</div>
 | 
				
			||||||
							<div class="ui radio checkbox">
 | 
												<div class="ui radio checkbox">
 | 
				
			||||||
								<input class="enable-system-radio" name="visibility" type="radio" value="1" {{if .DefaultOrgVisibilityMode.IsLimited}}checked{{end}}>
 | 
													<input class="enable-system-radio" name="visibility" type="radio" value="1" {{if .visibility.IsLimited}}checked{{end}}>
 | 
				
			||||||
								<label>{{ctx.Locale.Tr "org.settings.visibility.limited"}}</label>
 | 
													<label>{{ctx.Locale.Tr "org.settings.visibility.limited"}}</label>
 | 
				
			||||||
							</div>
 | 
												</div>
 | 
				
			||||||
							<div class="ui radio checkbox">
 | 
												<div class="ui radio checkbox">
 | 
				
			||||||
								<input class="enable-system-radio" name="visibility" type="radio" value="2" {{if .DefaultOrgVisibilityMode.IsPrivate}}checked{{end}}>
 | 
													<input class="enable-system-radio" name="visibility" type="radio" value="2" {{if .visibility.IsPrivate}}checked{{end}}>
 | 
				
			||||||
								<label>{{ctx.Locale.Tr "org.settings.visibility.private"}}</label>
 | 
													<label>{{ctx.Locale.Tr "org.settings.visibility.private"}}</label>
 | 
				
			||||||
							</div>
 | 
												</div>
 | 
				
			||||||
						</div>
 | 
											</div>
 | 
				
			||||||
| 
						 | 
					@ -37,7 +37,7 @@
 | 
				
			||||||
						<span class="inline field"><label>{{ctx.Locale.Tr "org.settings.permission"}}</label></span>
 | 
											<span class="inline field"><label>{{ctx.Locale.Tr "org.settings.permission"}}</label></span>
 | 
				
			||||||
						<div class="inline-grouped-list">
 | 
											<div class="inline-grouped-list">
 | 
				
			||||||
							<div class="ui checkbox">
 | 
												<div class="ui checkbox">
 | 
				
			||||||
								<input type="checkbox" name="repo_admin_change_team_access" checked>
 | 
													<input type="checkbox" name="repo_admin_change_team_access" {{if .repo_admin_change_team_access}}checked{{end}}>
 | 
				
			||||||
								<label>{{ctx.Locale.Tr "org.settings.repoadminchangeteam"}}</label>
 | 
													<label>{{ctx.Locale.Tr "org.settings.repoadminchangeteam"}}</label>
 | 
				
			||||||
							</div>
 | 
												</div>
 | 
				
			||||||
						</div>
 | 
											</div>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue