From 634d2daa13484f7073ba6e836814e2822ef482b1 Mon Sep 17 00:00:00 2001 From: Thibaut Patel Date: Wed, 7 Apr 2021 15:51:22 +0200 Subject: [PATCH] Added configurable limit on custom themes issue https://github.com/TryGhost/Team/issues/590 --- .../modal-upgrade-host-limit-custom-theme.hbs | 21 +++++++++++++++++++ .../modal-upgrade-host-limit-custom-theme.js | 12 +++++++++++ .../controllers/settings/theme/uploadtheme.js | 10 +++++++++ .../templates/settings/theme/uploadtheme.hbs | 2 +- 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 ghost/admin/app/components/modal-upgrade-host-limit-custom-theme.hbs create mode 100644 ghost/admin/app/components/modal-upgrade-host-limit-custom-theme.js create mode 100644 ghost/admin/app/controllers/settings/theme/uploadtheme.js diff --git a/ghost/admin/app/components/modal-upgrade-host-limit-custom-theme.hbs b/ghost/admin/app/components/modal-upgrade-host-limit-custom-theme.hbs new file mode 100644 index 0000000000..b0f1497819 --- /dev/null +++ b/ghost/admin/app/components/modal-upgrade-host-limit-custom-theme.hbs @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/ghost/admin/app/components/modal-upgrade-host-limit-custom-theme.js b/ghost/admin/app/components/modal-upgrade-host-limit-custom-theme.js new file mode 100644 index 0000000000..5d4c025835 --- /dev/null +++ b/ghost/admin/app/components/modal-upgrade-host-limit-custom-theme.js @@ -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; + } + } +}); diff --git a/ghost/admin/app/controllers/settings/theme/uploadtheme.js b/ghost/admin/app/controllers/settings/theme/uploadtheme.js new file mode 100644 index 0000000000..478cfc399a --- /dev/null +++ b/ghost/admin/app/controllers/settings/theme/uploadtheme.js @@ -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; + } +} diff --git a/ghost/admin/app/templates/settings/theme/uploadtheme.hbs b/ghost/admin/app/templates/settings/theme/uploadtheme.hbs index b1db5c0b28..0631820a30 100644 --- a/ghost/admin/app/templates/settings/theme/uploadtheme.hbs +++ b/ghost/admin/app/templates/settings/theme/uploadtheme.hbs @@ -1,4 +1,4 @@ -