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>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_bootstrap3-wysiwyg.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>editor_gadget_bootstrap3-wysiwyg.js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string>/*jslint indent: 2 */\n
/*global window, jQuery, rJS*/\n
"use strict";\n
\n
(function (window, $, rJS) {\n
\n
rJS(window).\n
declareMethod(\'getContent\', function () {\n
return rJS(this).editor.html();\n
})\n
.declareMethod(\'setContent\', function (content) {\n
rJS(this).editor.html(content);\n
})\n
.declareMethod(\'clearContent\', function () {\n
rJS(this).editor.html(\'\');\n
})\n
.ready(function (g) {\n
g.editor = $(\'.textarea\');\n
g.editor.wysihtml5({\n
toolbar: {\n
fa: true\n
}\n
});\n
});\n
\n
}(window, jQuery, rJS));</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Editor Gadget Bootstrap3 wysiwyg JS</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope1</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1438768024.7</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.56186.56926.29952</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1438777746.45</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>empty</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1438767532.07</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
......@@ -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