Ghost/ghost/admin/app/controllers/settings/tiers.js

37 lines
955 B
JavaScript
Raw Normal View History

import Controller from '@ember/controller';
import {action} from '@ember/object';
import {htmlSafe} from '@ember/template';
import {inject as service} from '@ember/service';
import {tracked} from '@glimmer/tracking';
export default class TiersController extends Controller {
@service settings;
@service config;
@tracked iconStyle = '';
@tracked showFreeMembershipModal = false;
constructor() {
super(...arguments);
this.iconStyle = this.setIconStyle();
}
get tiers() {
return this.model.sortBy('name');
}
setIconStyle() {
let icon = this.config.icon;
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;
}
}