Commit 06bf634f authored by Romain Courteaud's avatar Romain Courteaud

Integrate subheader in correct spacing.

+ initiate the panel and the header at the same time

Thx to Sven Franck
parent dae665f9
...@@ -273,7 +273,6 @@ ...@@ -273,7 +273,6 @@
return jio_gadget.get.apply(jio_gadget, param_list);\n return jio_gadget.get.apply(jio_gadget, param_list);\n
});\n });\n
})\n })\n
\n
.allowPublicAcquisition("whoWantToDisplayThis", function (param_list) {\n .allowPublicAcquisition("whoWantToDisplayThis", function (param_list) {\n
// Hey, I want to display some URL\n // Hey, I want to display some URL\n
var options = {\n var options = {\n
...@@ -301,8 +300,31 @@ ...@@ -301,8 +300,31 @@
}\n }\n
return this.aq_pleasePublishMyState(options);\n return this.aq_pleasePublishMyState(options);\n
})\n })\n
.allowPublicAcquisition("whoWantToDisplayThisFrontPage", function (param_list) {\n
// Hey, I want to display some URL\n
var options = {\n
page: param_list[0]\n
};\n
return this.aq_pleasePublishMyState(options);\n
})\n
\n \n
.allowPublicAcquisition("renderPageHeader", function (param_list) {\n .allowPublicAcquisition("renderPageHeader", function (param_list) {\n
\n
// XXX Sven hack: number of _url determine padding for subheader on ui-content \n
function hasSubNavigation(my_param_dict) {\n
var i,\n
count = 0;\n
for (i in my_param_dict) {\n
if (my_param_dict.hasOwnProperty(i) && i.indexOf("_url") > -1) {\n
count += 1;\n
}\n
}\n
return count;\n
}\n
\n
if (hasSubNavigation(param_list[0]) > 2) {\n
this.props.sub_header_class = "ui-has-subheader";\n
}\n
this.props.header_argument_list = param_list;\n this.props.header_argument_list = param_list;\n
})\n })\n
\n \n
...@@ -349,6 +371,7 @@ ...@@ -349,6 +371,7 @@
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
// declared methods\n // declared methods\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
\n
// Render the page\n // Render the page\n
.declareMethod(\'configure\', function (options) {\n .declareMethod(\'configure\', function (options) {\n
var key;\n var key;\n
...@@ -364,14 +387,26 @@ ...@@ -364,14 +387,26 @@
.declareMethod(\'render\', function (options) {\n .declareMethod(\'render\', function (options) {\n
var gadget = this,\n var gadget = this,\n
header_gadget,\n header_gadget,\n
panel_gadget,\n
main_gadget;\n main_gadget;\n
return gadget.getDeclaredGadget("header")\n \n
.push(function (declared_gadget) {\n gadget.props.options = options;\n
header_gadget = declared_gadget;\n return new RSVP.Queue()\n
return header_gadget.notifyLoading();\n .push(function () {\n
return RSVP.all([\n
gadget.getDeclaredGadget("header"),\n
gadget.getDeclaredGadget("panel")\n
]);\n
})\n
.push(function (my_gadget_list) {\n
header_gadget = my_gadget_list[0];\n
panel_gadget = my_gadget_list[1];\n
return RSVP.all([\n
panel_gadget.render({}),\n
header_gadget.notifyLoading()\n
]);\n
})\n })\n
.push(function () {\n .push(function () {\n
\n
// By default, init the header options to be empty (ERP5 title by default + sidebar)\n // By default, init the header options to be empty (ERP5 title by default + sidebar)\n
gadget.props.header_argument_list = [{\n gadget.props.header_argument_list = [{\n
panel_action: true\n panel_action: true\n
...@@ -392,11 +427,13 @@ ...@@ -392,11 +427,13 @@
return gadget.aq_pleasePublishMyState({page: \'front\'})\n return gadget.aq_pleasePublishMyState({page: \'front\'})\n
.push(gadget.pleaseRedirectMyHash.bind(gadget));\n .push(gadget.pleaseRedirectMyHash.bind(gadget));\n
}\n }\n
\n
return renderPage(gadget, options.page, options);\n return renderPage(gadget, options.page, options);\n
})\n })\n
\n \n
.push(function (result) {\n .push(function (result) {\n
main_gadget = result;\n main_gadget = result;\n
\n
return header_gadget.render.apply(header_gadget, gadget.props.header_argument_list);\n return header_gadget.render.apply(header_gadget, gadget.props.header_argument_list);\n
})\n })\n
.push(function () {\n .push(function () {\n
...@@ -405,17 +442,23 @@ ...@@ -405,17 +442,23 @@
return main_gadget.getElement()\n return main_gadget.getElement()\n
.push(function (fragment) {\n .push(function (fragment) {\n
var element = gadget.props.article,\n var element = gadget.props.article,\n
hack = document.createElement("div");\n content_container = document.createElement("div");\n
// XXX Horrible temporary hack to get the header fixed and content not hidden behind it...\n \n
hack.innerHTML = "<p><br/><br/><br/></p>";\n content_container.className = "ui-content " + (gadget.props.sub_header_class || "");\n
// Go to the top of the page\n \n
// reset subheader indicator\n
delete gadget.props.sub_header_class;\n
\n
// go to the top of the page\n
window.scrollTo(0, 0);\n window.scrollTo(0, 0);\n
\n
// Clear first to DOM, append after to reduce flickering/manip\n // Clear first to DOM, append after to reduce flickering/manip\n
while (element.firstChild) {\n while (element.firstChild) {\n
element.removeChild(element.firstChild);\n element.removeChild(element.firstChild);\n
}\n }\n
hack.appendChild(fragment);\n content_container.appendChild(fragment);\n
element.appendChild(hack);\n element.appendChild(content_container);\n
\n
$(element).trigger("create");\n $(element).trigger("create");\n
return header_gadget.notifyLoaded();\n return header_gadget.notifyLoaded();\n
});\n });\n
...@@ -569,7 +612,7 @@ ...@@ -569,7 +612,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>
...@@ -583,7 +626,7 @@ ...@@ -583,7 +626,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>938.7130.7783.39850</string> </value> <value> <string>938.39279.27944.4147</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -601,7 +644,7 @@ ...@@ -601,7 +644,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1412758828.97</float> <float>1414687653.36</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </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