mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Improved theme activation warnings modal content
closes https://github.com/TryGhost/Ghost/issues/10627
- removed confusing/unnecessary message when activation was successful with warnings
- do not display "Warnings" sub-heading if there are no other errors to reduce duplication with the modal title
- changed "Close" button text to "Ok" so it feels more like a confirmation
- refactored modal template to have explicit `this` rather than implicit property lookup ([RFC](e724c7087e/text/0308-deprecate-property-lookup-fallback.md
))
This commit is contained in:
parent
d0a834b477
commit
162cbae3f0
3 changed files with 12 additions and 27 deletions
|
@ -17,12 +17,11 @@ export default Controller.extend({
|
||||||
session: service(),
|
session: service(),
|
||||||
settings: service(),
|
settings: service(),
|
||||||
|
|
||||||
newNavItem: null,
|
|
||||||
|
|
||||||
dirtyAttributes: false,
|
dirtyAttributes: false,
|
||||||
|
newNavItem: null,
|
||||||
themes: null,
|
themes: null,
|
||||||
themeToDelete: null,
|
themeToDelete: null,
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
this.set('newNavItem', NavigationItem.create({isNew: true}));
|
this.set('newNavItem', NavigationItem.create({isNew: true}));
|
||||||
|
@ -127,8 +126,6 @@ export default Controller.extend({
|
||||||
|
|
||||||
activateTheme(theme) {
|
activateTheme(theme) {
|
||||||
return theme.activate().then((theme) => {
|
return theme.activate().then((theme) => {
|
||||||
let themeName = theme.get('name');
|
|
||||||
|
|
||||||
if (!isEmpty(theme.get('warnings'))) {
|
if (!isEmpty(theme.get('warnings'))) {
|
||||||
this.set('themeWarnings', theme.get('warnings'));
|
this.set('themeWarnings', theme.get('warnings'));
|
||||||
this.set('showThemeWarningsModal', true);
|
this.set('showThemeWarningsModal', true);
|
||||||
|
@ -138,12 +135,6 @@ export default Controller.extend({
|
||||||
this.set('themeErrors', theme.get('errors'));
|
this.set('themeErrors', theme.get('errors'));
|
||||||
this.set('showThemeWarningsModal', true);
|
this.set('showThemeWarningsModal', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.themeErrors || this.themeWarnings) {
|
|
||||||
let message = `${themeName} activated successfully but some warnings/errors were detected.
|
|
||||||
You are still able to use and activate the theme. Here is your report...`;
|
|
||||||
this.set('message', message);
|
|
||||||
}
|
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
if (isThemeValidationError(error)) {
|
if (isThemeValidationError(error)) {
|
||||||
let errors = error.payload.errors[0].details;
|
let errors = error.payload.errors[0].details;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<header class="modal-header">
|
<header class="modal-header">
|
||||||
<h1 data-test-theme-warnings-title>
|
<h1 data-test-theme-warnings-title>
|
||||||
{{#unless canActivate}}
|
{{#unless this.canActivate}}
|
||||||
{{title}}
|
{{this.title}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{title}} with {{#if errors}}errors{{else}}warnings{{/if}}
|
{{this.title}} with {{#if this.errors}}errors{{else}}warnings{{/if}}
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
</h1>
|
</h1>
|
||||||
</header>
|
</header>
|
||||||
|
@ -11,41 +11,36 @@
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<ul class="theme-validation-errors" data-test-theme-warnings>
|
<ul class="theme-validation-errors" data-test-theme-warnings>
|
||||||
{{#if message}}
|
{{#if this.fatalErrors}}
|
||||||
<li>
|
|
||||||
<p data-test-theme-warnings-message>{{message}}</p>
|
|
||||||
</li>
|
|
||||||
{{/if}}
|
|
||||||
{{#if fatalErrors}}
|
|
||||||
<div class="theme-validation-errordescription">
|
<div class="theme-validation-errordescription">
|
||||||
<h2 class="theme-validation-errortype fatal">Fatal Errors</h2>
|
<h2 class="theme-validation-errortype fatal">Fatal Errors</h2>
|
||||||
<p><em>(Must-fix to activate theme)</em></p>
|
<p><em>(Must-fix to activate theme)</em></p>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#each fatalErrors as |error|}}
|
{{#each this.fatalErrors as |error|}}
|
||||||
<li class="theme-validation-item">
|
<li class="theme-validation-item">
|
||||||
{{gh-theme-error-li error=error}}
|
{{gh-theme-error-li error=error}}
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
{{#if errors}}
|
{{#if this.errors}}
|
||||||
<div class="theme-validation-errordescription">
|
<div class="theme-validation-errordescription">
|
||||||
<h2 class="theme-validation-errortype">Errors</h2>
|
<h2 class="theme-validation-errortype">Errors</h2>
|
||||||
<p><em>(Very recommended to fix, functionality <span>could</span> be restricted)</em></p>
|
<p><em>(Very recommended to fix, functionality <span>could</span> be restricted)</em></p>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#each errors as |error|}}
|
{{#each this.errors as |error|}}
|
||||||
<li class="theme-validation-item">
|
<li class="theme-validation-item">
|
||||||
{{gh-theme-error-li error=error}}
|
{{gh-theme-error-li error=error}}
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
{{#if warnings}}
|
{{#if (and this.warnings (or this.fatalErrors this.errors))}}
|
||||||
<div class="theme-validation-errordescription">
|
<div class="theme-validation-errordescription">
|
||||||
<h2 class="theme-validation-errortype">Warnings</h2>
|
<h2 class="theme-validation-errortype">Warnings</h2>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#each warnings as |error|}}
|
{{#each this.warnings as |error|}}
|
||||||
<li class="theme-validation-item">
|
<li class="theme-validation-item">
|
||||||
{{gh-theme-error-li error=error}}
|
{{gh-theme-error-li error=error}}
|
||||||
</li>
|
</li>
|
||||||
|
@ -56,6 +51,6 @@
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button {{action "closeModal"}} class="gh-btn" data-test-modal-close-button>
|
<button {{action "closeModal"}} class="gh-btn" data-test-modal-close-button>
|
||||||
<span>Close</span>
|
<span>Ok</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -153,7 +153,6 @@
|
||||||
title="Activation successful"
|
title="Activation successful"
|
||||||
warnings=themeWarnings
|
warnings=themeWarnings
|
||||||
errors=themeErrors
|
errors=themeErrors
|
||||||
message=message
|
|
||||||
canActivate=true
|
canActivate=true
|
||||||
)
|
)
|
||||||
close=(action "hideThemeWarningsModal")
|
close=(action "hideThemeWarningsModal")
|
||||||
|
|
Loading…
Add table
Reference in a new issue