0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Added configurable limit on custom themes

issue https://github.com/TryGhost/Team/issues/590
This commit is contained in:
Thibaut Patel 2021-04-07 15:51:22 +02:00
parent 608ccbceb2
commit 634d2daa13
4 changed files with 44 additions and 1 deletions

View file

@ -0,0 +1,21 @@
<header class="modal-header" data-test-modal="delete-user">
<h1>Upgrade to enable custom themes</h1>
</header>
<button class="close" title="Close" {{on "click" this.closeModal}}>{{svg-jar "close"}}<span class="hidden">Close</span></button>
<div class="modal-body">
<p>
Your current plan only supports official themes. You can install them from the <a href="https://ghost.org/marketplace/">Ghost theme marketplace</a>.
</p>
</div>
<div class="modal-footer">
<button {{on "click" this.closeModal}} class="gh-btn" data-test-button="cancel-upgrade">
<span>Cancel</span>
</button>
<button {{on "click" (action "upgrade")}} class="gh-btn gh-btn-black" data-test-button="upgrade-plan">
<span>Upgrade</span>
</button>
</div>

View file

@ -0,0 +1,12 @@
import ModalComponent from 'ghost-admin/components/modal-base';
export default ModalComponent.extend({
actions: {
upgrade: function () {
const upgradeLink = this.model.upgradeLink;
window.open(upgradeLink);
this.closeModal();
return true;
}
}
});

View file

@ -0,0 +1,10 @@
import Controller from '@ember/controller';
import {inject as service} from '@ember/service';
export default class UploadThemeController extends Controller {
@service config;
get isAllowed() {
return !this.config.get('hostSettings')?.limits?.customThemes;
}
}

View file

@ -1,4 +1,4 @@
<GhFullscreenModal @modal="upload-theme"
<GhFullscreenModal @modal={{if this.isAllowed "upload-theme" "upgrade-host-limit-custom-theme"}}
@model={{hash
themes=this.themes
activate=(route-action 'activateTheme')