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

GUI: new output widget to display spreadsheet data

parent 2c685719
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Edit Shift Spreadsheet</title>
<script src="../<%= copy.rsvp.relative_dest %>" type="text/javascript"></script>
<script src="../<%= copy.renderjs.relative_dest %>" type="text/javascript"></script>
<script src="../<%= curl.jquery.relative_dest %>" type="text/javascript"></script>
<script src="../<%= curl.jquerymobilejs.relative_dest %>" type="text/javascript"></script>
<script src="mixin_gadget.js" type="text/javascript"></script>
<script src="Output_viewSpreadsheet.js" type="text/javascript"></script>
</head>
<body>
<div data-gadget-url="../handsontable/index.html"
data-gadget-scope="tableeditor"></div>
<form class="save_form">
<button type="submit" class="ui-btn ui-btn-b ui-btn-inline
ui-icon-edit ui-btn-icon-right">Save</button>
</form>
</body>
</html>
/*global rJS, RSVP, initGadgetMixin, loopEventListener, $ */
(function (window, rJS, RSVP, initGadgetMixin, loopEventListener, $) {
"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 jio_key = options.id,
gadget = this;
gadget.props.jio_key = jio_key;
return new RSVP.Queue()
.push(function () {
return RSVP.all([
gadget.aq_getAttachment({
"_id": jio_key,
"_attachment": "body.json"
}),
gadget.getDeclaredGadget("tableeditor")
]);
})
.push(function (result_list){
var content = JSON.parse(result_list[0]).result.result_list[options.result][options.action_definition.configuration.output_id],
handsontable_options = {readOnly: true};
$.extend(handsontable_options, options.action_definition.configuration.handsontable_options || {});
result_list[1].render(
JSON.stringify(content),
handsontable_options);
});
})
.declareMethod("startService", function () {
var gadget = this;
return this.getDeclaredGadget("tableeditor")
.push(function (tableeditor) {
return tableeditor.startService();
});
});
}(window, rJS, RSVP, initGadgetMixin, loopEventListener, $));
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