all files / keystone/fields/types/textarea/ TextareaType.js

100% Statements 18/18
100% Branches 2/2
100% Functions 2/2
100% Lines 18/18
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39                                          
var FieldType = require('../Type');
var TextType = require('../text/TextType');
var util = require('util');
var utils = require('keystone-utils');
 
 
/**
 * Text FieldType Constructor
 * @extends Field
 * @api public
 */
function textarea (list, path, options) {
	this._nativeType = String;
	this._underscoreMethods = ['format', 'crop'];
	this.height = options.height || 90;
	this._properties = ['height'];
	textarea.super_.call(this, list, path, options);
}
util.inherits(textarea, FieldType);
 
 
textarea.prototype.validateInput = TextType.prototype.validateInput;
textarea.prototype.validateRequiredInput = TextType.prototype.validateRequiredInput;
 
/* Inherit from TextType prototype */
textarea.prototype.addFilterToQuery = TextType.prototype.addFilterToQuery;
textarea.prototype.crop = TextType.prototype.crop;
 
/**
 * Formats the field value
 * @api public
 */
textarea.prototype.format = function (item) {
	return utils.textToHTML(item.get(this.path));
};
 
/* Export Field Type */
module.exports = textarea;