Browse Source

UI: long organization name in create repository owner list

Unknwon 9 years ago
parent
commit
f04d773f4f

+ 9 - 0
models/user.go

@@ -373,6 +373,15 @@ func (u *User) DisplayName() string {
 	return u.Name
 }
 
+// ShortName returns shorted user name with given maximum length,
+// it adds "..." at the end if user name has more length than maximum.
+func (u *User) ShortName(length int) string {
+	if len(u.Name) < length {
+		return u.Name
+	}
+	return u.Name[:length] + "..."
+}
+
 // IsUserExist checks if given user name exist,
 // the user name should be noncased unique.
 // If uid is presented, then check will rule out that one,

+ 2 - 2
modules/auth/org.go

@@ -17,7 +17,7 @@ import (
 //         \/     /_____/     \/     \/         \/     \/                    \/
 
 type CreateOrgForm struct {
-	OrgName string `binding:"Required;AlphaDashDot;MaxSize(30)" locale:"org.org_name_holder"`
+	OrgName string `binding:"Required;AlphaDashDot;MaxSize(35)" locale:"org.org_name_holder"`
 }
 
 func (f *CreateOrgForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
@@ -25,7 +25,7 @@ func (f *CreateOrgForm) Validate(ctx *macaron.Context, errs binding.Errors) bind
 }
 
 type UpdateOrgSettingForm struct {
-	Name        string `binding:"Required;AlphaDashDot;MaxSize(30)" locale:"org.org_name_holder"`
+	Name        string `binding:"Required;AlphaDashDot;MaxSize(35)" locale:"org.org_name_holder"`
 	FullName    string `binding:"MaxSize(100)"`
 	Description string `binding:"MaxSize(255)"`
 	Website     string `binding:"Url;MaxSize(100)"`

File diff suppressed because it is too large
+ 0 - 0
public/css/gogs.css


+ 4 - 0
public/less/_repository.less

@@ -32,6 +32,10 @@
 		}
 	}
 
+	.owner.dropdown {
+		min-width: 40% !important;
+	}
+
 	.metas {
 		.menu {
 			max-height: 300px;

+ 3 - 3
templates/repo/create.tmpl

@@ -15,18 +15,18 @@
               <input type="hidden" id="uid" name="uid" value="{{.ContextUser.Id}}" required>
               <span class="text">
                 <img class="ui mini image" src="{{.ContextUser.AvatarLink}}">
-                {{.ContextUser.Name}}
+                {{.ContextUser.ShortName 20}}
               </span>
               <i class="dropdown icon"></i>
               <div class="menu">
                 <div class="item" data-value="{{.SignedUser.Id}}">
                   <img class="ui mini image" src="{{.SignedUser.AvatarLink}}">
-                  {{.SignedUser.Name}}
+                  {{.SignedUser.ShortName 20}}
                 </div>
                 {{range .Orgs}}
                 <div class="item" data-value="{{.Id}}">
                   <img class="ui mini image" src="{{.AvatarLink}}">
-                  {{.Name}}
+                  {{.ShortName 20}}
                 </div>
                 {{end}}
               </div>

+ 4 - 4
templates/repo/pulls/fork.tmpl

@@ -11,23 +11,23 @@
 					{{template "base/alert" .}}
 			  	<div class="inline required field {{if .Err_Owner}}error{{end}}">
 	  	      <label>{{.i18n.Tr "repo.owner"}}</label>
-			      <div class="ui selection dropdown">
+			      <div class="ui selection owner dropdown">
 			        <input type="hidden" id="uid" name="uid" value="{{.ContextUser.Id}}" required>
 			        <span class="text">
 			        	<img class="ui mini image" src="{{.ContextUser.AvatarLink}}">
-            		{{.ContextUser.Name}}
+            		{{.ContextUser.ShortName 20}}
             	</span>
 			        <i class="dropdown icon"></i>
 			        <div class="menu">
 			        	<div class="item" data-value="{{.SignedUser.Id}}">
 				        	<img class="ui mini image" src="{{.SignedUser.AvatarLink}}">
-	            		{{.SignedUser.Name}}
+	            		{{.SignedUser.ShortName 20}}
 			        	</div>
 			        	{{range .Orgs}}
 			        	{{if .IsOwnedBy $.SignedUser.Id}}
 			        	<div class="item" data-value="{{.Id}}">
 				        	<img class="ui mini image" src="{{.AvatarLink}}">
-	            		{{.Name}}
+	            		{{.ShortName 20}}
 			        	</div>
 			        	{{end}}
 			        	{{end}}

Some files were not shown because too many files changed in this diff