mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 12:21:36 +03:00
Merge pull request #5691 from acburdine/spin-fix
Fix auto width and height of spin button
This commit is contained in:
commit
54f8c8e65f
@ -4,6 +4,7 @@ export default Ember.Component.extend({
|
|||||||
tagName: 'button',
|
tagName: 'button',
|
||||||
buttonText: '',
|
buttonText: '',
|
||||||
submitting: false,
|
submitting: false,
|
||||||
|
showSpinner: false,
|
||||||
autoWidth: true,
|
autoWidth: true,
|
||||||
|
|
||||||
// Disable Button when isLoading equals true
|
// Disable Button when isLoading equals true
|
||||||
@ -20,19 +21,14 @@ export default Ember.Component.extend({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
setSize: function () {
|
setSize: Ember.observer('submitting', function () {
|
||||||
if (!this.get('submitting') && this.get('autoWidth')) {
|
if (this.get('submitting') && this.get('autoWidth')) {
|
||||||
// this exists so that the spinner doesn't change the size of the button
|
this.$().width(this.$().width());
|
||||||
this.$().width(this.$().width()); // sets width of button
|
this.$().height(this.$().height());
|
||||||
this.$().height(this.$().height()); // sets height of button
|
} else {
|
||||||
}
|
this.$().width('');
|
||||||
},
|
this.$().height('');
|
||||||
|
|
||||||
width: Ember.observer('buttonText', 'autoWidth', function () {
|
|
||||||
this.setSize();
|
|
||||||
}),
|
|
||||||
|
|
||||||
didInsertElement: function () {
|
|
||||||
this.setSize();
|
|
||||||
}
|
}
|
||||||
|
this.set('showSpinner', this.get('submitting'));
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
{{#unless submitting}}
|
{{#if showSpinner}}
|
||||||
|
<span class="spinner"></span>
|
||||||
|
{{else}}
|
||||||
{{#if buttonText}}
|
{{#if buttonText}}
|
||||||
{{buttonText}}
|
{{buttonText}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{{yield}}}
|
{{{yield}}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{else}}
|
{{/if}}
|
||||||
<span class="spinner"></span>
|
|
||||||
{{/unless}}
|
|
Loading…
Reference in New Issue
Block a user