mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 15:12:58 +03:00
25ba3b0d22
refs #5652 - ensure gh-spin-button passes type & tabindex through to markup - add gh-input class to auto focus input - add tabindexes to setup/two + make first field autofocus and button submit
35 lines
917 B
JavaScript
35 lines
917 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', 'type', 'tabindex'],
|
|
|
|
// 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'));
|
|
})
|
|
});
|