Commit 6c055fd1 authored by Sven Franck's avatar Sven Franck

erp5_officejs_afs_directory: add hardcoded statistics sheet

parent eb966ce8
......@@ -107,7 +107,6 @@
CACHE MANIFEST\n
# generated on Tue, 15 Nov 2016 13:00:00 GMT .\n
# XXX + fonts\n
# images/ajax-loader.gif\n
CACHE:\n
font-awesome/font-awesome-webfont.eot?v=4.6.3\n
......@@ -216,7 +215,6 @@ gadget_translation.html\n
gadget_translation.js\n
gadget_translation_data.js\n
handlebars.js\n
i18next.js\n
jiodev.js\n
renderjs.js\n
rsvp.js\n
......@@ -367,7 +365,7 @@ NETWORK:\n
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -381,7 +379,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>955.22266.33108.62037</string> </value>
<value> <string>955.22266.62194.26368</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -399,7 +397,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1479390416.92</float>
<float>1495202108.93</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -9,25 +9,25 @@
.ui-masonry-container > ul {
margin: 1.5em 0;
padding: 0;
-ms-column-gap: 1.5em;
-moz-column-gap: 1.5em;
-webkit-column-gap: 1.5em;
column-gap: 1.5em;
-ms-column-gap: 2.5em;
-moz-column-gap: 2.5em;
-webkit-column-gap: 2.5em;
column-gap: 2.5em;
list-style: none outside none;
}
.ui-masonry-container > ul li {
display: inline-block;
display: block;
width: 100%;
float: none;
break-inside: avoid;
}
.ui-masonry-container > ul ul li {
border-bottom: 1px solid #ededed;
padding: 2px 0;
}
.ui-masonry-container > ul li .ui-content-section {
padding: 0;
padding-bottom: .5em;
margin: 1em 0;
padding: 1em 0;
margin: 0;
}
.ui-masonry-container > ul li .ui-content-section h1 {
padding: 0.5em 0 .5em 0;
......@@ -273,3 +273,150 @@
}
}
/*
-------------------------------------------------------------------------
-------------------------- UNSPLASH BANNER ------------------------------
-------------------------------------------------------------------------
*/
.ui-banner-section {
width: auto;
position: absolute;
height: 80vh;
margin: 0;
top: 0;
left: 0;
right: 0;
overflow: hidden;
}
.ui-banner-section + section {
padding-top: 80vh;
}
.ui-banner-section img {
/* max-height: 100%; */
max-width: 100%;
width: auto;
height: auto;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
z-index: -1;
background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.6));
}
.ui-banner-section span {
position: absolute;
bottom: 0;
right: 0;
color: white;
font-size: small;
padding: 0 .5em .25em 0;
}
.ui-banner-section span a {
color: rgb(153, 153, 153);
}
.ui-banner-section h1 {
position: absolute;
color: white;
top: 33vh;
width: 47%;
text-align: center;
font-weight: bold;
right: 8%;
padding: 0 .5em 0 0;
font-size: 42px;
background: rgba(255,255,255,0.1);
border-radius: .05em;
}
@media only screen and (max-width: 45em) {
.ui-banner-section {
height: 40vh;
}
.ui-banner-section + section {
padding-top: 40vh;
}
.ui-banner-section img {
margin: 0 auto;
}
.ui-banner-section h1 {
top: 17vh;
font-size: 18px;
}
.ui-banner-section span {
font-size: xx-small;
}
}
/*
-------------------------------------------------------------------------
---------------------------- OVERWRITES ---------------------------------
-------------------------------------------------------------------------
*/
.document_table table thead,
div[data-gadget-scope='header'] .ui-header {
background-color: #444444;
}
/* tables overrides */
.document_table table thead tr td,
.document_table table thead tr th {
text-align: center;
}
.document_table table tbody tr td:not(:first-child),
.document_table table tbody tr th:not(:first-child) {
text-align: right;
}
/* align header and background colors */
div[data-gadget-scope='header'] .ui-header .ui-controlgroup-controls button, div[data-gadget-scope='header'] .ui-header .ui-controlgroup-controls a,
div[data-gadget-scope='header'] .ui-header h1 {
background-color: #444444;
}
/* center header text, remove hardcoded paddings by giving controlgroups same space */
div[data-gadget-scope='header'] .ui-header h1 {
text-align: center;
}
div[data-gadget-scope='header'] .ui-header h1 > span {
padding: 0;
}
div[data-gadget-scope='header'] .ui-header .ui-controlgroup {
background: #444444;
}
@media only screen and (min-width: 45em) and (max-width: 85em) {
div[data-gadget-scope='header'] .ui-header .ui-controlgroup {
width: 8em;
}
}
@media not screen and (min-width: 45em) {
div[data-gadget-scope='header'] .ui-header .ui-controlgroup {
width: 3em;
}
}
/* keep panel hidden
div[data-gadget-scope='panel'] {
left: -186pt;
background-color: transparent;
display: none;
}
@media not screen and (max-width: 85em) {
div[data-gadget-scope='header'] .ui-header {
margin-left: 0;
}
}
@media not screen and (max-width: 85em) {
.gadget-content {
margin-left: 0;
}
}
*/
......@@ -220,7 +220,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>955.20671.48081.55893</string> </value>
<value> <string>959.36825.37639.35106</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1479295110.81</float>
<float>1495561064.3</float>
<string>UTC</string>
</tuple>
</state>
......
<!DOCTYPE html>
<!Doctype html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Jio Gadget</title>
<!-- renderjs -->
......
......@@ -218,7 +218,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>953.59441.2826.48947</string> </value>
<value> <string>959.35277.2835.34423</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1473842967.79</float>
<float>1495467687.67</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, RSVP, UriTemplate, URI, Query, SimpleQuery, ComplexQuery, jIO */
/*jslint indent: 2, maxerr: 3, nomen: true */
(function (window, rJS, RSVP, UriTemplate, URI, Query, SimpleQuery, ComplexQuery, jIO) {
/*global window, rJS, RSVP, UriTemplate, URI, Query, SimpleQuery, ComplexQuery,
jIO, DOMParser */
/*jslint indent: 2, maxerr: 3, nomen: true, DOMParser */
(function (window, rJS, RSVP, UriTemplate, URI, Query, SimpleQuery,
ComplexQuery, jIO, DOMParser) {
"use strict";
var DIRTY_OLOH_LOOKUP_UNTIL_API_WORKS = {
"https://www.openhub.net/p/alfresco/analyses/latest/languages_summary": 62894263,
"https://www.openhub.net/p/swift-lang/analyses/latest/languages_summary": 755449,
"https://www.openhub.net/p/bluemind/analyses/latest/languages_summary": 857795,
"https://www.openhub.net/p/drupalcommerce/analyses/latest/languages_summary": 49743,
"https://www.openhub.net/p/obm/analyses/latest/languages_summary": 363914,
"https://www.openhub.net/p/linshare/analyses/latest/languages_summary": 185407,
"https://www.openhub.net/p/linid-directory-manager/analyses/latest/languages_summary": 725443,
"https://www.openhub.net/p/openpaas/analyses/latest/languages_summary": 228875,
"https://www.openhub.net/p/magento/analyses/latest/languages_summary": 13507099,
"https://www.openhub.net/p/mariadb/analyses/latest/languages_summary": 3163137,
"https://www.openhub.net/p/vscode/analyses/latest/languages_summary": 106972,
"https://www.openhub.net/p/mongodb/analyses/latest/languages_summary": 1734408,
"https://www.openhub.net/p/erp5/analyses/latest/languages_summary": 11685522,
"https://www.openhub.net/p/SlapOS/analyses/latest/languages_summary": 583328,
"https://www.openhub.net/p/wendelin/analyses/latest/languages_summary": 123904,
"https://www.openhub.net/p/renderjs/analyses/latest/languages_summary": 52261,
"https://www.openhub.net/p/odoo/analyses/latest/languages_summary": 2492373,
"https://www.openhub.net/p/mondrian/analyses/latest/languages_summary": 1319124,
"https://www.openhub.net/p/PrestaShop/analyses/latest/languages_summary": 539680,
"https://www.openhub.net/p/symfony/analyses/latest/languages_summary": 1480506,
"https://www.openhub.net/p/php-twig/analyses/latest/languages_summary": 22572,
"https://www.openhub.net/p/fabpots_Silex/analyses/latest/languages_summary": 11586,
"https://www.openhub.net/p/talend-studio/analyses/latest/languages_summary": 287512,
"https://www.openhub.net/p/xwiki/analyses/latest/languages_summary": 7909332
};
// XXX... lord have mercy
function mockupQueryParam(param, select_list) {
var wild_param = param.replace(/[()]/g,"%").replace(/ /g,''),
......@@ -41,6 +70,7 @@
gadget.jio_allDocs = gadget.state_parameter_dict.jio_storage.allDocs;
gadget.jio_get = gadget.state_parameter_dict.jio_storage.get;
gadget.jio_put = gadget.state_parameter_dict.jio_storage.put;
return gadget.jio_allDocs()
/////////////////////////////////////////////////////////////////
......@@ -72,16 +102,96 @@
})
.push(function () {
return gadget.jio_allDocs({
select_list: ['title', 'free_software_list', 'website'],
select_list: ['title', 'free_software_list', 'website', 'lines'],
query: 'portal_type: "publisher"'
});
})
/////////////////////////////////////////////////////////////////
// Create Statistic Sheets
/////////////////////////////////////////////////////////////////
.push(function (result_list) {
var uid = 1000,
publisher_list = result_list.data.rows,
statistic_list = [],
i_len = publisher_list.length,
i;
// OPENHUB LOOKUP?
// curl https://www.openhub.net/projects/{project_id}/analyses/latest.xml
function createStatisticSheet(my_publisher_row) {
var publisher = my_publisher_row.value.title,
software_list = my_publisher_row.value.free_software_list,
j_len = software_list.length,
profile_url,
software_analysis,
software_analysis_list = [],
j;
for (j = 0; j < j_len; j += 1) {
profile_url = software_list[j].source_code_profile;
if (profile_url && profile_url !== "") {
// more yuck
software_analysis = DIRTY_OLOH_LOOKUP_UNTIL_API_WORKS[profile_url];
delete DIRTY_OLOH_LOOKUP_UNTIL_API_WORKS[profile_url];
//software_analysis = jIO.util.ajax({
// type: "GET",
// "url": profile_url.replace("/languages_summary", ".xml")
//});
// prevent multiple entries into calculation
}
software_analysis_list.push(software_analysis || 0);
}
return new RSVP.Queue()
.push(function () {
return RSVP.all(software_analysis_list);
})
.push(function (my_stat_list) {
var parser = new DOMParser(),
line_total = 0,
xml,
k_len = my_stat_list.length,
k;
for (k = 0; k < k_len; k += 1) {
if (my_stat_list[k]) {
// xml = parser.parseFromString(my_stat_list[k],"text/xml");
//line_total += xml.getElementsByTagName("total_code_lines")[0]
// .childNodes[0].nodeValue;
line_total += my_stat_list[k];
}
}
// actually we need to store this...
return new RSVP.Queue()
.push(function () {
return gadget.jio_get(my_publisher_row.id);
})
.push(function (my_publisher) {
my_publisher.lines = line_total;
// my_publisher_row.value.lines = line_total.toString();
return gadget.jio_put(my_publisher.uid, my_publisher);
});
});
}
for (i = 0; i < i_len; i += 1) {
statistic_list.push(createStatisticSheet(publisher_list[i]));
}
return new RSVP.Queue()
.push(function() {
return RSVP.all(statistic_list);
})
.push(function () {
return result_list;
});
})
/////////////////////////////////////////////////////////////////
// Make Software datasheets
/////////////////////////////////////////////////////////////////
.push(function (publisher_list) {
var uid = 1000;
var uid = 2000;
function saveSoftwareListFromPublisher (j) {
var publisher = j.value.title,
......@@ -123,7 +233,7 @@
// Make Success Case datasheets
/////////////////////////////////////////////////////////////////
.push(function (software_list) {
var uid = 2000;
var uid = 3000;
function saveSuccessCaseListFromSoftware (softwareObject) {
var software = softwareObject.value,
......@@ -215,7 +325,6 @@
.declareMethod('allDocs', function (option_dict) {
option_dict.query = updateQuery(option_dict.query, option_dict.select_list);
//console.log(option_dict.query)
return this.state_parameter_dict.jio_storage.allDocs(option_dict);
})
.declareMethod('getAttachment', function (id, view) {
......@@ -230,4 +339,5 @@
.declareMethod('repair', function () {
return this.state_parameter_dict.jio_storage.repair();
});
}(window, rJS, RSVP, UriTemplate, URI, Query, SimpleQuery, ComplexQuery, jIO));
\ No newline at end of file
}(window, rJS, RSVP, UriTemplate, URI, Query, SimpleQuery, ComplexQuery, jIO,
DOMParser));
\ No newline at end of file
......@@ -214,7 +214,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.54647.15897.38860</string> </value>
<value> <string>959.36864.12643.63829</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1477645462.98</float>
<float>1495564514.77</float>
<string>UTC</string>
</tuple>
</state>
......
<!DOCTYPE html>
<!Doctype html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Panel</title>
<!-- renderjs -->
......@@ -33,6 +33,7 @@
<div class="ui-content">
<ul data-role="listview" class="ui-listview" data-enhanced="true">
<li class="ui-first-child"><a href="{{directory_href}}" class="ui-btn ui-btn-icon-left ui-icon-table" data-i18n="Directory" accesskey="d">Directory</a></li>
<li><a href="{{publisher_statistic_href}}" class="ui.btn ui-btn-icon-left ui-icon-trophy" data-i18n="Statistics" accesskey="t">Statistics</a></li>
<li><a href="{{publisher_href}}" class="ui-btn ui-btn-icon-left ui-icon-university" data-i18n="Publishers" accesskey="a">Publishers</a></li>
<li><a href="{{software_href}}" class="ui-btn ui-btn-icon-left ui-icon-cube" data-i18n="Software Products" accesskey="p">Software Products</a></li>
<li class="ui-last-child"><a href="{{success_case_href}}" class="ui-btn ui-btn-icon-left ui-icon-book" data-i18n="Success Cases" accesskey="s">Success Cases</a></li>
......
......@@ -218,7 +218,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>953.59442.42567.51370</string> </value>
<value> <string>959.35231.16537.4812</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1473845929.06</float>
<float>1495467668.61</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -26,6 +26,11 @@
g.props = {};
})
.setState({
visible: false,
desktop: false
})
//////////////////////////////////////////////
// acquired method
//////////////////////////////////////////////
......@@ -45,12 +50,14 @@
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod('toggle', function () {
this.props.element.classList.toggle('visible');
return this.changeState({
visible: !this.state.visible
});
})
.declareMethod('close', function () {
if (this.props.element.classList.contains('visible')) {
this.props.element.classList.remove('visible');
}
return this.changeState({
visible: false
});
})
.declareMethod('render', function () {
......@@ -59,19 +66,22 @@
.push(function () {
return RSVP.all([
g.getUrlFor({command: 'display', options: {page: "afs_directory"}}),
g.getUrlFor({command: 'display', options: {page: "afs_publisher_statistic"}}),
g.getUrlFor({command: 'display', options: {page: "afs_publisher_list"}}),
g.getUrlFor({command: 'display', options: {page: "afs_software_list"}}),
g.getUrlFor({command: 'display', options: {page: "afs_success_case_list"}})
]);
})
.push(function (all_result) {
// XXX: Customize panel header!
var tmp = panel_template_header();
tmp += panel_template_body({
"directory_href": all_result[0],
"publisher_href": all_result[1],
"software_href": all_result[2],
"success_case_href": all_result[3]
"publisher_statistic_href": all_result[1],
"publisher_href": all_result[2],
"software_href": all_result[3],
"success_case_href": all_result[4]
});
return tmp;
})
......@@ -81,28 +91,72 @@
});
})
.onStateChange(function (modification_dict) {
var context = this,
gadget = this,
queue = new RSVP.Queue(),
tmp_element;
if (modification_dict.hasOwnProperty("visible")) {
if (this.state.visible) {
if (!this.element.classList.contains('visible')) {
this.element.classList.toggle('visible');
}
} else {
if (this.element.classList.contains('visible')) {
this.element.classList.remove('visible');
}
}
}
})
/////////////////////////////////////////////////////////////////
// declared services
/////////////////////////////////////////////////////////////////
.declareService(function () {
var panel_gadget = this;
.onEvent('click', function (evt) {
if ((evt.target.nodeType === Node.ELEMENT_NODE) &&
(evt.target.tagName === 'BUTTON')) {
return this.toggle();
}
}, false, false)
function formSubmit() {
panel_gadget.toggle();
.declareJob('listenResize', function () {
// resize should be only trigger after the render method
// as displaying the panel rely on external gadget (for translation for example)
var result,
event,
context = this;
function extractSizeAndDispatch() {
if (window.matchMedia("(min-width: 85em)").matches) {
return context.changeState({
desktop: true
});
}
return new RSVP.Queue()
.push(function () {
return panel_gadget.props.render_deferred.promise;
})
.push(function () {
return loopEventListener(
panel_gadget.props.element.querySelector('button'),
'click',
false,
formSubmit
);
return context.changeState({
desktop: false
});
}
result = loopEventListener(window, 'resize', false,
extractSizeAndDispatch);
event = document.createEvent("Event");
event.initEvent('resize', true, true);
window.dispatchEvent(event);
return result;
})
});
.onEvent('blur', function (evt) {
// XXX Horrible hack to clear the search when focus is lost
// This does not follow renderJS design, as a gadget should not touch
// another gadget content
if (evt.target.type === 'search') {
evt.target.value = "";
}
}, true, false);
}(window, rJS, Handlebars, RSVP, loopEventListener));
......@@ -214,7 +214,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>953.59442.41619.45056</string> </value>
<value> <string>959.35236.20346.42359</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1473843061.58</float>
<float>1495466909.62</float>
<string>UTC</string>
</tuple>
</state>
......
<!DOCTYPE html>
<!Doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Router Gadget</title>
<!-- renderjs -->
......
......@@ -224,7 +224,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -238,7 +238,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>953.59443.17296.9233</string> </value>
<value> <string>953.59501.33025.63675</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -256,7 +256,7 @@
</tuple>
<state>
<tuple>
<float>1473843090.6</float>
<float>1495467674.51</float>
<string>UTC</string>
</tuple>
</state>
......
<!-- FRONT PAGE free_software_publisher_directory -->
<!DOCTYPE html>
<!Doctype html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Free Software Publisher Directory</title>
<link rel="stylesheet" href="gadget_erp5_afs.css" type="text/css" />
......@@ -44,6 +42,11 @@
</head>
<body>
<section class="ui-responsive body ui-masonry-container"></section>
<div data-gadget-url="gadget_erp5_page_afs_unsplash.html"
data-gadget-scope="unsplash"
data-gadget-sandbox="public">
</div>
<section class="ui-responsive ui-masonry-container"></section>
</body>
</html>
......@@ -218,7 +218,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>953.59440.13548.33757</string> </value>
<value> <string>959.30923.20910.41676</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1473842912.2</float>
<float>1495467655.24</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, RSVP, Handlebars, URI, console, jIO */
/*global window, rJS, RSVP, Handlebars, URI, console, jIO, document */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, Handlebars, URI) {
(function (window, rJS, RSVP, Handlebars, URI, document) {
"use strict";
var gadget_klass = rJS(window),
......@@ -38,29 +38,48 @@
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function () {
var gadget = this;
var gadget = this,
masonry_container = gadget.props.element.querySelector(
'.ui-masonry-container'
);
return gadget.updateHeader({
return new RSVP.Queue()
.push(function () {
return RSVP.all([
gadget.getDeclaredGadget("unsplash"),
gadget.updateHeader({
page_title: 'Free Software Publisher Directory'
})
.push(function () {
return gadget.jio_allDocs({
]);
})
.push(function (my_response_list) {
return RSVP.all([
gadget.jio_allDocs({
select_list: ['category_list'],
query: 'portal_type:"software"'
});
}),
my_response_list[0].render()
]);
})
.push(function (software_objects) {
var softwares = software_objects.data.rows,
categories = softwares.map( (obj) => obj.value.category_list ) // get all categories
.reduce( (cur, prev) => cur.concat(prev) ), // flatten array of category arrays
.push(function (my_response_list) {
var softwares = my_response_list[0].data.rows,
// get categories and flatten array of category arrays
categories = softwares.map( (obj) => obj.value.category_list )
.reduce( (cur, prev) => cur.concat(prev) ),
// remove duplicates (case sensitive!)
unique_categories = Array.from(new Set(categories));
unique_categories = Array.from(new Set(categories)),
// kudos: https://davidwalsh.name/convert-html-stings-dom-nodes
banner = document.createRange()
.createContextualFragment(my_response_list[1] || "");
gadget.element.insertBefore(banner, masonry_container);
return RSVP.all(unique_categories);
})
......@@ -89,11 +108,13 @@
return RSVP.all(softwares_by_category);
})
.push(function (result) {
var content;
// reverse sort categories by number of softwares
result.sort( (a, b) => b.softwares.length - a.softwares.length );
var content = template(result);
gadget.props.element.querySelector('.body').innerHTML = content;
content = template(result);
masonry_container.innerHTML = content;
});
});
}(window, rJS, RSVP, Handlebars, URI));
}(window, rJS, RSVP, Handlebars, URI, document));
......@@ -214,7 +214,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.25982.55518.32136</string> </value>
<value> <string>959.36500.38281.50158</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1475682893.37</float>
<float>1495541164.03</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -218,7 +218,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1477659759.71</float>
<float>1495467629.29</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -214,7 +214,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.58956.41140.25634</string> </value>
<value> <string>954.58958.53154.13363</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1477659768.61</float>
<float>1495468512.28</float>
<string>UTC</string>
</tuple>
</state>
......
<!DOCTYPE html>
<!Doctype html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Success Stories</title>
<!-- renderjs -->
<link rel="stylesheet" href="gadget_erp5_afs.css" />
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="handlebars.js" type="text/javascript"></script>
......
......@@ -218,7 +218,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>953.59446.3272.28245</string> </value>
<value> <string>959.35275.11438.17476</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1473843259.98</float>
<float>1495467682.0</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -218,7 +218,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>955.20607.54543.26555</string> </value>
<value> <string>955.20609.15320.31283</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1479290954.0</float>
<float>1495467648.49</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -90,7 +90,7 @@
})
.push(
function (my_content) {
var response = my_content.target.respons || my_content.target.responseText;
var response = my_content.target.response || my_content.target.responseText;
software.wikipedia_description = JSON.parse(response).extract;
return software;
}, function (my_error) {
......
......@@ -214,7 +214,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>955.20626.3055.426</string> </value>
<value> <string>955.20627.16103.45619</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1479292034.72</float>
<float>1495202159.37</float>
<string>UTC</string>
</tuple>
</state>
......
<!DOCTYPE html>
<!Doctype html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Software</title>
<!-- renderjs -->
<link rel="stylesheet" href="gadget_erp5_afs.css" />
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="handlebars.js" type="text/javascript"></script>
......
......@@ -218,7 +218,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>953.59438.4591.48964</string> </value>
<value> <string>959.35275.22570.50176</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1473842778.35</float>
<float>1495467641.69</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -218,7 +218,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.58729.24634.61081</string> </value>
<value> <string>954.58847.53110.31982</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1477653108.61</float>
<float>1495467620.79</float>
<string>UTC</string>
</tuple>
</state>
......
<!doctype html>
<!Doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Success Case List</title>
<link rel="stylesheet" href="gadget_erp5_afs.css" />
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_global.js" ></script>
......
......@@ -218,7 +218,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>953.59437.16732.31317</string> </value>
<value> <string>959.35275.49492.48435</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1473842727.51</float>
<float>1495467635.2</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -39,8 +39,6 @@
page_title: "Success Story List",
});
})
/*
*/
.push(function () {
return gadget.getDeclaredGadget("form_list");
})
......
......@@ -214,7 +214,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>953.40968.47393.12851</string> </value>
<value> <string>953.59497.55273.5171</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1473842686.96</float>
<float>1495468000.96</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -337,7 +337,7 @@
</item>
<item>
<key> <string>configuration_content_security_policy</string> </key>
<value> <string>default-src \'self\'; img-src \'self\' * data:; media-src \'self\' blob:; connect-src \'self\' https://en.wikipedia.org https://fr.wikipedia.org https://raw.githubusercontent.com https://api.github.com data:; script-src \'self\' \'unsafe-eval\'; font-src \'self\'; style-src \'self\' data:; frame-src \'self\' data:</string> </value>
<value> <string>default-src \'self\'; img-src \'self\' https://images.unsplash.com * data:; media-src \'self\' blob:; connect-src \'self\' https://api.unsplash.com https://en.wikipedia.org https://fr.wikipedia.org https://raw.githubusercontent.com https://api.github.com data:; script-src \'self\' \'unsafe-eval\'; font-src \'self\'; style-src \'self\' data:; frame-src \'self\' data:</string> </value>
</item>
<item>
<key> <string>configuration_default_view_action_reference</string> </key>
......@@ -600,7 +600,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -614,7 +614,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.57354.27103.3601</string> </value>
<value> <string>959.30886.17996.5358</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -632,7 +632,7 @@
</tuple>
<state>
<tuple>
<float>1477582226.31</float>
<float>1495226845.13</float>
<string>UTC</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