Ghost/ghost/admin/app/controllers/offers.js
Rishabh 267889993f Updated shareable offer link UI on list screen
refs https://github.com/TryGhost/Team/issues/1084

- updates shareable offer link UI to to open directly instead of route
- calculates offer url from code and updates in link modal
- wires copy button on link modal
- removes route based link code for modal
2021-10-08 09:28:17 +05:30

33 lines
834 B
JavaScript

import Controller from '@ember/controller';
import {action} from '@ember/object';
import {inject as service} from '@ember/service';
import {task} from 'ember-concurrency-decorators';
import {tracked} from '@glimmer/tracking';
export default class MembersController extends Controller {
@tracked offers = [];
@service modals;
constructor() {
super(...arguments);
}
get offersExist() {
return this.offers.length > 0;
}
@action
openLinkDialog(offer) {
this.advancedModal = this.modals.open('modals/offers/link', {
offer: offer
}, {
className: 'fullscreen-modal-action fullscreen-modal-wide'
});
}
@task({restartable: true})
*fetchOffersTask() {
this.offers = yield this.store.query('offer', {limit: 'all'});
}
}