Commit ebc77d04 authored by Jérome Perrin's avatar Jérome Perrin

Debug JSON widget to see the whole json

This will replace the previous debug widget that shows input & output
wheras we only have one json now
parent bc150508
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Debug JSON</title>
<script src="../<%= copy.rsvp.relative_dest %>" type="text/javascript"></script>
<script src="../<%= copy.renderjs.relative_dest %>" type="text/javascript"></script>
<script src="mixin_gadget.js" type="text/javascript"></script>
<script src="Input_viewDebugJson.js" type="text/javascript"></script>
</head>
<body>
<div xdata-gadget-url="https://softinst52398.node.vifib.com/gadget_codemirror.html"
data-gadget-scope="editor"
data-gadget-sandbox="iframe"></div>
<label for="json">JSON</label>
<textarea spellcheck="false" rows="20" name="json" class="json"></textarea>
</body>
</html>
/*global rJS, initGadgetMixin */
(function (window, rJS, initGadgetMixin) {
"use strict";
var gadget_klass = rJS(window);
initGadgetMixin(gadget_klass);
gadget_klass
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function (options) {
var gadget = this;
this.props.jio_key = options.id;
this.props.result = options.result;
return gadget.aq_getAttachment({
"_id": gadget.props.jio_key,
"_attachment": "body.json"
})
.push(function (result_json) {
var document = JSON.parse(result_json);
gadget.props.element.querySelector(".json").textContent =
JSON.stringify(document, undefined, " ");
});
});
}(window, rJS, initGadgetMixin));
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