2021-04-08 15:38:42 +03:00
|
|
|
import Controller from '@ember/controller';
|
2021-05-04 18:50:05 +03:00
|
|
|
import {action} from '@ember/object';
|
2021-05-12 14:33:36 +03:00
|
|
|
import {htmlSafe} from '@ember/template';
|
2022-11-03 14:14:36 +03:00
|
|
|
import {inject} from 'ghost-admin/decorators/inject';
|
2021-05-04 18:50:05 +03:00
|
|
|
import {inject as service} from '@ember/service';
|
|
|
|
import {tracked} from '@glimmer/tracking';
|
2021-04-08 15:38:42 +03:00
|
|
|
|
2022-05-11 20:11:54 +03:00
|
|
|
export default class TiersController extends Controller {
|
2021-05-07 20:16:35 +03:00
|
|
|
@service settings;
|
2022-11-03 14:14:36 +03:00
|
|
|
|
|
|
|
@inject config;
|
2021-05-04 18:50:05 +03:00
|
|
|
|
|
|
|
@tracked iconStyle = '';
|
|
|
|
@tracked showFreeMembershipModal = false;
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
super(...arguments);
|
|
|
|
this.iconStyle = this.setIconStyle();
|
|
|
|
}
|
|
|
|
|
2022-05-11 20:11:54 +03:00
|
|
|
get tiers() {
|
2021-04-27 11:25:35 +03:00
|
|
|
return this.model.sortBy('name');
|
2021-04-22 19:47:19 +03:00
|
|
|
}
|
2021-05-04 18:50:05 +03:00
|
|
|
|
|
|
|
setIconStyle() {
|
2022-10-07 17:24:03 +03:00
|
|
|
let icon = this.config.icon;
|
2021-05-04 18:50:05 +03:00
|
|
|
if (icon) {
|
|
|
|
return htmlSafe(`background-image: url(${icon})`);
|
|
|
|
}
|
|
|
|
icon = 'https://static.ghost.org/v4.0.0/images/ghost-orb-2.png';
|
|
|
|
return htmlSafe(`background-image: url(${icon})`);
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
closeFreeMembershipModal() {
|
|
|
|
this.showFreeMembershipModal = false;
|
|
|
|
}
|
2021-04-22 19:47:19 +03:00
|
|
|
}
|