mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-18 03:25:31 -05:00
FIX: automatically use uploaded avatar when uploading an avatar
This commit is contained in:
parent
42fb4989bd
commit
6096c88454
3 changed files with 12 additions and 5 deletions
|
@ -19,6 +19,7 @@ export default Em.Component.extend(UploadMixin, {
|
||||||
|
|
||||||
// display a warning whenever the image is not a square
|
// display a warning whenever the image is not a square
|
||||||
this.set("imageIsNotASquare", data.result.width !== data.result.height);
|
this.set("imageIsNotASquare", data.result.width !== data.result.height);
|
||||||
|
|
||||||
// in order to be as much responsive as possible, we're cheating a bit here
|
// in order to be as much responsive as possible, we're cheating a bit here
|
||||||
// indeed, the server gives us back the url to the file we've just uploaded
|
// indeed, the server gives us back the url to the file we've just uploaded
|
||||||
// often, this file is not a square, so we need to crop it properly
|
// often, this file is not a square, so we need to crop it properly
|
||||||
|
@ -26,5 +27,8 @@ export default Em.Component.extend(UploadMixin, {
|
||||||
Discourse.Utilities.cropAvatar(data.result.url, data.files[0].type).then(function(avatarTemplate) {
|
Discourse.Utilities.cropAvatar(data.result.url, data.files[0].type).then(function(avatarTemplate) {
|
||||||
self.set("uploadedAvatarTemplate", avatarTemplate);
|
self.set("uploadedAvatarTemplate", avatarTemplate);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// the upload is now done
|
||||||
|
this.sendAction("done");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -24,7 +24,8 @@
|
||||||
</label>
|
</label>
|
||||||
{{avatar-uploader username=username
|
{{avatar-uploader username=username
|
||||||
uploadedAvatarTemplate=view.uploadedAvatarTemplate
|
uploadedAvatarTemplate=view.uploadedAvatarTemplate
|
||||||
custom_avatar_upload_id=controller.custom_avatar_upload_id}}
|
custom_avatar_upload_id=controller.custom_avatar_upload_id
|
||||||
|
done="useUploadedAvatar"}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -89,10 +89,12 @@
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
{{bound-avatar model "large"}}
|
{{bound-avatar model "large"}}
|
||||||
{{#if allowAvatarUpload}}
|
{{#if allowAvatarUpload}}
|
||||||
<button {{action "showAvatarSelector"}} class="btn pad-left no-text"><i class="fa fa-pencil"></i></button>
|
<button {{action "showAvatarSelector"}} class="btn pad-left no-text">{{fa-icon "pencil"}}</button>
|
||||||
{{else}} {{#unless ssoOverridesAvatar}}
|
{{else}}
|
||||||
<a href="//gravatar.com/emails" target="_blank" title="{{i18n 'user.change_avatar.gravatar_title'}}" class="btn no-text"><i class="fa fa-pencil"></i></a>
|
{{#unless ssoOverridesAvatar}}
|
||||||
{{/unless}} {{/if}}
|
<a href="//gravatar.com/emails" target="_blank" title="{{i18n 'user.change_avatar.gravatar_title'}}" class="btn no-text">{{fa-icon "pencil"}}</a>
|
||||||
|
{{/unless}}
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue