Commit 7aafa7d0 authored by Romain Courteaud's avatar Romain Courteaud

Add a panel gadget.

Activate it on the frontpage and list view.
parent a6ff03df
......@@ -102,7 +102,7 @@
<value> <string encoding="cdata"><![CDATA[
CACHE MANIFEST\n
# generated on Thu, 02 Oct 2014 12:06:38 +0000\n
# generated on Mon, 06 Oct 2014 15:03:33 +0000\n
# XXX + fonts\n
# images/ajax-loader.gif\n
CACHE:\n
......@@ -165,6 +165,8 @@ gadget_erp5_page_login.html\n
gadget_erp5_page_login.js\n
gadget_erp5_page_tab.html\n
gadget_erp5_page_tab.js\n
gadget_erp5_panel.html\n
gadget_erp5_panel.js\n
gadget_erp5_pt_form_dialog.html\n
gadget_erp5_pt_form_dialog.js\n
gadget_erp5_pt_form_list.html\n
......@@ -322,7 +324,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>937.64214.42636.62720</string> </value>
<value> <string>938.4615.36506.28108</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -340,7 +342,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1412254043.5</float>
<float>1412758909.58</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -221,8 +221,8 @@
field_url = \'gadget_erp5_field_list.html\';\n
} else if (renderered_field.type === \'StringField\') {\n
field_url = \'gadget_erp5_field_string.html\';\n
} else if (renderered_field.type === \'RelationStringField\') {\n
field_url = \'gadget_erp5_field_relation_string.html\';\n
// } else if (renderered_field.type === \'RelationStringField\') {\n
// field_url = \'gadget_erp5_field_relation_string.html\';\n
} else if (renderered_field.type === \'TextAreaField\') {\n
field_url = \'gadget_erp5_field_textarea.html\';\n
} else if (renderered_field.type === \'FloatField\') {\n
......@@ -479,7 +479,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>937.64263.33357.15633</string> </value>
<value> <string>937.64346.57999.39918</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -497,7 +497,7 @@
</tuple>
<state>
<tuple>
<float>1412254860.94</float>
<float>1412339249.91</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -128,7 +128,7 @@
<a role="button" href="{{url}}" class="responsive ui-btn ui-icon-{{icon}} ui-btn-icon-left ui-first-child ui-last-child {{class}}">{{title}}</a>\n
</script>\n
<script id="header-button-template" type="text/x-handlebars-template">\n
<form><button type=\'submit\' class=\'responsive ui-btn ui-icon-{{icon}} ui-btn-icon-left ui-first-child ui-last-child {{class}}\'>{{title}}</button></form>\n
<form><button name=\'{{name}}\' type=\'submit\' class=\'responsive ui-btn ui-icon-{{icon}} ui-btn-icon-left ui-first-child ui-last-child {{class}}\'>{{title}}</button></form>\n
</script>\n
\n
<script id="sub-header-template" type="text/x-handlebars-template">\n
......@@ -310,7 +310,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>937.65430.11917.20872</string> </value>
<value> <string>938.4401.55907.17169</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -328,7 +328,7 @@
</tuple>
<state>
<tuple>
<float>1412326537.12</float>
<float>1412595274.24</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -172,6 +172,7 @@
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
.declareAcquiredMethod("jio_get", "jio_get")\n
.declareAcquiredMethod("triggerSubmit", "triggerSubmit")\n
.declareAcquiredMethod("triggerPanel", "triggerPanel")\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
/////////////////////////////////////////////////////////////////\n
......@@ -226,12 +227,15 @@
[\'cancel_url\', \'Cancel\', \'times\'],\n
[\'back_url\', \'Back\', \'arrow-left\']\n
],\n
possible_left_button_list = [\n
[\'panel_action\', \'Menu\', \'bars\', \'panel\']\n
],\n
possible_right_link_list = [\n
[\'edit_url\', \'Edit\', \'edit\']\n
],\n
possible_right_button_list = [\n
[\'save_action\', \'Save\', \'check\'],\n
[\'submit_action\', \'Proceed\', \'share\']\n
[\'save_action\', \'Save\', \'check\', \'submit\'],\n
[\'submit_action\', \'Proceed\', \'share\', \'submit\']\n
],\n
possible_sub_header_list = [\n
[\'tab_url\', \'Tabs\', \'eye\'],\n
......@@ -247,7 +251,14 @@
i,\n
klass,\n
count = 0,\n
//left_link = {\n
// title: "Menu",\n
// icon: "bars",\n
// url: "#leftpanel",\n
// class: "ui-disabled"\n
// },\n
left_link,\n
left_button,\n
right_link,\n
right_button,\n
default_right_icon = "",\n
......@@ -281,10 +292,20 @@
url: options[possible_left_link_list[i][0]],\n
class: klass\n
};\n
count += 1;\n
}\n
}\n
if (left_link === undefined) {\n
for (i = 0; i < possible_left_button_list.length; i += 1) {\n
if (options.hasOwnProperty(possible_left_button_list[i][0])) {\n
left_button = {\n
title: possible_left_button_list[i][1],\n
icon: possible_left_button_list[i][2],\n
name: possible_left_button_list[i][3]\n
};\n
}\n
}\n
if (left_button !== undefined) {\n
gadget.props.left_link.innerHTML = header_button_template(left_button);\n
} else if (left_link === undefined) {\n
gadget.props.left_link.innerHTML = "";\n
} else {\n
gadget.props.left_link.innerHTML = header_link_template(left_link);\n
......@@ -319,14 +340,14 @@
url: options[possible_right_link_list[i][0]],\n
class: klass\n
};\n
count += 1;\n
}\n
}\n
for (i = 0; i < possible_right_button_list.length; i += 1) {\n
if (options.hasOwnProperty(possible_right_button_list[i][0])) {\n
right_button = {\n
title: possible_right_button_list[i][1],\n
icon: default_right_icon || possible_right_button_list[i][2]\n
icon: default_right_icon || possible_right_button_list[i][2],\n
name: possible_right_button_list[i][3]\n
};\n
if (gadget.stats.error) {\n
right_button.class = "ui-disabled";\n
......@@ -375,8 +396,16 @@
.declareService(function () {\n
var form_gadget = this;\n
\n
function formSubmit() {\n
return form_gadget.triggerSubmit();\n
function formSubmit(evt) {\n
var button = evt.target[0],\n
name = button.getAttribute("name");\n
if (name === "panel") {\n
return form_gadget.triggerPanel();\n
}\n
if (name === "submit") {\n
return form_gadget.triggerSubmit();\n
}\n
throw new Error("Unsupported button " + name);\n
}\n
\n
// Listen to form submit\n
......@@ -525,7 +554,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>938.142.63057.34594</string> </value>
<value> <string>938.4424.15337.59562</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -543,7 +572,7 @@
</tuple>
<state>
<tuple>
<float>1412343494.43</float>
<float>1412596556.28</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -134,12 +134,14 @@
\n
</head>\n
<body>\n
\n
<div data-role="panel" id="leftpanel" data-display="overlay"></div>\n
\n
<div data-gadget-url="gadget_erp5_header.html"\n
data-gadget-scope="header"\n
data-gadget-sandbox="public"></div>\n
\n
<div data-gadget-url="gadget_erp5_panel.html"\n
data-gadget-scope="panel"\n
data-gadget-sandbox="public"></div>\n
\n
<article class="ui-content"></article>\n
\n
......@@ -284,7 +286,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>937.64343.1806.54016</string> </value>
<value> <string>938.4433.7668.55722</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -302,7 +304,7 @@
</tuple>
<state>
<tuple>
<float>1412343671.79</float>
<float>1412596999.08</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -340,6 +340,12 @@
return page_gadget.triggerSubmit();\n
});\n
})\n
.allowPublicAcquisition(\'triggerPanel\', function () {\n
return this.getDeclaredGadget("panel")\n
.push(function (panel_gadget) {\n
return panel_gadget.toggle();\n
});\n
})\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
/////////////////////////////////////////////////////////////////\n
......@@ -367,7 +373,9 @@
.push(function () {\n
\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
}];\n
\n
options.action_view = gadget.props.action_view;\n
gadget.state_parameter_dict = {\n
......@@ -575,7 +583,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>938.5954.37249.58333</string> </value>
<value> <string>938.7130.7783.39850</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -593,7 +601,7 @@
</tuple>
<state>
<tuple>
<float>1412758687.11</float>
<float>1412758828.97</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -151,6 +151,7 @@
all_gadget[0].render(search_options),\n
all_gadget[1].render(form_options),\n
gadget.renderPageHeader({\n
panel_action: true,\n
jump_url: "",\n
cut_url: "",\n
actions_url: all_gadget[4],\n
......@@ -300,7 +301,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>937.64343.1806.54016</string> </value>
<value> <string>937.65471.52542.37171</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -318,7 +319,7 @@
</tuple>
<state>
<tuple>
<float>1412327028.09</float>
<float>1412596633.53</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