mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Added an upgrade modal to the custom theme activation failure scenario
no issue - The modal only appears when the user hits a limitation trying to activate a custom theme not part of the allowlist (if the custom theme allowlist is configured) - Changed the upgrade button to green to match the design
This commit is contained in:
parent
89b9f6cfc6
commit
53d77d82df
4 changed files with 24 additions and 3 deletions
|
@ -15,7 +15,7 @@
|
||||||
<span>Cancel</span>
|
<span>Cancel</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button {{on "click" (action "upgrade")}} class="gh-btn gh-btn-black" data-test-button="upgrade-plan">
|
<button {{on "click" (action "upgrade")}} class="gh-btn gh-btn-green" data-test-button="upgrade-plan">
|
||||||
<span>Upgrade</span>
|
<span>Upgrade</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
|
@ -44,6 +44,7 @@ export const MARKETPLACE_THEMES = [{
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
config: service(),
|
config: service(),
|
||||||
ghostPaths: service(),
|
ghostPaths: service(),
|
||||||
|
limit: service(),
|
||||||
notifications: service(),
|
notifications: service(),
|
||||||
session: service(),
|
session: service(),
|
||||||
settings: service(),
|
settings: service(),
|
||||||
|
@ -53,6 +54,7 @@ export default Controller.extend({
|
||||||
newSecondaryNavItem: null,
|
newSecondaryNavItem: null,
|
||||||
themes: null,
|
themes: null,
|
||||||
themeToDelete: null,
|
themeToDelete: null,
|
||||||
|
displayUpgradeModal: false,
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
@ -68,7 +70,12 @@ export default Controller.extend({
|
||||||
}),
|
}),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
activateTheme(theme) {
|
async activateTheme(theme) {
|
||||||
|
const isOverLimit = await this.limit.checkWouldGoOverLimit('customThemes', {value: theme.name});
|
||||||
|
if (isOverLimit) {
|
||||||
|
this.set('displayUpgradeModal', true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
return theme.activate().then((activatedTheme) => {
|
return theme.activate().then((activatedTheme) => {
|
||||||
if (!isEmpty(activatedTheme.get('warnings'))) {
|
if (!isEmpty(activatedTheme.get('warnings'))) {
|
||||||
this.set('themeWarnings', activatedTheme.get('warnings'));
|
this.set('themeWarnings', activatedTheme.get('warnings'));
|
||||||
|
@ -138,6 +145,10 @@ export default Controller.extend({
|
||||||
this.set('showThemeErrorsModal', false);
|
this.set('showThemeErrorsModal', false);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
hideUpgradeModal() {
|
||||||
|
this.set('displayUpgradeModal', false);
|
||||||
|
},
|
||||||
|
|
||||||
reset() {}
|
reset() {}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,10 @@ export default class LimitsService extends Service {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async checkWouldGoOverLimit(limitName, metadata = {}) {
|
||||||
|
return this.limiter.checkWouldGoOverLimit(limitName, metadata);
|
||||||
|
}
|
||||||
|
|
||||||
decorateWithCountQueries(limits) {
|
decorateWithCountQueries(limits) {
|
||||||
if (limits.staff) {
|
if (limits.staff) {
|
||||||
limits.staff.currentCountQuery = bind(this, this.getStaffUsersCount);
|
limits.staff.currentCountQuery = bind(this, this.getStaffUsersCount);
|
||||||
|
|
|
@ -101,3 +101,9 @@
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{{outlet}}
|
{{outlet}}
|
||||||
|
|
||||||
|
{{#if this.displayUpgradeModal}}
|
||||||
|
<GhFullscreenModal @modal="upgrade-host-limit-custom-theme"
|
||||||
|
@close={{action "hideUpgradeModal"}}
|
||||||
|
@modifier="action wide" />
|
||||||
|
{{/if}}
|
||||||
|
|
Loading…
Add table
Reference in a new issue