Commit 549864c6 authored by Romain Courteaud's avatar Romain Courteaud Committed by Sebastien Robin

Group modules by business_application

parent 42787197
...@@ -123,11 +123,12 @@ ...@@ -123,11 +123,12 @@
<script src="gadget_erp5_pt_frontpage.js" type="text/javascript"></script>\n <script src="gadget_erp5_pt_frontpage.js" type="text/javascript"></script>\n
\n \n
<script id="table-template" type="text/x-handlebars-template">\n <script id="table-template" type="text/x-handlebars-template">\n
<ul data-role="listview" data-inset="true" class="document-listview">\n <dl data-role="listview" data-inset="true" class="document-listview">\n
<dt>{{definition_title}}</dt>\n
{{#each documentlist}}\n {{#each documentlist}}\n
<li><a href="{{link}}">{{title}}</a></li>\n <dd><a href="{{link}}">{{title}}</a></dd>\n
{{/each}}\n {{/each}}\n
</ul>\n </dl>\n
</script>\n </script>\n
\n \n
</head>\n </head>\n
...@@ -271,7 +272,7 @@ ...@@ -271,7 +272,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>936.25886.55930.55876</string> </value> <value> <string>937.42724.27724.55893</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -289,7 +290,7 @@ ...@@ -289,7 +290,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1406120865.84</float> <float>1411117135.09</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
\n \n
return gadget.jio_allDocs({\n return gadget.jio_allDocs({\n
"query": \'meta_type:"ERP5 Folder" AND id:"%_module"\',\n "query": \'meta_type:"ERP5 Folder" AND id:"%_module"\',\n
"select_list": ["title"]\n "select_list": ["title", "business_application_title"]\n
})\n })\n
.push(function (result) {\n .push(function (result) {\n
var result_list = [],\n var result_list = [],\n
...@@ -156,24 +156,53 @@ ...@@ -156,24 +156,53 @@
for (i = 0; i < result.data.rows.length; i += 1) {\n for (i = 0; i < result.data.rows.length; i += 1) {\n
result_list.push(RSVP.all([\n result_list.push(RSVP.all([\n
gadget.whoWantToDisplayThis(result.data.rows[i].id),\n gadget.whoWantToDisplayThis(result.data.rows[i].id),\n
result.data.rows[i].value.title || result.data.rows[i].id\n result.data.rows[i].value.title || result.data.rows[i].id,\n
result.data.rows[i].value.business_application_title\n
]));\n ]));\n
}\n }\n
return RSVP.all(result_list);\n return RSVP.all(result_list);\n
})\n })\n
.push(function (document_list) {\n .push(function (document_list) {\n
var i,\n var i,\n
parameter_list = [],\n business_application_dict = {},\n
business_application_list = [],\n
business_application,\n
module_info,\n
result_html = "",\n
doc;\n doc;\n
for (i = 0; i < document_list.length; i += 1) {\n for (i = 0; i < document_list.length; i += 1) {\n
doc = document_list[i];\n doc = document_list[i];\n
parameter_list[i] = {\n if (doc[2] === undefined) {\n
doc[2] = "Other";\n
}\n
module_info = {\n
link: doc[0],\n link: doc[0],\n
title: doc[1]\n title: doc[1]\n
};\n };\n
if (business_application_dict[doc[2]] === undefined) {\n
business_application_dict[doc[2]] = [module_info];\n
business_application_list.push(doc[2]);\n
} else {\n
business_application_dict[doc[2]].push(module_info);\n
}\n
}\n }\n
\n \n
parameter_list.sort(function (a, b) {\n business_application_list.sort(function (a, b) {\n
// Push the "Other" value at the end\n
var result = 0;\n
if (a === "Other") {\n
result = 1;\n
} else if (b === "Other") {\n
result = -1;\n
} else if (a < b) {\n
result = -1;\n
} else if (a > b) {\n
result = 1;\n
}\n
return result;\n
});\n
\n
function sort_module(a, b) {\n
var result = 0;\n var result = 0;\n
if (a.title < b.title) {\n if (a.title < b.title) {\n
result = -1;\n result = -1;\n
...@@ -181,12 +210,19 @@ ...@@ -181,12 +210,19 @@
result = 1;\n result = 1;\n
}\n }\n
return result;\n return result;\n
});\n }\n
\n \n
gadget.props.element.querySelector(\'.document_list\').innerHTML =\n for (i = 0; i < business_application_list.length; i += 1) {\n
table_template({\n business_application = business_application_list[i];\n
documentlist: parameter_list\n business_application_dict[business_application].sort(sort_module);\n
result_html += table_template({\n
definition_title: business_application,\n
documentlist: business_application_dict[business_application]\n
});\n });\n
}\n
\n
\n
gadget.props.element.querySelector(\'.document_list\').innerHTML = result_html;\n
});\n });\n
});\n });\n
}(window, rJS, RSVP, Handlebars)); }(window, rJS, RSVP, Handlebars));
...@@ -326,7 +362,7 @@ ...@@ -326,7 +362,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>937.42839.47775.36010</string> </value> <value> <string>937.43884.286.40960</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -344,7 +380,7 @@ ...@@ -344,7 +380,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1411055530.72</float> <float>1411118240.63</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