Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

🦄 Improved theme validation messages #812

Merged
merged 1 commit into from
Aug 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/components/modals/theme-warnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default ModalComponent.extend({
warnings: reads('model.warnings'),
errors: reads('model.errors'),
fatalErrors: reads('model.fatalErrors'),
canActivate: reads('model.canActivate'),

'data-test-theme-warnings-modal': true
});
8 changes: 7 additions & 1 deletion app/templates/components/modals/theme-warnings.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<header class="modal-header">
<h1 data-test-theme-warnings-title>{{title}}</h1>
<h1 data-test-theme-warnings-title>
{{#unless canActivate}}
{{title}}
{{else}}
{{title}} with {{#if errors}}errors{{else}}warnings{{/if}}
{{/unless}}
</h1>
</header>
<a class="close" href="#" title="Close" {{action "closeModal"}}>{{inline-svg "close"}}<span class="hidden">Close</span></a>

Expand Down
8 changes: 4 additions & 4 deletions app/templates/components/modals/upload-theme.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<h1>
{{#if theme}}
{{#if hasWarningsOrErrors}}
Upload successful with warnings/errors!
Upload successful with {{#if validationErrors}}errors{{else}}warnings{{/if}}
{{else}}
Upload successful!
{{/if}}
{{else if validationErrors}}
{{else if (or validationErrors fatalValidationErrors)}}
Invalid theme
{{else}}
Upload a theme
Expand All @@ -21,8 +21,8 @@
<ul class="theme-validation-errors">
<li>
<p>
"{{themeName}}" uploaded successfully but some warnings/errors were detected.
You are still able to use and activate the theme. Here is your report...
"{{themeName}}" uploaded successfully but some {{#if validationErrors}}errors{{else}}warnings{{/if}} were detected.
You are still able to use and activate the theme. Here's your report...
</p>
</li>

Expand Down
4 changes: 3 additions & 1 deletion app/templates/settings/design.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@
{{#if showThemeWarningsModal}}
{{gh-fullscreen-modal "theme-warnings"
model=(hash
title="Activated successful with warnings/errors!"
title="Activation successful"
warnings=themeWarnings
errors=themeErrors
message=message
canActivate=true
)
close=(action "hideThemeWarningsModal")
modifier="action wide"}}
Expand All @@ -61,6 +62,7 @@
title="Activation failed"
errors=themeErrors
fatalErrors=themeFatalErrors
canActivate=false
)
close=(action "hideThemeWarningsModal")
modifier="action wide"}}
Expand Down
4 changes: 2 additions & 2 deletions tests/acceptance/settings/design-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ describe('Acceptance: Settings - Design', function () {
expect(
find('.fullscreen-modal h1').text().trim(),
'modal title after uploading theme with warnings'
).to.equal('Upload successful with warnings/errors!');
).to.equal('Upload successful with warnings');

await click(testSelector('toggle-details'));

Expand Down Expand Up @@ -576,7 +576,7 @@ describe('Acceptance: Settings - Design', function () {
expect(
find(testSelector('theme-warnings-title')).text().trim(),
'modal title after activating theme with warnings'
).to.equal('Activated successful with warnings/errors!');
).to.equal('Activation successful with warnings');

await click(testSelector('toggle-details'));

Expand Down