mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Show error message for invalid data in PostsPerPage (#419)
closes TryGhost/Ghost#7746 - Added gh-form-group around PostsPerPage - Changed focusOut action to validate - Removed now redundant `checkPostsPerPage()` call
This commit is contained in:
parent
0a37a27568
commit
d270bef724
2 changed files with 7 additions and 12 deletions
|
@ -89,14 +89,6 @@ export default Controller.extend(SettingsSaveMixin, {
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
checkPostsPerPage() {
|
|
||||||
let postsPerPage = this.get('model.postsPerPage');
|
|
||||||
|
|
||||||
if (postsPerPage < 1 || postsPerPage > 1000 || isNaN(postsPerPage)) {
|
|
||||||
this.set('model.postsPerPage', 5);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
setTheme(theme) {
|
setTheme(theme) {
|
||||||
this.set('model.activeTheme', theme.name);
|
this.set('model.activeTheme', theme.name);
|
||||||
this.send('save');
|
this.send('save');
|
||||||
|
|
|
@ -65,10 +65,13 @@
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
{{#gh-form-group errors=model.errors hasValidated=model.hasValidated property="postsPerPage"}}
|
||||||
<label for="postsPerPage">Posts per page</label>
|
<label for="postsPerPage">Posts per page</label>
|
||||||
{{! `pattern` brings up numeric keypad allowing any number of digits}}
|
{{! `pattern` brings up numeric keypad allowing any number of digits}}
|
||||||
{{gh-input model.postsPerPage id="postsPerPage" name="general[postsPerPage]" focus-out="checkPostsPerPage" min="1" max="1000" type="number" pattern="[0-9]*" update=(action (mut model.postsPerPage))}}
|
{{gh-input model.postsPerPage id="postsPerPage" name="general[postsPerPage]" focusOut=(action "validate" "postsPerPage" target=model) min="1" max="1000" type="number" pattern="[0-9]*" update=(action (mut model.postsPerPage))}}
|
||||||
|
{{gh-error-message errors=model.errors property="postsPerPage"}}
|
||||||
<p>How many posts should be displayed on each page</p>
|
<p>How many posts should be displayed on each page</p>
|
||||||
|
{{/gh-form-group}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group for-checkbox">
|
<div class="form-group for-checkbox">
|
||||||
|
|
Loading…
Add table
Reference in a new issue