Commit ed662e5c authored by Sven Franck's avatar Sven Franck Committed by Sebastien Robin

test for tabs before initiating tabs gadget (wip)

parent 9d87fd5f
...@@ -156,8 +156,7 @@ ...@@ -156,8 +156,7 @@
<section data-gadget-url="gadget_jio.html"\n <section data-gadget-url="gadget_jio.html"\n
data-gadget-scope="jio_gadget"\n data-gadget-scope="jio_gadget"\n
data-gadget-sandbox="public"></section>\n data-gadget-sandbox="public"></section>\n
<aside>\n <!-- <aside></aside> -->\n
</aside>\n
</body>\n </body>\n
</html> </html>
...@@ -282,7 +281,7 @@ ...@@ -282,7 +281,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>romain</string> </value> <value> <string>sven</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -296,7 +295,7 @@ ...@@ -296,7 +295,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>936.47410.50555.22340</string> </value> <value> <string>936.49302.26306.5341</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -314,7 +313,7 @@ ...@@ -314,7 +313,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1407397647.36</float> <float>1407832402.03</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -101,8 +101,8 @@ ...@@ -101,8 +101,8 @@
<key> <string>text_content</string> </key> <key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
/*global rJS, RSVP, jQuery, URI, console */\n /*global rJS, RSVP, jQuery, URI, console, $ */\n
/*jslint nomen: true */\n /*jslint indent: 2, maxlen: 80, nomen: true */\n
(function (rJS, RSVP, URI) {\n (function (rJS, RSVP, URI) {\n
"use strict";\n "use strict";\n
\n \n
...@@ -126,13 +126,13 @@ ...@@ -126,13 +126,13 @@
});\n });\n
});\n });\n
}\n }\n
function renderFrontpage(gadget, options) {\n
\n \n
function renderFrontpage(gadget, options) {\n
return gadget.props.breadcrumb_gadget.render({title: "ERP5"})\n return gadget.props.breadcrumb_gadget.render({title: "ERP5"})\n
.push(function () {\n .push(function () {\n
return gadget.declareGadget(gadget.props.frontpage_gadget, {\n return gadget.declareGadget(gadget.props.frontpage_gadget, {\n
scope: "frontpage_gadget"\n scope: "frontpage_gadget"\n
})\n });\n
})\n })\n
.push(function (sub_gadget) {\n .push(function (sub_gadget) {\n
return RSVP.all([\n return RSVP.all([\n
...@@ -143,12 +143,11 @@ ...@@ -143,12 +143,11 @@
}\n }\n
\n \n
function renderLoginForm(gadget, options) {\n function renderLoginForm(gadget, options) {\n
\n
return gadget.props.breadcrumb_gadget.render({title: "Login"})\n return gadget.props.breadcrumb_gadget.render({title: "Login"})\n
.push(function () {\n .push(function () {\n
return gadget.declareGadget("gadget_erp5_pt_loginform.html", {\n return gadget.declareGadget("gadget_erp5_pt_loginform.html", {\n
scope: "login_gadget"\n scope: "login_gadget"\n
})\n });\n
})\n })\n
.push(function (sub_gadget) {\n .push(function (sub_gadget) {\n
return RSVP.all([\n return RSVP.all([\n
...@@ -161,6 +160,7 @@ ...@@ -161,6 +160,7 @@
function renderJioDocument(gadget, options) {\n function renderJioDocument(gadget, options) {\n
var sub_options,\n var sub_options,\n
breadcrumb_options = {};\n breadcrumb_options = {};\n
\n
return gadget.getDeclaredGadget("jio_gadget")\n return gadget.getDeclaredGadget("jio_gadget")\n
.push(function (jio_gadget) {\n .push(function (jio_gadget) {\n
var jio_key = options.jio_key,\n var jio_key = options.jio_key,\n
...@@ -173,9 +173,13 @@ ...@@ -173,9 +173,13 @@
return jio_gadget.get({"_id": jio_key}, {"_view": view});\n return jio_gadget.get({"_id": jio_key}, {"_view": view});\n
})\n })\n
.push(function (result) {\n .push(function (result) {\n
breadcrumb_options.title = result.data.title || result.data.reference || options.jio_key;\n var uri;\n
\n
breadcrumb_options.title = result.data.title ||\n
result.data.reference || options.jio_key;\n
breadcrumb_options.parent_link = result.data._links.parent;\n breadcrumb_options.parent_link = result.data._links.parent;\n
var uri = new URI(\n \n
uri = new URI(\n
result.data._embedded._view._links.form_definition.href\n result.data._embedded._view._links.form_definition.href\n
);\n );\n
// if ((uri.scheme() === "urn") &&\n // if ((uri.scheme() === "urn") &&\n
...@@ -194,23 +198,32 @@ ...@@ -194,23 +198,32 @@
]);\n ]);\n
})\n })\n
.push(function (result) {\n .push(function (result) {\n
var content_list = [];\n
\n
sub_options = options.form_gadget || {};\n sub_options = options.form_gadget || {};\n
sub_options.erp5_document = result[0].data;\n sub_options.erp5_document = result[0].data;\n
sub_options.form_definition = result[1].data;\n sub_options.form_definition = result[1].data;\n
sub_options.view = options.view;\n sub_options.view = options.view;\n
sub_options.action_view = gadget.props.action_view;\n sub_options.action_view = gadget.props.action_view;\n
\n \n
return gadget.declareGadget("gadget_erp5_pt_" + sub_options.form_definition.pt + ".html", {\n return RSVP.all([\n
gadget.declareGadget("gadget_erp5_pt_" + sub_options.form_definition.pt + ".html", {\n
scope: "form_gadget"\n scope: "form_gadget"\n
});\n }),\n
gadget.declareGadget("gadget_erp5_tab_list.html", {\n
scope: "erp5_tab"\n
})\n })\n
]);\n
})\n
.push(function (gadget_list) {\n
var form_gadget = gadget_list[0],\n
tab_gadget = gadget_list[1],\n
new_content_action = sub_options.erp5_document._links.action_object_new_content_action,\n
plus_queue,\n
new_element;\n
\n \n
.push(function (form_gadget) {\n
\n
var new_content_action = sub_options.erp5_document._links.action_object_new_content_action,\n
plus_queue;\n
if (new_content_action === undefined) {\n if (new_content_action === undefined) {\n
var new_element = gadget.__element.querySelector(".ui-icon-plus");\n new_element = gadget.__element.querySelector(".ui-icon-plus");\n
new_element.href = "";\n new_element.href = "";\n
if (!new_element.classList.contains("ui-disabled")) {\n if (!new_element.classList.contains("ui-disabled")) {\n
new_element.classList.add("ui-disabled");\n new_element.classList.add("ui-disabled");\n
...@@ -219,18 +232,21 @@ ...@@ -219,18 +232,21 @@
// XXX copied from whoWantToDisplayThisPage\n // XXX copied from whoWantToDisplayThisPage\n
plus_queue = gadget.aq_pleasePublishMyState({jio_key: gadget.props.jio_key, view: new_content_action.name})\n plus_queue = gadget.aq_pleasePublishMyState({jio_key: gadget.props.jio_key, view: new_content_action.name})\n
.push(function (hash) {\n .push(function (hash) {\n
var new_element = gadget.__element.querySelector(".ui-icon-plus");\n new_element = gadget.__element.querySelector(".ui-icon-plus");\n
new_element.href = hash;\n new_element.href = hash;\n
new_element.classList.remove("ui-disabled");\n new_element.classList.remove("ui-disabled");\n
});\n });\n
}\n }\n
\n
return RSVP.all([\n return RSVP.all([\n
tab_gadget.render(sub_options),\n
tab_gadget.getElement(),\n
form_gadget.render(sub_options),\n form_gadget.render(sub_options),\n
form_gadget.getElement(),\n form_gadget.getElement(),\n
gadget.props.breadcrumb_gadget.render(breadcrumb_options),\n gadget.props.breadcrumb_gadget.render(breadcrumb_options),\n
plus_queue\n plus_queue\n
]);\n ]);\n
})\n });\n
}\n }\n
\n \n
\n \n
...@@ -345,7 +361,6 @@ ...@@ -345,7 +361,6 @@
queue;\n queue;\n
\n \n
if (options.jio_key === undefined) {\n if (options.jio_key === undefined) {\n
\n
var new_element = gadget.__element.querySelector(".ui-icon-plus");\n var new_element = gadget.__element.querySelector(".ui-icon-plus");\n
new_element.href = "";\n new_element.href = "";\n
if (!new_element.classList.contains("ui-disabled")) {\n if (!new_element.classList.contains("ui-disabled")) {\n
...@@ -374,20 +389,26 @@ ...@@ -374,20 +389,26 @@
\n \n
$.mobile.loading(\'show\');\n $.mobile.loading(\'show\');\n
return queue\n return queue\n
.push(function (all_response) {\n .push(function (response_list) {\n
var page_element = all_response[1],\n var element = document.querySelector("article"),\n
element = document.querySelector("article");\n fragment = document.createDocumentFragment(),\n
// XXX JQuery mobile\n i,\n
// // $.mobile.loading(\'hide\');\n len,\n
item;\n
\n \n
// add all HTML nodes to fragment\n
for (i = 0, len = response_list.length; i < len; i += 1) {\n
item = response_list[i] || {};\n
if (item.nodeType && item.nodeType == 1) {\n
fragment.appendChild(item);\n
}\n
}\n
\n \n
// Append in the DOM at the end to reduce flickering and reduce DOM\n // Clear first to DOM, append after to reduce flickering/manip\n
// modifications\n
// Clear the previous rendering\n
while (element.firstChild) {\n while (element.firstChild) {\n
element.removeChild(element.firstChild);\n element.removeChild(element.firstChild);\n
}\n }\n
element.appendChild(page_element);\n element.appendChild(fragment);\n
\n \n
$.mobile.loading(\'hide\');\n $.mobile.loading(\'hide\');\n
return $(element).trigger("create");\n return $(element).trigger("create");\n
...@@ -528,7 +549,7 @@ ...@@ -528,7 +549,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>romain</string> </value> <value> <string>sven</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -542,7 +563,7 @@ ...@@ -542,7 +563,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>936.48944.48108.750</string> </value> <value> <string>936.54931.34982.25019</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -560,7 +581,7 @@ ...@@ -560,7 +581,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1407492633.6</float> <float>1407849144.68</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
50 51
\ 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