mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: move groups data loading from controller to route (#29130)
This commit is contained in:
parent
da77d06ebb
commit
2099c33fa7
@ -30,17 +30,6 @@ export default class GroupsIndexController extends Controller {
|
||||
return types;
|
||||
}
|
||||
|
||||
loadGroups(params) {
|
||||
this.set("isLoading", true);
|
||||
|
||||
this.store
|
||||
.findAll("group", params)
|
||||
.then((groups) => {
|
||||
this.set("groups", groups);
|
||||
})
|
||||
.finally(() => this.set("isLoading", false));
|
||||
}
|
||||
|
||||
@action
|
||||
onFilterChanged(filter) {
|
||||
discourseDebounce(this, this._debouncedFilter, filter, INPUT_DELAY);
|
||||
|
@ -14,11 +14,13 @@ export default class GroupsIndexRoute extends DiscourseRoute {
|
||||
return I18n.t("groups.index.title");
|
||||
}
|
||||
|
||||
model(params) {
|
||||
return params;
|
||||
async model(params) {
|
||||
const groups = await this.store.findAll("group", params);
|
||||
return { groups };
|
||||
}
|
||||
|
||||
setupController(controller, params) {
|
||||
controller.loadGroups(params);
|
||||
setupController(controller, model) {
|
||||
super.setupController(controller, model);
|
||||
controller.set("groups", model.groups);
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ConditionalLoadingSpinner @condition={{this.isLoading}}>
|
||||
{{#if this.groups}}
|
||||
<LoadMore
|
||||
@selector=".groups-boxes .group-box"
|
||||
@ -122,12 +121,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</LoadMore>
|
||||
|
||||
<ConditionalLoadingSpinner @condition={{this.groups.loadingMore}} />
|
||||
{{else}}
|
||||
<p role="status">{{i18n "groups.index.empty"}}</p>
|
||||
{{/if}}
|
||||
</ConditionalLoadingSpinner>
|
||||
</section>
|
||||
|
||||
<PluginOutlet @name="after-groups-index-container" @connectorTagName="div" />
|
Loading…
Reference in New Issue
Block a user