mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-14 18:52:05 +03:00
c7ef8b6c24
refs #5652 - changes the spin-button so that it only sets the size when the button is submitting instead of all of the time
35 lines
897 B
JavaScript
35 lines
897 B
JavaScript
import Ember from 'ember';
|
|
|
|
export default Ember.Component.extend({
|
|
tagName: 'button',
|
|
buttonText: '',
|
|
submitting: false,
|
|
showSpinner: false,
|
|
autoWidth: true,
|
|
|
|
// Disable Button when isLoading equals true
|
|
attributeBindings: ['disabled'],
|
|
|
|
// Must be set on the controller
|
|
disabled: Ember.computed.equal('submitting', true),
|
|
|
|
click: function () {
|
|
if (this.get('action')) {
|
|
this.sendAction('action');
|
|
return false;
|
|
}
|
|
return true;
|
|
},
|
|
|
|
setSize: Ember.observer('submitting', function () {
|
|
if (this.get('submitting') && this.get('autoWidth')) {
|
|
this.$().width(this.$().width());
|
|
this.$().height(this.$().height());
|
|
} else {
|
|
this.$().width('');
|
|
this.$().height('');
|
|
}
|
|
this.set('showSpinner', this.get('submitting'));
|
|
})
|
|
});
|