Ghost/core/client/app/components/gh-spin-button.js
Austin Burdine c7ef8b6c24 fix auto width and height of spin button component
refs #5652
- changes the spin-button so that it only sets the size when the button is submitting instead of all of the time
2015-08-19 23:39:07 -04:00

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'));
})
});