Commit 2d61b58f authored by Sven Franck's avatar Sven Franck Committed by Sebastien Robin

Updated action menu to pre-enhanced JQM controlgroup

parent 0fd97d16
...@@ -115,10 +115,17 @@ ...@@ -115,10 +115,17 @@
<!-- renderjs -->\n <!-- renderjs -->\n
<script src="RSVP.js" type="text/javascript"></script>\n <script src="RSVP.js" type="text/javascript"></script>\n
<script src="renderjs.js" type="text/javascript"></script>\n <script src="renderjs.js" type="text/javascript"></script>\n
<script src="handlebars.js" type="text/javascript"></script>\n
\n \n
<!-- custom script -->\n <!-- custom script -->\n
<script src="gadget_global.js" type="text/javascript"></script>\n <script src="gadget_global.js" type="text/javascript"></script>\n
<script src="gadget_erp5_pt_form_view.js" type="text/javascript"></script>\n <script src="gadget_erp5_pt_form_view.js" type="text/javascript"></script>\n
\n
<script id="workflow-template" type="text/x-handlebars-template">\n
{{#each actionlist}}\n
<a class="{{class}}" href="{{link}}">{{title}}</a>\n
{{/each}}\n
</script>\n
\n \n
</head>\n </head>\n
<body>\n <body>\n
...@@ -130,6 +137,12 @@ ...@@ -130,6 +137,12 @@
<form class="save_form">\n <form class="save_form">\n
<button type="submit" class="ui-btn ui-btn-b ui-btn-inline\n <button type="submit" class="ui-btn ui-btn-b ui-btn-inline\n
ui-icon-edit ui-btn-icon-right">Save</button>\n ui-icon-edit ui-btn-icon-right">Save</button>\n
\n
<div class="action_list ui-controlgroup ui-controlgroup-horizontal ui-corner-all">\n
<div class="ui-controlgroup-controls">\n
</div>\n
</div>\n
\n
<div data-gadget-url="gadget_erp5_form.html"\n <div data-gadget-url="gadget_erp5_form.html"\n
data-gadget-scope="erp5_form"\n data-gadget-scope="erp5_form"\n
data-gadget-sandbox="public">\n data-gadget-sandbox="public">\n
......
...@@ -99,7 +99,9 @@ ...@@ -99,7 +99,9 @@
</item> </item>
<item> <item>
<key> <string>text_content</string> </key> <key> <string>text_content</string> </key>
<value> <string>/*global rJS, RSVP, jQuery, Handlebars,\n <value> <string encoding="cdata"><![CDATA[
/*global rJS, RSVP, jQuery, Handlebars,\n
promiseEventListener, console */\n promiseEventListener, console */\n
/*jslint nomen: true */\n /*jslint nomen: true */\n
/*global window, rJS, RSVP, StatelessJS, alert, FormData, document, console */\n /*global window, rJS, RSVP, StatelessJS, alert, FormData, document, console */\n
...@@ -111,7 +113,12 @@ ...@@ -111,7 +113,12 @@
// Handlebars\n // Handlebars\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
// Precompile the templates while loading the first gadget instance\n // Precompile the templates while loading the first gadget instance\n
var gadget_klass = rJS(window);\n var gadget_klass = rJS(window),\n
workflow_template = Handlebars.compile(\n
gadget_klass.__template_element\n
.getElementById("workflow-template")\n
.innerHTML\n
);\n
\n \n
gadget_klass\n gadget_klass\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
...@@ -121,6 +128,13 @@ ...@@ -121,6 +128,13 @@
.ready(function (g) {\n .ready(function (g) {\n
g.props = {};\n g.props = {};\n
})\n })\n
/////////////////////////////////////////////////////////////////\n
// ready\n
/////////////////////////////////////////////////////////////////\n
// Init local properties\n
.ready(function (g) {\n
g.props = {};\n
})\n
\n \n
// Assign the element to a variable\n // Assign the element to a variable\n
.ready(function (g) {\n .ready(function (g) {\n
...@@ -131,12 +145,22 @@ ...@@ -131,12 +145,22 @@
})\n })\n
\n \n
.declareAcquiredMethod("aq_put", "jio_put")\n .declareAcquiredMethod("aq_put", "jio_put")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
// declared methods\n // declared methods\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
.declareMethod(\'render\', function (options) {\n .declareMethod(\'render\', function (options) {\n
var erp5_document = options.erp5_document,\n var erp5_document = options.erp5_document,\n
form_gadget = this;\n action_list = erp5_document._links.action_workflow || [],\n
form_gadget = this,\n
i,\n
promise_list = [];\n
\n
for (i = 0; i < action_list.length; i += 1) {\n
promise_list.push(this.whoWantToDisplayThisPage({\n
name: action_list[i].name\n
}));\n
}\n
\n \n
form_gadget.props.id = erp5_document._id;\n form_gadget.props.id = erp5_document._id;\n
form_gadget.props.view = options.view;\n form_gadget.props.view = options.view;\n
...@@ -145,19 +169,47 @@ ...@@ -145,19 +169,47 @@
.push(function () {\n .push(function () {\n
return RSVP.all([\n return RSVP.all([\n
form_gadget.getDeclaredGadget("erp5_form"),\n form_gadget.getDeclaredGadget("erp5_form"),\n
form_gadget.getDeclaredGadget("erp5_tab")\n form_gadget.getDeclaredGadget("erp5_tab"),\n
RSVP.all(promise_list)\n
]);\n ]);\n
})\n })\n
.push(function (all_gadget) {\n .push(function (all_gadget) {\n
var form_options = options.erp5_form || {},\n var form_options = options.erp5_form || {},\n
tab_options = options.erp5_tag || {};\n tab_options = options.erp5_tag || {},\n
all_result = all_gadget[2],\n
actionlist = [],\n
class_list,\n
i;\n
\n \n
form_options.erp5_document = options.erp5_document;\n form_options.erp5_document = options.erp5_document;\n
form_options.form_definition = options.form_definition;\n form_options.form_definition = options.form_definition;\n
form_options.view = options.view;\n form_options.view = options.view;\n
\n
tab_options.erp5_document = options.erp5_document;\n tab_options.erp5_document = options.erp5_document;\n
tab_options.form_definition = options.form_definition;\n tab_options.form_definition = options.form_definition;\n
tab_options.view = options.view;\n tab_options.view = options.view;\n
\n
for (i = 0; i < all_result.length; i += 1) {\n
switch (i) {\n
case 0:\n
class_list = "ui-btn ui-first-child";\n
break;\n
case (all_result.length - 1):\n
class_list = "ui-btn ui-last-child";\n
break;\n
default:\n
class_list = "ui-btn";\n
break;\n
}\n
actionlist.push({\n
class: class_list,\n
title: action_list[i].title,\n
link: all_result[i],\n
});\n
}\n
form_gadget.__element.querySelector("div.ui-controlgroup-controls")\n
.innerHTML = workflow_template({actionlist: actionlist});\n
\n
\n \n
return RSVP.all([\n return RSVP.all([\n
all_gadget[1].render(form_options),\n all_gadget[1].render(form_options),\n
...@@ -191,7 +243,9 @@ ...@@ -191,7 +243,9 @@
);\n );\n
});\n });\n
\n \n
}(window, rJS, RSVP));</string> </value> }(window, rJS, RSVP));
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
26 27
\ No newline at end of file \ No newline at end of file
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