mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 20:22:45 +08:00
FIX: Double clicking the home logo could leave you in a perpetual
"Loading" state.
This commit is contained in:
parent
6b0cae8910
commit
0b42228663
|
@ -7,7 +7,7 @@
|
|||
@module Discourse
|
||||
**/
|
||||
Discourse.DiscoveryCategoriesController = Discourse.DiscoveryController.extend({
|
||||
needs: ['modal'],
|
||||
needs: ['modal', 'discovery'],
|
||||
|
||||
actions: {
|
||||
toggleOrdering: function(){
|
||||
|
@ -16,6 +16,10 @@ Discourse.DiscoveryCategoriesController = Discourse.DiscoveryController.extend({
|
|||
|
||||
refresh: function() {
|
||||
var self = this;
|
||||
|
||||
// Don't refresh if we're still loading
|
||||
if (this.get('controllers.discovery.loading')) { return; }
|
||||
|
||||
this.send('loading');
|
||||
Discourse.CategoryList.list('categories').then(function(list) {
|
||||
self.set('model', list);
|
||||
|
|
|
@ -7,10 +7,15 @@
|
|||
@module Discourse
|
||||
**/
|
||||
Discourse.DiscoveryTopController = Discourse.DiscoveryController.extend({
|
||||
needs: ['discovery'],
|
||||
|
||||
actions: {
|
||||
refresh: function() {
|
||||
var self = this;
|
||||
|
||||
// Don't refresh if we're still loading
|
||||
if (this.get('controllers.discovery.loading')) { return; }
|
||||
|
||||
this.send('loading');
|
||||
Discourse.TopList.find().then(function(top_lists) {
|
||||
self.set('model', top_lists);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
@module Discourse
|
||||
**/
|
||||
Discourse.DiscoveryTopicsController = Discourse.DiscoveryController.extend({
|
||||
needs: ['discovery'],
|
||||
bulkSelectEnabled: false,
|
||||
selected: [],
|
||||
|
||||
|
@ -25,6 +26,9 @@ Discourse.DiscoveryTopicsController = Discourse.DiscoveryController.extend({
|
|||
var filter = this.get('model.filter'),
|
||||
self = this;
|
||||
|
||||
// Don't refresh if we're still loading
|
||||
if (this.get('controllers.discovery.loading')) { return; }
|
||||
|
||||
this.send('loading');
|
||||
Discourse.TopicList.find(filter).then(function(list) {
|
||||
self.setProperties({ model: list, selected: [] });
|
||||
|
|
|
@ -11,17 +11,20 @@ Discourse.DiscoveryRoute = Discourse.Route.extend(Discourse.OpenComposer, {
|
|||
actions: {
|
||||
loading: function() {
|
||||
var controller = this.controllerFor('discovery');
|
||||
|
||||
|
||||
// If we're already loading don't do anything
|
||||
if (controller.get('loading')) { return; }
|
||||
|
||||
controller.set('loading', true);
|
||||
controller.set('scheduledSpinner', Ember.run.later(controller, function() {
|
||||
this.set('loading', true);
|
||||
this.set('loadingSpinner', true);
|
||||
},500));
|
||||
},
|
||||
|
||||
loadingComplete: function() {
|
||||
var controller = this.controllerFor('discovery');
|
||||
|
||||
Ember.run.cancel(controller.get('scheduledSpinner'));
|
||||
controller.set('loading', false);
|
||||
controller.setProperties({ loading: false, loadingSpinner: false });
|
||||
},
|
||||
|
||||
didTransition: function() {
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div {{bind-attr class="loading::hidden"}}>
|
||||
<div {{bind-attr class="loadingSpinner::hidden"}}>
|
||||
<div class='spinner'>{{i18n loading}}</div>
|
||||
</div>
|
||||
|
||||
<div {{bind-attr class=":container :list-container loading:hidden"}}>
|
||||
<div {{bind-attr class=":container :list-container loadingSpinner:hidden"}}>
|
||||
<div class="row">
|
||||
<div class="full-width">
|
||||
<div id='list-area'>
|
||||
|
|
Loading…
Reference in New Issue
Block a user