Commit 4d5d4c93 authored by Roque's avatar Roque

Fix dynamic appstore website

See merge request nexedi/erp5!1452
parents f3c88876 326a4c9a
Pipeline #16463 passed with stage
in 0 seconds
......@@ -3,7 +3,7 @@ from DateTime import DateTime
portal = context.getPortalObject()
preference_tool = portal.portal_preferences
software_product_list = portal.portal_catalog(portal_type='Software Product', validation_state='validated')
software_product_list = portal.portal_catalog(portal_type='Software Product', validation_state='validated', sort_on='creation_date')
appstore_data = []
logo_url_list = []
i = 0
......@@ -31,8 +31,8 @@ for software_product in software_product_list:
"application_image_type": 'image',
"application_image_url": logo.getReference(),
"application_toc_accept": 'true',
"application_published": 'some_date',
"application_submitted": 'other_date',
"application_published": web_section.getModificationDate().strftime("%m/%d/%Y"),
"application_submitted": web_section.getModificationDate().strftime("%m/%d/%Y"),
"application_description": data["description"] if "description" in data else data["name"],
"application_url": "%s://%s.%s/" % (preference_tool.getPreferredSystemAppstoreWildcardProtocol(),
app_domain,
......
......@@ -4621,8 +4621,19 @@
"url": "data/" + parcel.type + "_sample.json"
})
.then(function (e) {
var i, string_response,
app_list = JSON.parse(e.target.response),
site_tld = window.location.origin.split('.').pop();
// change all application urls TDL to current appstore site TDL
// e.g. if site is 'officejs.com' then all app urls will be '.com'
for (i = 0; i < app_list.length; i += 1) {
app_list[i].application_url = app_list[i].application_url.replace(
app_list[i].application_url.split('.').pop(), site_tld
);
}
string_response = JSON.stringify(app_list);
return {
"response": e.target.response,
"response": string_response,
"baggage": parcel.baggage
};
})
......
......@@ -76,7 +76,9 @@
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/js</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
......@@ -221,7 +223,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>P1</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -235,7 +237,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>970.31366.57108.55859</string> </value>
<value> <string>992.61706.2773.41130</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -253,7 +255,7 @@
</tuple>
<state>
<tuple>
<float>1537795617.18</float>
<float>1624541145.81</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