2019-10-15 06:50:30 -04:00
|
|
|
import AdminProduct from "discourse/plugins/discourse-patrons/discourse/models/admin-product";
|
|
|
|
import Group from "discourse/models/group";
|
2019-10-14 18:40:49 -04:00
|
|
|
|
|
|
|
export default Discourse.Route.extend({
|
2019-10-15 23:15:01 -04:00
|
|
|
model(params) {
|
|
|
|
const id = params['product-id'];
|
|
|
|
let product;
|
|
|
|
|
|
|
|
if(id === 'new') {
|
|
|
|
product = AdminProduct.create({ active: true, isNew: true });
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
product = AdminProduct.find(id);
|
|
|
|
}
|
|
|
|
|
2019-10-15 06:50:30 -04:00
|
|
|
const groups = Group.findAll({ ignore_automatic: true });
|
|
|
|
|
|
|
|
return Ember.RSVP.hash({ product, groups });
|
2019-10-14 18:40:49 -04:00
|
|
|
}
|
|
|
|
});
|