mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-28 05:14:12 +03: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
@ -89,14 +89,6 @@ export default Controller.extend(SettingsSaveMixin, {
|
||||
},
|
||||
|
||||
actions: {
|
||||
checkPostsPerPage() {
|
||||
let postsPerPage = this.get('model.postsPerPage');
|
||||
|
||||
if (postsPerPage < 1 || postsPerPage > 1000 || isNaN(postsPerPage)) {
|
||||
this.set('model.postsPerPage', 5);
|
||||
}
|
||||
},
|
||||
|
||||
setTheme(theme) {
|
||||
this.set('model.activeTheme', theme.name);
|
||||
this.send('save');
|
||||
|
@ -65,10 +65,13 @@
|
||||
<fieldset>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="postsPerPage">Posts per page</label>
|
||||
{{! `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))}}
|
||||
<p>How many posts should be displayed on each page</p>
|
||||
{{#gh-form-group errors=model.errors hasValidated=model.hasValidated property="postsPerPage"}}
|
||||
<label for="postsPerPage">Posts per page</label>
|
||||
{{! `pattern` brings up numeric keypad allowing any number of digits}}
|
||||
{{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>
|
||||
{{/gh-form-group}}
|
||||
</div>
|
||||
|
||||
<div class="form-group for-checkbox">
|
||||
|
Loading…
Reference in New Issue
Block a user