summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-11-18 17:42:20 -0500
committerUnknwon <u@gogs.io>2015-11-18 17:42:20 -0500
commitf04d773f4f72f8f167b7ceed4d4e9a6fd4e6ad16 (patch)
tree3c642ab96010e2ace4fce4563857a7d228a4a892 /models
parent4325b01a589ec9d20b6ef588deec3d14852f0816 (diff)
downloadgitea-f04d773f4f72f8f167b7ceed4d4e9a6fd4e6ad16.tar.gz
gitea-f04d773f4f72f8f167b7ceed4d4e9a6fd4e6ad16.zip
UI: long organization name in create repository owner list
Diffstat (limited to 'models')
-rw-r--r--models/user.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/models/user.go b/models/user.go
index 3131a88d55..750f59e5c4 100644
--- a/models/user.go
+++ b/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,