mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-26 12:27:06 +00:00 
			
		
		
		
	new org options UI
This commit is contained in:
		| @@ -654,9 +654,8 @@ settings.full_name = Full Name | |||||||
| settings.website = Website | settings.website = Website | ||||||
| settings.location = Location | settings.location = Location | ||||||
| settings.update_settings = Update Settings | settings.update_settings = Update Settings | ||||||
| settings.change_orgname = Organization Name Changed | settings.update_setting_success = Organization settings has been updated successfully. | ||||||
| settings.change_orgname_desc = Organization name has been changed. This will affect how links relate to the organization. Do you want to continue? | settings.change_orgname_prompt = This change will affect how links relate to the organization. | ||||||
| settings.update_setting_success = Organization settings were successfully updated. |  | ||||||
| settings.delete = Delete Organization | settings.delete = Delete Organization | ||||||
| settings.delete_account = Delete This Organization | settings.delete_account = Delete This Organization | ||||||
| settings.delete_prompt = The organization will be permanently removed, and this <strong>CANNOT</strong> be undone! | settings.delete_prompt = The organization will be permanently removed, and this <strong>CANNOT</strong> be undone! | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							| @@ -17,7 +17,7 @@ import ( | |||||||
| 	"github.com/gogits/gogs/modules/setting" | 	"github.com/gogits/gogs/modules/setting" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| const APP_VER = "0.6.9.0905 Beta" | const APP_VER = "0.6.9.0906 Beta" | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
| 	runtime.GOMAXPROCS(runtime.NumCPU()) | 	runtime.GOMAXPROCS(runtime.NumCPU()) | ||||||
|   | |||||||
| @@ -25,11 +25,11 @@ func (f *CreateOrgForm) Validate(ctx *macaron.Context, errs binding.Errors) bind | |||||||
| } | } | ||||||
|  |  | ||||||
| type UpdateOrgSettingForm struct { | type UpdateOrgSettingForm struct { | ||||||
| 	OrgUserName string `form:"uname" binding:"Required;AlphaDashDot;MaxSize(30)" locale:"org.org_name_holder"` | 	Name        string `binding:"Required;AlphaDashDot;MaxSize(30)" locale:"org.org_name_holder"` | ||||||
| 	OrgFullName string `form:"fullname" binding:"MaxSize(100)"` | 	FullName    string `binding:"MaxSize(100)"` | ||||||
| 	Description string `form:"desc" binding:"MaxSize(255)"` | 	Description string `binding:"MaxSize(255)"` | ||||||
| 	Website     string `form:"website" binding:"Url;MaxSize(100)"` | 	Website     string `binding:"Url;MaxSize(100)"` | ||||||
| 	Location    string `form:"location" binding:"MaxSize(50)"` | 	Location    string `binding:"MaxSize(50)"` | ||||||
| } | } | ||||||
|  |  | ||||||
| func (f *UpdateOrgSettingForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { | func (f *UpdateOrgSettingForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { | ||||||
|   | |||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										2
									
								
								public/css/gogs.min.css
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								public/css/gogs.min.css
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -389,6 +389,26 @@ function initRepository() { | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | function initOrganization(){ | ||||||
|  |     if ($('.organization').length == 0) { | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     // Options | ||||||
|  |     if ($('.organization.settings.options').length > 0) { | ||||||
|  |         $('#org_name').keyup(function () { | ||||||
|  |             var $prompt_span = $('#org-name-change-prompt'); | ||||||
|  |             if ($(this).val().toString().toLowerCase() != $(this).data('org-name').toString().toLowerCase()) { | ||||||
|  |                 $prompt_span.show(); | ||||||
|  |             } else { | ||||||
|  |                 $prompt_span.hide(); | ||||||
|  |             } | ||||||
|  |         }); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | } | ||||||
|  |  | ||||||
| function initWebhook() { | function initWebhook() { | ||||||
|     if ($('.new.webhook').length == 0) { |     if ($('.new.webhook').length == 0) { | ||||||
|         return; |         return; | ||||||
| @@ -524,5 +544,6 @@ $(document).ready(function () { | |||||||
|     initCommentForm(); |     initCommentForm(); | ||||||
|     initInstall(); |     initInstall(); | ||||||
|     initRepository(); |     initRepository(); | ||||||
|  |     initOrganization(); | ||||||
|     initWebhook(); |     initWebhook(); | ||||||
| }); | }); | ||||||
| @@ -18,4 +18,11 @@ | |||||||
| 	&.new.org { | 	&.new.org { | ||||||
| 		#create-page-form; | 		#create-page-form; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	&.options { | ||||||
|  | 		input { | ||||||
|  | 			width: 50%!important; | ||||||
|  | 			min-width: 300px; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
| } | } | ||||||
| @@ -38,29 +38,29 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateOrgSettingForm) { | |||||||
| 	org := ctx.Org.Organization | 	org := ctx.Org.Organization | ||||||
|  |  | ||||||
| 	// Check if organization name has been changed. | 	// Check if organization name has been changed. | ||||||
| 	if org.Name != form.OrgUserName { | 	if org.Name != form.Name { | ||||||
| 		isExist, err := models.IsUserExist(org.Id, form.OrgUserName) | 		isExist, err := models.IsUserExist(org.Id, form.Name) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			ctx.Handle(500, "IsUserExist", err) | 			ctx.Handle(500, "IsUserExist", err) | ||||||
| 			return | 			return | ||||||
| 		} else if isExist { | 		} else if isExist { | ||||||
| 			ctx.Data["Err_UserName"] = true | 			ctx.Data["OrgName"] = true | ||||||
| 			ctx.RenderWithErr(ctx.Tr("form.username_been_taken"), SETTINGS_OPTIONS, &form) | 			ctx.RenderWithErr(ctx.Tr("form.username_been_taken"), SETTINGS_OPTIONS, &form) | ||||||
| 			return | 			return | ||||||
| 		} else if err = models.ChangeUserName(org, form.OrgUserName); err != nil { | 		} else if err = models.ChangeUserName(org, form.Name); err != nil { | ||||||
| 			if err == models.ErrUserNameIllegal { | 			if err == models.ErrUserNameIllegal { | ||||||
| 				ctx.Data["Err_UserName"] = true | 				ctx.Data["OrgName"] = true | ||||||
| 				ctx.RenderWithErr(ctx.Tr("form.illegal_username"), SETTINGS_OPTIONS, &form) | 				ctx.RenderWithErr(ctx.Tr("form.illegal_username"), SETTINGS_OPTIONS, &form) | ||||||
| 			} else { | 			} else { | ||||||
| 				ctx.Handle(500, "ChangeUserName", err) | 				ctx.Handle(500, "ChangeUserName", err) | ||||||
| 			} | 			} | ||||||
| 			return | 			return | ||||||
| 		} | 		} | ||||||
| 		log.Trace("Organization name changed: %s -> %s", org.Name, form.OrgUserName) | 		log.Trace("Organization name changed: %s -> %s", org.Name, form.Name) | ||||||
| 		org.Name = form.OrgUserName | 		org.Name = form.Name | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	org.FullName = form.OrgFullName | 	org.FullName = form.FullName | ||||||
| 	org.Description = form.Description | 	org.Description = form.Description | ||||||
| 	org.Website = form.Website | 	org.Website = form.Website | ||||||
| 	org.Location = form.Location | 	org.Location = form.Location | ||||||
|   | |||||||
| @@ -1 +1 @@ | |||||||
| 0.6.9.0905 Beta | 0.6.9.0906 Beta | ||||||
| @@ -1,56 +1,45 @@ | |||||||
| {{template "ng/base/head" .}} | {{template "base/head" .}} | ||||||
| {{template "ng/base/header" .}} | <div class="organization settings options"> | ||||||
| {{template "org/base/header" .}} |   {{template "org/header" .}} | ||||||
| <div id="setting-wrapper" class="main-wrapper"> |   <div class="ui container"> | ||||||
|   <div id="org-setting" class="container clear"> |     <div class="ui grid"> | ||||||
|     {{template "org/settings/nav" .}} |       {{template "org/settings/navbar" .}} | ||||||
|     <div class="grid-4-5 left"> |       <div class="twelve wide column content"> | ||||||
|       <div class="setting-content"> |         {{template "base/alert" .}} | ||||||
|         {{template "ng/base/alert" .}} |         <h4 class="ui top attached header"> | ||||||
|         <div id="setting-content"> |           {{.i18n.Tr "org.settings.options"}} | ||||||
|           <div id="user-profile-setting-content" class="panel panel-radius"> |         </h4> | ||||||
|             <div class="panel-header"> |         <div class="ui attached segment"> | ||||||
|               <strong>{{.i18n.Tr "org.settings.options"}}</strong> |           <form class="ui form" action="{{.Link}}" method="post"> | ||||||
|  |             {{.CsrfTokenHtml}} | ||||||
|  |             <div class="required field {{if .Err_OrgName}}error{{end}}"> | ||||||
|  |               <label for="org_name">{{.i18n.Tr "org.org_name_holder"}}<span class="text red hide" id="org-name-change-prompt"> {{.i18n.Tr "org.settings.change_orgname_prompt"}}</span></label> | ||||||
|  |               <input id="org_name" name="name" value="{{.Org.Name}}" data-org-name="{{.Org.Name}}" autofocus required> | ||||||
|             </div> |             </div> | ||||||
|             <form class="form form-align panel-body" id="org-setting-form" action="{{AppSubUrl}}/org/{{.Org.LowerName}}/settings" method="post"> |             <div class="field {{if .Err_FullName}}error{{end}}"> | ||||||
|               {{.CsrfTokenHtml}} |               <label for="full_name">{{.i18n.Tr "org.org_name_holder"}}</label> | ||||||
|               <input type="hidden" name="action" value="update"> |               <input id="full_name" name="full_name" value="{{.Org.FullName}}"> | ||||||
|               <div class="field"> |             </div> | ||||||
|                 <label class="req" for="orgname">{{.i18n.Tr "org.org_name_holder"}}</label> |             <div class="field {{if .Err_Description}}error{{end}}"> | ||||||
|                 <input class="ipt ipt-large ipt-radius {{if .Err_UserName}}ipt-error{{end}}" id="orgname" name="uname" value="{{.Org.Name}}" data-orgname="{{.Org.Name}}" required /> |               <label for="description">{{$.i18n.Tr "org.org_desc"}}</label> | ||||||
|               </div> |               <textarea id="description" name="description" rows="2">{{.Org.Description}}</textarea> | ||||||
|               <div class="white-popup-block mfp-hide" id="change-orgname-modal"> |             </div> | ||||||
|                 <h1 class="text-red">{{.i18n.Tr "org.settings.change_orgname"}}</h1> |             <div class="field {{if .Err_Website}}error{{end}}"> | ||||||
|                 <p>{{.i18n.Tr "org.settings.change_orgname_desc"}}</p> |               <label for="website">{{.i18n.Tr "org.settings.website"}}</label> | ||||||
|                 <br> |               <input id="website" name="website" type="url" value="{{.Org.Website}}"> | ||||||
|                 <button class="btn btn-red btn-large btn-radius" id="change-orgname-submit">{{.i18n.Tr "settings.continue"}}</button> |             </div> | ||||||
|                 <button class="btn btn-large btn-radius popup-modal-dismiss">{{.i18n.Tr "settings.cancel"}}</button> |             <div class="field"> | ||||||
|               </div> |               <label for="location">{{.i18n.Tr "org.settings.location"}}</label> | ||||||
|               <div class="field"> |               <input id="location" name="location"  value="{{.Org.Location}}"> | ||||||
|                 <label for="full-name">{{.i18n.Tr "org.settings.full_name"}}</label> |             </div> | ||||||
|                 <input class="ipt ipt-large ipt-radius {{if .Err_FullName}}ipt-error{{end}}" id="full-name" name="fullname" value="{{.Org.FullName}}" /> |  | ||||||
|               </div> |             <div class="field"> | ||||||
|               <div class="field clear"> |                <button class="ui green button">{{$.i18n.Tr "org.settings.update_settings"}}</button> | ||||||
|                 <label class="left" for="desc">{{.i18n.Tr "org.org_desc"}}</label> |             </div> | ||||||
|                 <textarea class="ipt ipt-large ipt-radius {{if .Err_Description}}ipt-error{{end}}" id="desc" name="desc">{{.Org.Description}}</textarea> |           </form> | ||||||
|               </div> |  | ||||||
|               <div class="field"> |  | ||||||
|                 <label for="website">{{.i18n.Tr "org.settings.website"}}</label> |  | ||||||
|                 <input class="ipt ipt-large ipt-radius {{if .Err_Website}}ipt-error{{end}}" id="website" name="website" type="url" value="{{.Org.Website}}" /> |  | ||||||
|               </div> |  | ||||||
|               <div class="field"> |  | ||||||
|                 <label for="location">{{.i18n.Tr "org.settings.location"}}</label> |  | ||||||
|                 <input class="ipt ipt-large ipt-radius {{if .Err_Location}}ipt-error{{end}}" id="location" name="location" type="text" value="{{.Org.Location}}" /> |  | ||||||
|               </div> |  | ||||||
|               <div class="field"> |  | ||||||
|                 <span class="form-label"></span> |  | ||||||
|                 <button class="btn btn-green btn-large btn-radius" id="change-orgname-btn" href="#change-orgname-modal">{{.i18n.Tr "org.settings.update_settings"}}</button> |  | ||||||
|               </div> |  | ||||||
|             </form> |  | ||||||
|           </div> |  | ||||||
|         </div> |         </div> | ||||||
|       </div> |       </div> | ||||||
|     </div> |     </div> | ||||||
|   </div> |   </div> | ||||||
| </div> | </div> | ||||||
| {{template "ng/base/footer" .}} | {{template "base/footer" .}} | ||||||
		Reference in New Issue
	
	Block a user
	 Unknwon
					Unknwon