mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: refresh "/categories" on logo click (#6891)
* FIX: refresh discovery categories on logo click * Fix prettier offence
This commit is contained in:
committed by
Guo Xiang Tan
parent
9f52306861
commit
2274d6d7ac
@@ -46,5 +46,10 @@ export default DiscoveryController.extend({
|
|||||||
? "categories_only"
|
? "categories_only"
|
||||||
: style;
|
: style;
|
||||||
return Ember.String.dasherize(componentName);
|
return Ember.String.dasherize(componentName);
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
refresh() {
|
||||||
|
this.send("triggerRefresh");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -13,6 +13,6 @@ export default {
|
|||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
this.appEvents.off("url:refresh", this, this.refresh);
|
this.appEvents.off("url:refresh");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -94,24 +94,8 @@ const DiscoveryCategoriesRoute = Discourse.Route.extend(OpenComposer, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
refresh() {
|
triggerRefresh() {
|
||||||
const controller = this.controllerFor("discovery/categories");
|
this.refresh();
|
||||||
const discController = this.controllerFor("discovery");
|
|
||||||
|
|
||||||
// Don't refresh if we're still loading
|
|
||||||
if (!discController || discController.get("loading")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we `send('loading')` here, due to returning true it bubbles up to the
|
|
||||||
// router and ember throws an error due to missing `handlerInfos`.
|
|
||||||
// Lesson learned: Don't call `loading` yourself.
|
|
||||||
discController.set("loading", true);
|
|
||||||
|
|
||||||
this.model().then(model => {
|
|
||||||
this.setupController(controller, model);
|
|
||||||
controller.send("loadingComplete");
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
createCategory() {
|
createCategory() {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{{#discovery-categories refresh=refresh}}
|
{{#discovery-categories refresh=(action "refresh")}}
|
||||||
{{component categoryPageStyle
|
{{component categoryPageStyle
|
||||||
categories=model.categories
|
categories=model.categories
|
||||||
latestTopicOnly=latestTopicOnly
|
latestTopicOnly=latestTopicOnly
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{{#discovery-categories refresh=refresh}}
|
{{#discovery-categories refresh=(action "refresh")}}
|
||||||
{{component categoryPageStyle
|
{{component categoryPageStyle
|
||||||
categories=model.categories
|
categories=model.categories
|
||||||
latestTopicOnly=latestTopicOnly
|
latestTopicOnly=latestTopicOnly
|
||||||
|
|||||||
Reference in New Issue
Block a user