UI: long organization name in create repository owner list

release/v1.15
Unknwon 2015-11-18 17:42:20 -05:00
parent 4325b01a58
commit f04d773f4f
6 changed files with 2981 additions and 10 deletions

View File

@ -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,

View File

@ -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 one or more lines are too long

View File

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

View File

@ -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>

View File

@ -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}}