mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 01:42:29 +03:00
5f538b5036
refs https://github.com/TryGhost/Team/issues/715 By default, the first product/tier is available in Portal at the moment, this adds an attribute that can be used to denote which product is active in Portal in UI
50 lines
1.1 KiB
JavaScript
50 lines
1.1 KiB
JavaScript
import Component from '@glimmer/component';
|
|
import {action} from '@ember/object';
|
|
import {inject as service} from '@ember/service';
|
|
import {tracked} from '@glimmer/tracking';
|
|
|
|
export default class extends Component {
|
|
@service membersUtils;
|
|
@service ghostPaths;
|
|
@service ajax;
|
|
@service store;
|
|
@service config;
|
|
|
|
@tracked showProductModal = false;
|
|
@tracked productModel = null;
|
|
|
|
get products() {
|
|
return this.args.products.map((product, idx) => {
|
|
if (idx === 0) {
|
|
return {
|
|
...product.toJSON(),
|
|
portal: true
|
|
};
|
|
}
|
|
return product;
|
|
});
|
|
}
|
|
|
|
@action
|
|
async openEditProduct(product) {
|
|
this.productModel = product;
|
|
this.showProductModal = true;
|
|
}
|
|
|
|
@action
|
|
async openNewProduct() {
|
|
this.productModel = this.store.createRecord('product');
|
|
this.showProductModal = true;
|
|
}
|
|
|
|
@action
|
|
closeProductModal() {
|
|
this.showProductModal = false;
|
|
}
|
|
|
|
@action
|
|
confirmProductSave() {
|
|
this.args.confirmProductSave();
|
|
}
|
|
}
|