forked from gitea/gitea
1
0
Fork 0

UI: long organization name in create repository owner list

This commit is contained in:
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 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, // IsUserExist checks if given user name exist,
// the user name should be noncased unique. // the user name should be noncased unique.
// If uid is presented, then check will rule out that one, // If uid is presented, then check will rule out that one,

View File

@ -17,7 +17,7 @@ import (
// \/ /_____/ \/ \/ \/ \/ \/ // \/ /_____/ \/ \/ \/ \/ \/
type CreateOrgForm struct { 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 { 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 { 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)"` FullName string `binding:"MaxSize(100)"`
Description string `binding:"MaxSize(255)"` Description string `binding:"MaxSize(255)"`
Website string `binding:"Url;MaxSize(100)"` 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 { .metas {
.menu { .menu {
max-height: 300px; max-height: 300px;

View File

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

View File

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