0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Merge pull request #5865 from acburdine/tag-menu-charcount

Tag Settings Menu Validation
This commit is contained in:
Kevin Ansfield 2015-10-14 11:48:30 +01:00
commit 8af13e9aa8
3 changed files with 16 additions and 3 deletions

View file

@ -110,6 +110,7 @@
.settings-tag .tag-description {
margin: 0;
color: color(#dfe1e3 lightness(-10%));
word-wrap: break-word;
font-size: 13px;
}

View file

@ -22,10 +22,12 @@
{{gh-url-preview prefix="tag" slug=activeTagSlugScratch tagName="p" classNames="description"}}
</div>
<div class="form-group">
{{#gh-form-group errors=activeTag.errors hasValidated=activeTag.hasValidated property="description"}}
<label for="tag-description">Description</label>
{{gh-textarea id="tag-description" name="description" value=activeTagDescriptionScratch focus-out="saveActiveTagDescription"}}
</div>
{{gh-error-message errors=activeTag.errors property="description"}}
{{gh-count-down-characters activeTagDescriptionScratch 200}}
{{/gh-form-group}}
<ul class="nav-list nav-list-block">
{{#gh-tab tagName="li" classNames="nav-list-item"}}

View file

@ -1,7 +1,7 @@
import BaseValidator from './base';
export default BaseValidator.create({
properties: ['name', 'metaTitle', 'metaDescription'],
properties: ['name', 'description', 'metaTitle', 'metaDescription'],
name: function (model) {
var name = model.get('name');
@ -16,6 +16,16 @@ export default BaseValidator.create({
this.invalidate();
}
},
description: function (model) {
var description = model.get('description');
if (!validator.isLength(description, 0, 200)) {
model.get('errors').add('description', 'Description cannot be longer than 200 characters');
this.invalidate();
}
},
metaTitle: function (model) {
var metaTitle = model.get('meta_title');