Commit 2e007394 authored by Vivek's avatar Vivek

renderjs_interfaces: two text editors rendered from one gadget.

parent 2122a688
......@@ -123,9 +123,9 @@
\n
</head>\n
<body>\n
<div class="container" style="margin: 10px; padding: 4px; width: 1858px; height: 600px;">\n
<div class="jumbotron" style="margin-left:0px">\n
<textarea class="textarea" placeholder="Enter text ..." style="width: 100%; height: 200px; font-size: 14px; line-height: 18px;"></textarea>\n
<div class="container" style=" width: 100%; height: 600px;">\n
<div class="jumbotron" style="margin-left:0px; height: 600px;">\n
<textarea class="textarea" placeholder="Enter text ..." style="width: 100%; height: 400px; font-size: 14px; line-height: 18px;"></textarea>\n
</div>\n
</div>\n
\n
......@@ -135,15 +135,9 @@
<script src="bootstrap.min.js"></script>\n
<script src="handlebars.runtime.min.js"></script>\n
<script src="bootstrap3-wysihtml5.min.js"></script>\n
\n
<script>\n
$(\'.textarea\').wysihtml5({\n
toolbar: {\n
fa: true\n
}\n
});\n
</script>\n
\n
<script src="rsvp.js"></script>\n
<script src="renderjs.js"></script>\n
<script src="gadget_bootstrap3-wysiwyg.js"></script>\n
</body>\n
</html>\n
......@@ -269,7 +263,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope1</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -283,7 +277,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.54809.19650.59255</string> </value>
<value> <string>944.56196.65369.51899</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -301,7 +295,7 @@
</tuple>
<state>
<tuple>
<float>1438694025.97</float>
<float>1438777350.44</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -130,8 +130,22 @@
</head>\n
<body>\n
<div data-role="page" id="document">\n
<div class="ui-content">\n
<div class="ui-grid-a ui-responsive">\n
<div class="ui-block-a" style="width:60%">\n
<div class="ui-content"></div>\n
</div>\n
<div class="ui-block-b" style="width:30%">\n
<form class="gadget-select-form">\n
<div data-role="fieldcontain">\n
<label for="gadget_selector" class="select"></label>\n
<select name="gadget_selector">\n
<option value="https://softinst60317.host.vifib.net/erp5/web_site_module/editor_demo/bootstrap-wysiwyg.html">Text Editor 1</option>\n
<option value="https://softinst60317.host.vifib.net/erp5/web_site_module/editor_demo/bootstrap3-wysiwyg.html">Text Editor 2</option>\n
</select>\n
</div>\n
</form>\n
</div>\n
</div> \n
</div>\n
</body>\n
</html>\n
......@@ -273,7 +287,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.53477.50307.41949</string> </value>
<value> <string>944.56298.5921.30532</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -291,7 +305,7 @@
</tuple>
<state>
<tuple>
<float>1438615471.66</float>
<float>1438783361.36</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -104,8 +104,8 @@
(function (window, document, rJS) {\n
"use strict";\n
\n
var EDITOR_GADGET = "./bootstrap-wysiwyg.html";\n
// var EDITOR_GADGET = "./bootstrap3-wysiwyg.html";\n
var EDITOR_GADGET_1 = "./bootstrap-wysiwyg.html";\n
var EDITOR_GADGET_2 = "./bootstrap3-wysiwyg.html";\n
// block JQM auto-start\n
$(document)\n
.on("mobileinit", function () {\n
......@@ -115,8 +115,6 @@
rJS(window)\n
\n
.ready(function (g) {\n
g.state_parameter_dict = {};\n
console.log("calling render");\n
})\n
\n
.declareMethod(\'render\', function () {\n
......@@ -124,40 +122,27 @@
\n
gadget = this;\n
page_list = document.body.querySelectorAll("[data-role=page]");\n
console.log("page_list", page_list);\n
page = page_list[page_list.length - 1];\n
console.log("page", page);\n
\n
// helper: declare edtior\n
function declareEditorGadget() {\n
return gadget.declareGadget(EDITOR_GADGET, {\n
function declareEditorGadget(editor_g) {\n
return gadget.declareGadget(editor_g, {\n
sandbox: \'iframe\',\n
element: page.querySelector("div.ui-content"),\n
scope: "editor"\n
});\n
}\n
\n
// helper: set Editor Gadget\n
function setEditorGadget() {\n
var iframe, editor;\n
\n
iframe = gadget.__element.getElementsByTagName("IFRAME")[0];\n
editor = iframe.contentDocument.getElementById("editor");\n
editor.style.overflow = "auto";\n
return gadget.editor_setContent(gadget.state_parameter_dict.temp);\n
}\n
\n
// helper: run chain - separate method to make the chain callable\n
function runChain() {\n
return new RSVP.Queue()\n
.push(function() {\n
return declareEditorGadget(this);\n
console.log("first gadget");\n
return declareEditorGadget(EDITOR_GADGET_1);\n
})\n
.push(function(){\n
page.querySelector("div.ui-content").innerHTML = "";\n
return declareEditorGadget(EDITOR_GADGET_2);\n
});\n
\n
}\n
\n
// START: fetch document\n
return runChain(); \n
})\n
\n
/* ============================ EDITOR =============================== */\n
......@@ -301,7 +286,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope1</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -315,7 +300,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.54775.35271.2508</string> </value>
<value> <string>944.56235.17061.26624</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -333,7 +318,7 @@
</tuple>
<state>
<tuple>
<float>1438693295.63</float>
<float>1438780043.78</float>
<string>GMT</string>
</tuple>
</state>
......
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