Merge pull request #934 from datitisev/249-avatar-editor-big-upload-button

#249 AvatarEditor should show an upload icon instead of a user's default avatar
This commit is contained in:
Franz Liedke 2016-04-17 22:13:26 +09:00
commit 5f60297eb1
3 changed files with 9 additions and 6 deletions

View File

@ -18995,10 +18995,10 @@ System.register('flarum/components/AvatarEditor', ['flarum/Component', 'flarum/h
avatar(user),
m(
'a',
{ className: 'Dropdown-toggle',
{ className: user.avatarUrl() ? "Dropdown-toggle" : "Dropdown-toggle AvatarEditor--noAvatar",
'data-toggle': 'dropdown',
onclick: this.quickUpload.bind(this) },
this.loading ? LoadingIndicator.component() : icon('pencil')
this.loading ? LoadingIndicator.component() : user.avatarUrl() ? icon('pencil') : icon('upload')
),
m(
'ul',

View File

@ -37,10 +37,10 @@ export default class AvatarEditor extends Component {
return (
<div className={'AvatarEditor Dropdown ' + this.props.className + (this.loading ? ' loading' : '')}>
{avatar(user)}
<a className="Dropdown-toggle"
data-toggle="dropdown"
onclick={this.quickUpload.bind(this)}>
{this.loading ? LoadingIndicator.component() : icon('pencil')}
<a className={ user.avatarUrl() ? "Dropdown-toggle" : "Dropdown-toggle AvatarEditor--noAvatar" }
data-toggle="dropdown"
onclick={this.quickUpload.bind(this)}>
{this.loading ? LoadingIndicator.component() : (user.avatarUrl() ? icon('pencil') : icon('upload'))}
</a>
<ul className="Dropdown-menu Menu">
{listItems(this.controlItems().toArray())}

View File

@ -14,6 +14,9 @@
text-decoration: none;
border: 0;
}
.AvatarEditor--noAvatar {
opacity: 0.7;
}
&:hover .Dropdown-toggle, &.open .Dropdown-toggle, &.loading .Dropdown-toggle {
opacity: 1;
}