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;
|
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
|
@action
|
||||||
onFilterChanged(filter) {
|
onFilterChanged(filter) {
|
||||||
discourseDebounce(this, this._debouncedFilter, filter, INPUT_DELAY);
|
discourseDebounce(this, this._debouncedFilter, filter, INPUT_DELAY);
|
||||||
|
@ -14,11 +14,13 @@ export default class GroupsIndexRoute extends DiscourseRoute {
|
|||||||
return I18n.t("groups.index.title");
|
return I18n.t("groups.index.title");
|
||||||
}
|
}
|
||||||
|
|
||||||
model(params) {
|
async model(params) {
|
||||||
return params;
|
const groups = await this.store.findAll("group", params);
|
||||||
|
return { groups };
|
||||||
}
|
}
|
||||||
|
|
||||||
setupController(controller, params) {
|
setupController(controller, model) {
|
||||||
controller.loadGroups(params);
|
super.setupController(controller, model);
|
||||||
|
controller.set("groups", model.groups);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ConditionalLoadingSpinner @condition={{this.isLoading}}>
|
|
||||||
{{#if this.groups}}
|
{{#if this.groups}}
|
||||||
<LoadMore
|
<LoadMore
|
||||||
@selector=".groups-boxes .group-box"
|
@selector=".groups-boxes .group-box"
|
||||||
@ -122,12 +121,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</LoadMore>
|
</LoadMore>
|
||||||
|
|
||||||
<ConditionalLoadingSpinner @condition={{this.groups.loadingMore}} />
|
<ConditionalLoadingSpinner @condition={{this.groups.loadingMore}} />
|
||||||
{{else}}
|
{{else}}
|
||||||
<p role="status">{{i18n "groups.index.empty"}}</p>
|
<p role="status">{{i18n "groups.index.empty"}}</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</ConditionalLoadingSpinner>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<PluginOutlet @name="after-groups-index-container" @connectorTagName="div" />
|
<PluginOutlet @name="after-groups-index-container" @connectorTagName="div" />
|
Loading…
Reference in New Issue
Block a user