mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 20:54:00 -06:00
FIX: Improve use of loading spinners on discovery routes
This commit is contained in:
parent
3829add90b
commit
1d1978086c
@ -13,7 +13,7 @@ export default DiscoveryController.extend({
|
||||
// Don't refresh if we're still loading
|
||||
if (this.get('controllers.discovery.loading')) { return; }
|
||||
|
||||
this.send('loading');
|
||||
this.send('discoveryLoading');
|
||||
Discourse.CategoryList.list('categories').then(function(list) {
|
||||
self.set('model', list);
|
||||
self.send('loadingComplete');
|
||||
|
@ -42,7 +42,7 @@ var controllerOpts = {
|
||||
// Don't refresh if we're still loading
|
||||
if (this.get('controllers.discovery.loading')) { return; }
|
||||
|
||||
this.send('loading');
|
||||
this.send('discoveryLoading');
|
||||
Discourse.TopicList.find(filter).then(function(list) {
|
||||
self.setProperties({ model: list, selected: [] });
|
||||
|
||||
|
@ -16,8 +16,6 @@ function loadingResolver(cb) {
|
||||
fullNameWithoutType = fullNameWithoutType.replace('Loading', '');
|
||||
if (LOADING_WHITELIST.indexOf(fullNameWithoutType) !== -1) {
|
||||
return cb(fullNameWithoutType);
|
||||
} else {
|
||||
Ember.warn('consider whitelisting a loading route for: ' + fullNameWithoutType);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -5,6 +5,10 @@ export default function(filter, params) {
|
||||
return Discourse.Route.extend({
|
||||
queryParams: queryParams,
|
||||
|
||||
beforeModel: function(transition) {
|
||||
transition.send('discoveryLoading');
|
||||
},
|
||||
|
||||
model: function(modelParams) {
|
||||
return Discourse.Category.findBySlug(modelParams.slug, modelParams.parentSlug);
|
||||
},
|
||||
@ -85,6 +89,7 @@ export default function(filter, params) {
|
||||
});
|
||||
|
||||
this.controllerFor('search').set('searchContext', model.get('searchContext'));
|
||||
this.controllerFor('discovery').send('loadingComplete');
|
||||
this.set('topics', null);
|
||||
|
||||
this.openTopicDraft(topics);
|
||||
|
@ -17,7 +17,8 @@ export default function(filter, extras) {
|
||||
return Discourse.Route.extend({
|
||||
queryParams: queryParams,
|
||||
|
||||
beforeModel: function() {
|
||||
beforeModel: function(transition) {
|
||||
transition.send('discoveryLoading');
|
||||
this.controllerFor('navigation/default').set('filterMode', filter);
|
||||
},
|
||||
|
||||
@ -60,6 +61,7 @@ export default function(filter, extras) {
|
||||
|
||||
this.openTopicDraft(model);
|
||||
this.controllerFor('navigation/default').set('canCreateTopic', model.get('can_create_topic'));
|
||||
this.controllerFor('discovery').send('loadingComplete');
|
||||
},
|
||||
|
||||
renderTemplate: function() {
|
||||
|
@ -19,12 +19,11 @@ Discourse.DiscoveryRoute = Discourse.Route.extend(Discourse.ScrollTop, Discourse
|
||||
},
|
||||
|
||||
actions: {
|
||||
loading: function() {
|
||||
discoveryLoading: function() {
|
||||
var controller = this.controllerFor('discovery');
|
||||
|
||||
// If we're already loading don't do anything
|
||||
if (controller.get('loading')) { return; }
|
||||
|
||||
controller.set('loading', true);
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user