mirror of
https://github.com/flarum/core.git
synced 2025-07-31 13:40:20 +02:00
Refresh avatar display after uploading
This commit is contained in:
@@ -9,12 +9,15 @@ export default Ember.Component.extend({
|
||||
classNames: ['avatar-editor', 'dropdown'],
|
||||
classNameBindings: ['loading'],
|
||||
|
||||
click: function(e) {
|
||||
if (! this.get('user.avatarUrl')) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
this.send('upload');
|
||||
}
|
||||
didInsertElement: function() {
|
||||
var component = this;
|
||||
this.$('.dropdown-toggle').click(function(e) {
|
||||
if (! component.get('user.avatarUrl')) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
component.send('upload');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
actions: {
|
||||
@@ -37,9 +40,18 @@ export default Ember.Component.extend({
|
||||
processData: false,
|
||||
complete: function() {
|
||||
component.set('loading', false);
|
||||
},
|
||||
success: function(data) {
|
||||
Ember.run.next(function() {
|
||||
component.get('store').pushPayload(data);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
remove: function() {
|
||||
this.get('store').push('user', {id: this.get('user.id'), avatarUrl: null});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@@ -18,5 +18,5 @@ export default Ember.Handlebars.makeBoundHelper(function(user, options) {
|
||||
}
|
||||
|
||||
return new Ember.Handlebars.SafeString('<span '+attributes+'>'+content+'</span>');
|
||||
});
|
||||
}, 'avatarUrl', 'username', 'color');
|
||||
|
||||
|
@@ -6,5 +6,6 @@ export default {
|
||||
application.inject('component', 'composer', 'controller:composer')
|
||||
application.inject('model', 'session', 'simple-auth-session:main')
|
||||
application.inject('component', 'session', 'simple-auth-session:main')
|
||||
application.inject('component', 'store', 'store:main')
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user