2020-07-07 05:44:13 -04:00
|
|
|
import { action } from "@ember/object";
|
2023-10-10 14:38:59 -04:00
|
|
|
import Route from "@ember/routing/route";
|
2023-07-18 15:52:55 -04:00
|
|
|
import { inject as service } from "@ember/service";
|
2020-07-07 05:44:13 -04:00
|
|
|
|
2023-03-15 09:17:51 -04:00
|
|
|
export default class AdminCustomizeEmailTemplatesRoute extends Route {
|
2023-07-18 15:52:55 -04:00
|
|
|
@service router;
|
|
|
|
|
2015-11-12 16:08:19 -05:00
|
|
|
model() {
|
|
|
|
return this.store.findAll("email-template");
|
2023-03-15 09:17:51 -04:00
|
|
|
}
|
2015-11-12 16:08:19 -05:00
|
|
|
|
|
|
|
setupController(controller, model) {
|
|
|
|
controller.set("emailTemplates", model);
|
2023-03-15 09:17:51 -04:00
|
|
|
}
|
2020-07-07 05:44:13 -04:00
|
|
|
|
|
|
|
@action
|
|
|
|
didTransition() {
|
|
|
|
const editController = this.controllerFor(
|
|
|
|
"adminCustomizeEmailTemplates.edit"
|
|
|
|
);
|
|
|
|
|
|
|
|
if (!editController.emailTemplate) {
|
2023-07-18 15:52:55 -04:00
|
|
|
this.router.transitionTo(
|
2020-07-07 05:44:13 -04:00
|
|
|
"adminCustomizeEmailTemplates.edit",
|
|
|
|
this.controller.get("sortedTemplates.firstObject")
|
|
|
|
);
|
|
|
|
}
|
2023-03-15 09:17:51 -04:00
|
|
|
}
|
|
|
|
}
|