Commit 1bc8307f authored by Romain Courteaud's avatar Romain Courteaud Committed by Jérome Perrin

Add simple string field.

parent adaeef0d
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>Stringfield</title>
<!-- renderjs -->
<script src="../<%= copy.rsvp.relative_dest %>"></script>
<script src="../<%= copy.renderjs.relative_dest %>"></script>
<!-- custom script -->
<script src="stringfield.js" type="text/javascript"></script>
</head>
<body>
<input type='text' data-mini="true" />
</body>
</html>
/*global window, rJS, RSVP */
(function (window, rJS, RSVP) {
"use strict";
rJS(window)
.ready(function (gadget) {
return gadget.getElement()
.push(function (element) {
gadget.element = element;
});
})
.declareMethod('render', function (options) {
var input = this.element.querySelector('input'),
field_json = options.field_json || {};
input.setAttribute('value', field_json.value || "");
input.setAttribute('name', field_json.key);
input.setAttribute('title', field_json.title);
})
.declareMethod('getContent', function () {
var input = this.element.querySelector('input'),
result = {};
result[input.getAttribute('name')] = input.value;
return result;
});
}(window, rJS, RSVP));
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment