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"}} +
+ {{loading-spinner}} +
@@ -77,7 +79,7 @@
{{{model.toggleText}}}
- {{loading-spinner}} {{i18n upload_selector.uploading}} {{view.uploadProgress}}% {{i18n cancel}} + {{loading-spinner size="small"}} {{i18n upload_selector.uploading}} {{view.uploadProgress}}% {{i18n cancel}}
{{#if site.mobileView}} {{i18n upload}} diff --git a/app/assets/javascripts/discourse/templates/exception.hbs b/app/assets/javascripts/discourse/templates/exception.hbs index 63ff0b64b..ba19a38b8 100644 --- a/app/assets/javascripts/discourse/templates/exception.hbs +++ b/app/assets/javascripts/discourse/templates/exception.hbs @@ -16,9 +16,7 @@ {{#each buttonData in enabledButtons}} {{/each}} - {{#if loading}} - - {{/if}} + {{loading-spinner condition=loading}}
diff --git a/app/assets/javascripts/discourse/templates/modal/create-account.hbs b/app/assets/javascripts/discourse/templates/modal/create-account.hbs index 3777855e9..2faa73d77 100644 --- a/app/assets/javascripts/discourse/templates/modal/create-account.hbs +++ b/app/assets/javascripts/discourse/templates/modal/create-account.hbs @@ -88,7 +88,7 @@ {{#if showCreateForm}} diff --git a/app/assets/javascripts/discourse/templates/topic.hbs b/app/assets/javascripts/discourse/templates/topic.hbs index 535819412..56cbdb998 100644 --- a/app/assets/javascripts/discourse/templates/topic.hbs +++ b/app/assets/javascripts/discourse/templates/topic.hbs @@ -5,7 +5,6 @@ {{#if postStream.loaded}} - {{#if postStream.firstPostPresent}}
@@ -90,9 +89,7 @@
- {{#if postStream.loadingFilter}} -
- {{else}} + {{#loading-spinner condition=postStream.loadingFilter}} {{#if postStream.loadedAllPosts}} {{view 'topic-closing' topic=model}} @@ -109,7 +106,7 @@ {{/if}} {{/if}} - {{/if}} + {{/loading-spinner}}
diff --git a/app/assets/stylesheets/common/base/compose.scss b/app/assets/stylesheets/common/base/compose.scss index 434944173..cfcfd296d 100644 --- a/app/assets/stylesheets/common/base/compose.scss +++ b/app/assets/stylesheets/common/base/compose.scss @@ -135,16 +135,6 @@ div.ac-wrap { } } -#file-uploading { - .spinner { - width: 10px; - height: 10px; - margin: 0 5px 0 0; - display: inline-block; - float: left; - } -} - #reply-control { .composer-loading { position: absolute; @@ -158,6 +148,4 @@ div.ac-wrap { @include visible; } } - } - diff --git a/app/assets/stylesheets/common/base/discourse.scss b/app/assets/stylesheets/common/base/discourse.scss index f5084768b..dcc2590fb 100644 --- a/app/assets/stylesheets/common/base/discourse.scss +++ b/app/assets/stylesheets/common/base/discourse.scss @@ -195,6 +195,11 @@ body { } } +.inline-spinner { + display: inline-block; + margin: 0; +} + .spinner { margin: 30px auto 0 auto; position: relative; @@ -205,4 +210,11 @@ body { border: 4px solid dark-light-diff($primary, $secondary, 50%, -50%); border-right-color: transparent; border-radius: 50%; + + &.small { + width: 10px; + height: 10px; + margin: 0; + display: inline-block; + } } diff --git a/app/assets/stylesheets/common/base/history.scss b/app/assets/stylesheets/common/base/history.scss index a00c076cc..a583cab77 100644 --- a/app/assets/stylesheets/common/base/history.scss +++ b/app/assets/stylesheets/common/base/history.scss @@ -6,11 +6,6 @@ min-width: 96px; text-align: center; } - #revision-loading { - .fa { - margin-right: 7px; - } - } #revisions .row:first-of-type { margin-top: 10px; } diff --git a/app/assets/stylesheets/common/base/modal.scss b/app/assets/stylesheets/common/base/modal.scss index 3b1158eb2..2688a1847 100644 --- a/app/assets/stylesheets/common/base/modal.scss +++ b/app/assets/stylesheets/common/base/modal.scss @@ -74,16 +74,6 @@ margin-left: 15px; padding: 14px 15px 15px; border-top: 1px solid scale-color-diff(); - .login-spinner, .create-spinner { - display: inline-block; - margin: 0; - .spinner { - margin: 0; - width: 10px; - height: 10px; - display: inline-block; - } - } } .modal-footer:before, .modal-footer:after { diff --git a/app/assets/stylesheets/desktop/login.scss b/app/assets/stylesheets/desktop/login.scss index f690c2e60..39c86a70e 100644 --- a/app/assets/stylesheets/desktop/login.scss +++ b/app/assets/stylesheets/desktop/login.scss @@ -18,12 +18,6 @@ } } -.login-modal { - .fa-spinner { - font-size: 18px; - } -} - // Create account #new-account-link { @@ -55,10 +49,6 @@ } } - .fa-spinner { - font-size: 18px; - } - .tos-agree { margin-bottom: 12px; } diff --git a/plugins/poll/assets/javascripts/discourse/templates/poll.hbs b/plugins/poll/assets/javascripts/discourse/templates/poll.hbs index 27a856ab9..7d26c141d 100644 --- a/plugins/poll/assets/javascripts/discourse/templates/poll.hbs +++ b/plugins/poll/assets/javascripts/discourse/templates/poll.hbs @@ -38,6 +38,4 @@ {{/if}} -{{#if loading}} - -{{/if}} +{{loading-spinner condition=loading}}