mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 03:02:46 +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
|
@module Discourse
|
||||||
**/
|
**/
|
||||||
Discourse.DiscoveryCategoriesController = Discourse.DiscoveryController.extend({
|
Discourse.DiscoveryCategoriesController = Discourse.DiscoveryController.extend({
|
||||||
needs: ['modal'],
|
needs: ['modal', 'discovery'],
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
toggleOrdering: function(){
|
toggleOrdering: function(){
|
||||||
|
@ -16,6 +16,10 @@ Discourse.DiscoveryCategoriesController = Discourse.DiscoveryController.extend({
|
||||||
|
|
||||||
refresh: function() {
|
refresh: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
// Don't refresh if we're still loading
|
||||||
|
if (this.get('controllers.discovery.loading')) { return; }
|
||||||
|
|
||||||
this.send('loading');
|
this.send('loading');
|
||||||
Discourse.CategoryList.list('categories').then(function(list) {
|
Discourse.CategoryList.list('categories').then(function(list) {
|
||||||
self.set('model', list);
|
self.set('model', list);
|
||||||
|
|
|
@ -7,10 +7,15 @@
|
||||||
@module Discourse
|
@module Discourse
|
||||||
**/
|
**/
|
||||||
Discourse.DiscoveryTopController = Discourse.DiscoveryController.extend({
|
Discourse.DiscoveryTopController = Discourse.DiscoveryController.extend({
|
||||||
|
needs: ['discovery'],
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
refresh: function() {
|
refresh: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
// Don't refresh if we're still loading
|
||||||
|
if (this.get('controllers.discovery.loading')) { return; }
|
||||||
|
|
||||||
this.send('loading');
|
this.send('loading');
|
||||||
Discourse.TopList.find().then(function(top_lists) {
|
Discourse.TopList.find().then(function(top_lists) {
|
||||||
self.set('model', top_lists);
|
self.set('model', top_lists);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
@module Discourse
|
@module Discourse
|
||||||
**/
|
**/
|
||||||
Discourse.DiscoveryTopicsController = Discourse.DiscoveryController.extend({
|
Discourse.DiscoveryTopicsController = Discourse.DiscoveryController.extend({
|
||||||
|
needs: ['discovery'],
|
||||||
bulkSelectEnabled: false,
|
bulkSelectEnabled: false,
|
||||||
selected: [],
|
selected: [],
|
||||||
|
|
||||||
|
@ -25,6 +26,9 @@ Discourse.DiscoveryTopicsController = Discourse.DiscoveryController.extend({
|
||||||
var filter = this.get('model.filter'),
|
var filter = this.get('model.filter'),
|
||||||
self = this;
|
self = this;
|
||||||
|
|
||||||
|
// Don't refresh if we're still loading
|
||||||
|
if (this.get('controllers.discovery.loading')) { return; }
|
||||||
|
|
||||||
this.send('loading');
|
this.send('loading');
|
||||||
Discourse.TopicList.find(filter).then(function(list) {
|
Discourse.TopicList.find(filter).then(function(list) {
|
||||||
self.setProperties({ model: list, selected: [] });
|
self.setProperties({ model: list, selected: [] });
|
||||||
|
|
|
@ -11,17 +11,20 @@ Discourse.DiscoveryRoute = Discourse.Route.extend(Discourse.OpenComposer, {
|
||||||
actions: {
|
actions: {
|
||||||
loading: function() {
|
loading: function() {
|
||||||
var controller = this.controllerFor('discovery');
|
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() {
|
controller.set('scheduledSpinner', Ember.run.later(controller, function() {
|
||||||
this.set('loading', true);
|
this.set('loadingSpinner', true);
|
||||||
},500));
|
},500));
|
||||||
},
|
},
|
||||||
|
|
||||||
loadingComplete: function() {
|
loadingComplete: function() {
|
||||||
var controller = this.controllerFor('discovery');
|
var controller = this.controllerFor('discovery');
|
||||||
|
|
||||||
Ember.run.cancel(controller.get('scheduledSpinner'));
|
Ember.run.cancel(controller.get('scheduledSpinner'));
|
||||||
controller.set('loading', false);
|
controller.setProperties({ loading: false, loadingSpinner: false });
|
||||||
},
|
},
|
||||||
|
|
||||||
didTransition: function() {
|
didTransition: function() {
|
||||||
|
|
|
@ -9,11 +9,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div {{bind-attr class="loading::hidden"}}>
|
<div {{bind-attr class="loadingSpinner::hidden"}}>
|
||||||
<div class='spinner'>{{i18n loading}}</div>
|
<div class='spinner'>{{i18n loading}}</div>
|
||||||
</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="row">
|
||||||
<div class="full-width">
|
<div class="full-width">
|
||||||
<div id='list-area'>
|
<div id='list-area'>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user