diff --git a/app/assets/javascripts/admin/views/admin_backups_logs_view.js b/app/assets/javascripts/admin/views/admin-backups-logs.js.es6 similarity index 91% rename from app/assets/javascripts/admin/views/admin_backups_logs_view.js rename to app/assets/javascripts/admin/views/admin-backups-logs.js.es6 index 0bf9728b4..49d24732e 100644 --- a/app/assets/javascripts/admin/views/admin_backups_logs_view.js +++ b/app/assets/javascripts/admin/views/admin-backups-logs.js.es6 @@ -1,5 +1,6 @@ -Discourse.AdminBackupsLogsView = Discourse.View.extend({ +import { renderSpinner } from 'discourse/helpers/loading-spinner'; +export default Discourse.View.extend({ classNames: ["admin-backups-logs"], _initialize: function() { this._reset(); }.on("init"), @@ -38,7 +39,7 @@ Discourse.AdminBackupsLogsView = Discourse.View.extend({ } // add a loading indicator if (this.get("controller.status.isOperationRunning")) { - buffer.push(""); + buffer.push(renderSpinner('small')); } }, diff --git a/app/assets/javascripts/discourse/components/conditional-loading-spinner.js.es6 b/app/assets/javascripts/discourse/components/conditional-loading-spinner.js.es6 index 4f9271215..ca6d0386a 100644 --- a/app/assets/javascripts/discourse/components/conditional-loading-spinner.js.es6 +++ b/app/assets/javascripts/discourse/components/conditional-loading-spinner.js.es6 @@ -1,3 +1,8 @@ export default Ember.Component.extend({ - layoutName: 'components/conditional-loading-spinner' + classNameBindings: ['containerClass'], + layoutName: 'components/conditional-loading-spinner', + + containerClass: function() { + return (this.get('size') === 'small') ? 'inline-spinner' : undefined; + }.property('size') }); diff --git a/app/assets/javascripts/discourse/helpers/loading-spinner.es6 b/app/assets/javascripts/discourse/helpers/loading-spinner.es6 index 71e4332e5..4d0cdb7af 100644 --- a/app/assets/javascripts/discourse/helpers/loading-spinner.es6 +++ b/app/assets/javascripts/discourse/helpers/loading-spinner.es6 @@ -1,5 +1,11 @@ import ConditionalLoadingSpinner from 'discourse/components/conditional-loading-spinner'; -var spinnerHTML = "
"; + +function renderSpinner(cssClass) { + var html = ""; +} +var spinnerHTML = renderSpinner(); /** If you use it as a regular helper {{loading-spinner}} you'll just get the @@ -18,12 +24,8 @@ Handlebars.registerHelper('loading-spinner', function(options) { Discourse.Utilities.normalizeHash(hash, types); return Ember.Handlebars.helpers.view.call(this, ConditionalLoadingSpinner, options); } else { - var html = spinnerHTML; - if (hash && hash.class) { - html = ""; - } - return new Handlebars.SafeString(html); + return new Handlebars.SafeString(renderSpinner((hash && hash.size) ? hash.size : undefined)); } }); -export { spinnerHTML }; +export { spinnerHTML, renderSpinner }; diff --git a/app/assets/javascripts/discourse/templates/components/conditional-loading-spinner.hbs b/app/assets/javascripts/discourse/templates/components/conditional-loading-spinner.hbs index 4d0c71315..d1d27ae58 100644 --- a/app/assets/javascripts/discourse/templates/components/conditional-loading-spinner.hbs +++ b/app/assets/javascripts/discourse/templates/components/conditional-loading-spinner.hbs @@ -1,5 +1,5 @@ {{#if condition}} - {{loading-spinner}} + {{else}} {{yield}} {{/if}} diff --git a/app/assets/javascripts/discourse/templates/composer.hbs b/app/assets/javascripts/discourse/templates/composer.hbs index ad0c7b53c..d60577374 100644 --- a/app/assets/javascripts/discourse/templates/composer.hbs +++ b/app/assets/javascripts/discourse/templates/composer.hbs @@ -1,4 +1,6 @@ -{{loading-spinner class="composer-loading"}} +