Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Aaron Chen
erp5
Commits
a9885b4a
Commit
a9885b4a
authored
Aug 07, 2015
by
Vivek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
9e34de6e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
34 deletions
+79
-34
bt5/erp5_web_editor_demo/PathTemplateItem/web_page_module/editor_test_gadget_html.xml
...hTemplateItem/web_page_module/editor_test_gadget_html.xml
+21
-10
bt5/erp5_web_editor_demo/PathTemplateItem/web_page_module/editor_test_gadget_js.xml
...athTemplateItem/web_page_module/editor_test_gadget_js.xml
+58
-24
No files found.
bt5/erp5_web_editor_demo/PathTemplateItem/web_page_module/editor_test_gadget_html.xml
View file @
a9885b4a
...
...
@@ -121,15 +121,15 @@
<script
type=
"text/javascript"
src=
"jquery.js"
></script>
\n
<script
type=
"text/javascript"
src=
"rsvp.js"
></script>
\n
<script
type=
"text/javascript"
src=
"renderjs.js"
></script>
\n
<script
type=
"text/javascript"
src=
"handlebars.js"
></script>
\n
<script
type=
"text/javascript"
src=
"gadget_global.js"
></script>
\n
<script
type=
"text/javascript"
src=
"jquerymobile.js"
></script>
\n
<script
type=
"text/javascript"
src=
"i18next.js"
></script>
\n
\n
<!-- specific script -->
\n
<script
type=
"text/javascript"
src=
"editor_test_gadget.js"
></script>
\n
\n
</head>
\n
<body>
\n
<div
data-role=
"page"
id=
"document"
>
\n
<script
class=
"sub-gadget-template"
type=
"text/x-handlebars-template"
>
\n
<div
class=
"ui-grid-a ui-responsive"
>
\n
<div
class=
"ui-block-a"
style=
"width:60%"
>
\n
<div
class=
"ui-content"
></div>
\n
...
...
@@ -137,17 +137,28 @@
<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
<label
for=
"gadget_selector"
>
Main Gadget
</label>
\n
<select
name=
"gadget_selector"
class=
"select"
>
\n
<option
value=
"
.
/bootstrap-wysiwyg.html"
>
Text Editor 1
</option>
\n
<option
value=
"
.
/bootstrap3-wysiwyg.html"
>
Text Editor 2
</option>
\n
</select>
\n
</div>
\n
<input
data-inline=
"true"
type=
"submit"
value=
"Submit"
data-theme=
"b"
>
\n
</form>
\n
</div>
\n
</div>
\n
</div>
\n
</script>
\n
</head>
\n
\n
<body>
\n
<div
data-role=
"page"
>
\n
<div
data-role=
"header"
data-position=
"fixed"
class=
"gadget-header"
data-theme=
"b"
>
\n
<h1></h1>
\n
</div>
\n
<div
role=
"main"
class=
"ui-content gadget-content"
></div>
\n
</div>
\n
</body>
\n
\n
</html>
\n
\n
...
...
@@ -287,7 +298,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
944.5
6298.5921.30532
</string>
</value>
<value>
<string>
944.5
7834.1936.52684
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -305,7 +316,7 @@
</tuple>
<state>
<tuple>
<float>
1438
783361.36
</float>
<float>
1438
875522.58
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
bt5/erp5_web_editor_demo/PathTemplateItem/web_page_module/editor_test_gadget_js.xml
View file @
a9885b4a
...
...
@@ -101,11 +101,48 @@
<key>
<string>
text_content
</string>
</key>
<value>
<string>
/*jslint indent: 2, maxlen: 80, nomen: true */\n
/*global console, window, document, rJS, RSVP, $ */\n
(function (window, document, rJS) {\n
(function (window, document, rJS
, Handlebars, promiseEventListener
) {\n
"use strict";\n
\n
var EDITOR_GADGET_1 = "./bootstrap-wysiwyg.html";\n
var EDITOR_GADGET_2 = "./bootstrap3-wysiwyg.html";\n
var DEFAULT_EDITOR_GADGET = "./bootstrap-wysiwyg.html";\n
\n
function declareEditorGadget(gadget, editor_g) {\n
console.log("inside declareEditorGadget");\n
return gadget.declareGadget(editor_g, {\n
sandbox: \'iframe\',\n
element: document.body.querySelector("[data-role=page]"),\n
scope: "editor"\n
});\n
}\n
function gadgetSwitchHandler(gadget) {\n
console.log("Listening");\n
return new RSVP.Queue()\n
.push(function() {\n
gadget.props.content_element.innerHTML =\n
gadget.props.sub_gadget_template({});\n
return promiseEventListener(\n
gadget.props.content_element.querySelector(\'form.gadget-select-form\'),\n
\'submit\',\n
false\n
);\n
})\n
.push(function(submit_event) {\n
console.log("submit_event",submit_event);\n
gadget.props.content_element.querySelector("input[type=submit]")\n
.disabled = true;\n
gadget.props.content_element.querySelector("div.ui-content").innerHTML = "";\n
console.log("Selected:", submit_event.target[0].value);\n
return declareEditorGadget(gadget,submit_event.target[0].value);\n
})\n
.push(function(){\n
console.log("Calling self again");\n
gadget.props.content_element.querySelector("input[type=submit]")\n
.disabled = false;\n
return gadgetSwitchHandler(gadget);\n
});\n
\n
}\n
\n
// block JQM auto-start\n
$(document)\n
.on("mobileinit", function () {\n
...
...
@@ -115,32 +152,29 @@
rJS(window)\n
\n
.ready(function (g) {\n
g.props = {};\n
return g.getElement()\n
.push(function (element) {\n
$(element).trigger("create");\n
g.props.element = element;\n
g.props.header_element = element.querySelector(\'.gadget-header\');\n
g.props.content_element = element.querySelector(\'.gadget-content\');\n
g.props.sub_gadget_template = Handlebars.compile(\n
document.querySelector(".sub-gadget-template").innerHTML\n
);\n
});\n
})\n
\n
.declareMethod(\'render\', function () {\n
var gadget, page_list, page;\n
\n
gadget = this;\n
page_list = document.body.querySelectorAll("[data-role=page]");\n
page = page_list[page_list.length - 1];\n
\n
// helper: declare edtior\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
var gadget = this;\n
\n
return new RSVP.Queue()\n
.push(function() {\n
console.log("
firs
t gadget");\n
return declareEditorGadget(
EDITOR_GADGET_1
);\n
console.log("
defaul
t gadget");\n
return declareEditorGadget(
gadget, DEFAULT_EDITOR_GADGET
);\n
})\n
.push(function(){\n
page.querySelector("div.ui-content").innerHTML = "";\n
return declareEditorGadget(EDITOR_GADGET_2);\n
return gadgetSwitchHandler(gadget);\n
});\n
\n
})\n
...
...
@@ -165,7 +199,7 @@
});\n
});\n
\n
}(window, document, rJS));
</string>
</value>
}(window, document, rJS
, Handlebars, promiseEventListener
));
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
...
...
@@ -300,7 +334,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
944.5
6235.17061.26624
</string>
</value>
<value>
<string>
944.5
7850.5818.19541
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -318,7 +352,7 @@
</tuple>
<state>
<tuple>
<float>
1438
780043.78
</float>
<float>
1438
876472.39
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment