Commit 67486af2 authored by Jérome Perrin's avatar Jérome Perrin

update static version

parent db75d68f
......@@ -42,6 +42,9 @@
if (property_definition.type === "number") {
return gadget.declareGadget("../number_field/index.html");
}
if (property_definition.type === "integer") {
return gadget.declareGadget("../integer_field/index.html");
}
if (property_definition.enum) {
return gadget.declareGadget("../list_field/index.html");
}
......
<!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>Number field</title>
<!-- renderjs -->
<script src="../lib/rsvp.min.js"></script>
<script src="../lib/renderjs.min.js"></script>
<!-- custom script -->
<script src="integerfield.js" type="text/javascript"></script>
</head>
<body>
<input type='number' step="1" data-mini="true" />
</body>
</html>
/*global window, rJS */
(function(window, rJS) {
"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");
input.setAttribute("value", options.value);
input.setAttribute("name", options.key);
input.setAttribute("title", options.property_definition.description);
}).declareMethod("getContent", function() {
var input = this.element.querySelector("input"), result = {};
if (input.value !== "") {
result[input.getAttribute("name")] = parseFloat(input.value);
} else {
result[input.getAttribute("name")] = null;
}
return result;
});
})(window, rJS);
\ No newline at end of file
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