From 523110bff982b669d91f238fa9981427ebe92479 Mon Sep 17 00:00:00 2001 From: Sven Franck <sven.franck@nexedi.com> Date: Fri, 28 Oct 2016 13:35:34 +0000 Subject: [PATCH] erp5_officejs_afs_directory: clean up page layout, provide fallback images integrate wikipedia content --- .../gadget_erp5_page_afs_publisher_html.html | 76 +++++++++---- .../gadget_erp5_page_afs_publisher_html.xml | 4 +- .../gadget_erp5_page_afs_publisher_js.js | 103 ++++++++++++++---- .../gadget_erp5_page_afs_publisher_js.xml | 4 +- .../gadget_erp5_page_afs_software_html.html | 5 +- .../gadget_erp5_page_afs_software_html.xml | 4 +- .../gadget_erp5_page_afs_software_js.js | 55 +++++++--- .../gadget_erp5_page_afs_software_js.xml | 4 +- ...adget_erp5_page_afs_success_case_html.html | 55 +++++++--- ...gadget_erp5_page_afs_success_case_html.xml | 4 +- .../gadget_erp5_page_afs_success_case_js.js | 17 +-- .../gadget_erp5_page_afs_success_case_js.xml | 4 +- 12 files changed, 241 insertions(+), 94 deletions(-) diff --git a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_html.html b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_html.html index 7b8500374a..65a7dc797c 100644 --- a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_html.html +++ b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_html.html @@ -22,18 +22,18 @@ </li> <li> <h1>{{title}}</h1> - <p>{{description}}</p> + {{#if wikipedia_description}} + <p>{{wikipedia_description}}</p> + {{/if}} + <br/> {{#if wikipedia_url}} - <p>Profile: <a href="{{wikipedia_url}}">Wikipedia</a></p> + <p><a href="{{wikipedia_url}}" class="">Read more on Wikipedia</a></p> {{/if}} <ul> <li>Founded: {{founded_year}}</li> <li>Country: {{country}}</li> <li>Website: <a href="{{website}}">{{website}}</a></li> - <li>Presence: - {{#each presence}} - {{this}} - {{/each}} + <li>Presence: {{#each presence}}{{this}} {{/each}} </li> </ul> </li> @@ -56,7 +56,14 @@ </li> <li> <h1>{{title}}</h1> - <p>{{description}}</p> + {{#if wikipedia_description}} + <p>{{wikipedia_description}}</p> + <br/> + {{/if}} + {{#if wikipedia_url}} + <p><a href="{{wikipedia_url}}" class="">Read more on Wikipedia</a></p> + <br/> + {{/if}} <div> <ul class="custom-success-story-category-list"><lh>Categories:</lh> {{#each category_list}} @@ -64,18 +71,47 @@ {{/each}} </ul> </div> - <p>Source Code: <a href="{{source_code_download}}">Download</a></p> - <p>Free software Commercial Support: - {{#if commercial_support}} - <a href="{{commercial_support}}"> Yes</a> - {{else}} - No - {{/if}} - <abbr title="{{commercial_support_description}}">(?)</abbr> - </p> - {{#if wikipedia_url}} - <p><a href="{{wikipedia_url}}" class="">Wikipedia page</a></p> - {{/if}} + <table class="custom-link-table"> + <tbody> + <tr> + <td>Publisher Site</td> + <td><a href="{{publisher_website}}">{{publisher}}</a></td> + </tr> + <tr> + <td>Product Site</td> + <td><a href="{{website}}">{{title}}</a></td> + </tr> + <tr> + <td>Source Code</td> + <td> + {{#if source_code_download}} + <a href="{{source_code_download}}">Download</a> + {{else}} + <a class="ui-disabled" href="">Download</a> + {{/if}} + / + {{#if source_code_profile}} + <a href="{{source_code_profile}}">Profile</a> + {{else}} + <a class="ui-disabled" href="">Profile</a> + {{/if}} + </td> + </tr> + <tr> + <td>Free Software Commercial Support</td> + <td> + {{#if commercial_support}} + <a href="{{commercial_support}}"> Yes</a> + {{#if commercial_support_description}} + <abbr title="{{commercial_support_description}}">(?)</abbr> + {{/if}} + {{else}} + No + {{/if}} + </td> + </tr> + </tbody> + </table> </li> </ul> <section class="ui-content-header-plain ui-bar-c"> @@ -86,7 +122,7 @@ {{#each success_case_list}} <li> {{#if image}} - <div class="custom-success-story-image-wrapper"><a href="{{url}}"><img src="{{image}}" alt></a></div> + <div class="custom-success-story-image-wrapper {{image_class}}"><a href="{{url}}"><img src="{{image}}" alt></a></div> {{else}} <div> </div> {{/if}} diff --git a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_html.xml b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_html.xml index 24787553a1..1349101768 100644 --- a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_html.xml +++ b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_html.xml @@ -232,7 +232,7 @@ </item> <item> <key> <string>serial</string> </key> - <value> <string>953.59435.64998.47581</string> </value> + <value> <string>954.58644.17552.59852</string> </value> </item> <item> <key> <string>state</string> </key> @@ -250,7 +250,7 @@ </tuple> <state> <tuple> - <float>1473842670.79</float> + <float>1477659759.71</float> <string>UTC</string> </tuple> </state> diff --git a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_js.js b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_js.js index 85b7c02bf6..f73f58bc96 100644 --- a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_js.js +++ b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_js.js @@ -1,14 +1,29 @@ -/*globals window, RSVP, rJS, Handlebars*/ +/*globals window, RSVP, rJS, Handlebars, jIO*/ /*jslint indent: 2, nomen: true, maxlen: 80*/ -(function (window, RSVP, rJS, Handlebars) { +(function (window, RSVP, rJS, Handlebars, jIO) { "use strict"; - + + var PLACEHOLDER = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAACWCAYAAACb3McZAAANRUlEQVR4Xu2dB1cbOReGBaGEEloCGEglYVPI7v7/37GFEBJS6SmUUG3CnncSnU+fMuMyHln3jl+d42MHezTSe/XkSiPpqufq6urKMFEBKpCq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/7r7mprPGfsNv9G8JtRQJSD1Ymv1Ogrgsw/8UyPIKkryFGg9Sr2Gxa6UbO+lA+OqK9yC6mwNLr10BAqLdgix/UAUISFB5mbl2BQiIdguy/EEV+A9Em3PVuGWDlwAAAABJRU5ErkJggg=="; + var gadget_klass = rJS(window), templater = gadget_klass.__template_element, display_widget_table = Handlebars.compile( templater.getElementById("display-template").innerHTML ); - + + function clean(case_list) { + var i, + len, + entry; + for (i = 0, len = case_list.length; i < len; i += 1) { + entry = case_list[i]; + if (entry.image === "N/A" || entry.image === "") { + entry.image = PLACEHOLDER; + entry.image_class = "custom-placeholder"; + } + } + return case_list; + } rJS(window) .ready(function (g) { @@ -24,35 +39,77 @@ .declareMethod('render', function (options) { var gadget = this; + return new RSVP.Queue() .push(function () { return gadget.jio_get(options.jio_key); }) .push(function (publisher) { - gadget.updateHeader({ - page_title: publisher.title, - }); + // https://en.wikipedia.org/api/rest_v1/ + // only works in for english + var wikipedia_api_url = 'https://en.wikipedia.org/api/rest_v1/page/summary/', + wiki_list = []; - publisher.free_software_list.map(function (sw) { - if (sw.commercial_support === "N/A") { - delete sw.commercial_support; + publisher.free_software_list.map(function (software) { + if (software.commercial_support === "N/A") { + delete software.commercial_support; } - - if (sw.wikipedia_url === "N/A") { - delete sw.wikipedia_url; + if (software.logo === "N/A" || software.logo === "") { + software.logo = PLACEHOLDER; } - - if (sw.success_case_list.length === 0 || - sw.success_case_list === "N/A" || - sw.success_case_list[0].title === "N/A" || - sw.success_case_list[0].title === "") { - delete sw.success_case_list; + if (software.success_case_list.length === 0 || + software.success_case_list === "N/A" || + software.success_case_list[0].title === "N/A" || + software.success_case_list[0].title === "") { + delete software.success_case_list; + } else { + software.success_case_list = clean(software.success_case_list); } + if (software.wikipedia_url == "N/A") { + delete software.wikipedia_url; + } else { + wiki_list.push( + new RSVP.Queue() + .push(function () { + return jIO.util.ajax({ + type: "GET", + headers: {"api-user-agent": "https://www.nexedi.com/contact"}, + url: wikipedia_api_url + software.wikipedia_url.split("/").pop() + }); + }) + .push( + function (my_content) { + var response = my_content.target.respons || my_content.target.responseText; + return JSON.parse(response).extract; + }, function (my_error) { + return undefined; + } + ) + ); + } }); - - var content = display_widget_table(publisher); + + return new RSVP.Queue() + .push(function () { + return RSVP.all(wiki_list); + }) + .push(function (my_wiki_list) { + var i, len; + if (my_wiki_list && my_wiki_list.length > 0) { + for (i = 0, len = publisher.free_software_list.length; i < len; i += 1) { + if (publisher.free_software_list[i].wikipedia_url) { + publisher.free_software_list[i].wikipedia_description = my_wiki_list[i]; + } + } + } + return publisher; + }); + }) + .push(function (my_publisher) { gadget.props.element.querySelector(".display-widget") - .innerHTML = content; + .innerHTML = display_widget_table(my_publisher); + + return gadget.updateHeader({page_title: my_publisher.title}); }); }); -}(window, RSVP, rJS, Handlebars)); \ No newline at end of file +}(window, RSVP, rJS, Handlebars, jIO)); diff --git a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_js.xml b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_js.xml index 912c3a89ad..9a86e27f8a 100644 --- a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_js.xml +++ b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_publisher_js.xml @@ -228,7 +228,7 @@ </item> <item> <key> <string>serial</string> </key> - <value> <string>953.40686.63116.10461</string> </value> + <value> <string>954.58956.41140.25634</string> </value> </item> <item> <key> <string>state</string> </key> @@ -246,7 +246,7 @@ </tuple> <state> <tuple> - <float>1473842612.5</float> + <float>1477659768.61</float> <string>UTC</string> </tuple> </state> diff --git a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_software_html.html b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_software_html.html index ed4e6cd8e3..124d926083 100644 --- a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_software_html.html +++ b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_software_html.html @@ -23,7 +23,10 @@ </li> <li> <h1>{{title}}</h1> - <p>{{description}}</p> + {{#if wikipedia_description}} + <p>{{wikipedia_description}}</p> + <br/> + {{/if}} {{#if wikipedia_url}} <p><a href="{{wikipedia_url}}" class="">Read more on Wikipedia</a></p> {{/if}} diff --git a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_software_html.xml b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_software_html.xml index 953b6ae36a..d63ad649f5 100644 --- a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_software_html.xml +++ b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_software_html.xml @@ -232,7 +232,7 @@ </item> <item> <key> <string>serial</string> </key> - <value> <string>954.54725.34098.27528</string> </value> + <value> <string>954.57651.20561.29371</string> </value> </item> <item> <key> <string>state</string> </key> @@ -250,7 +250,7 @@ </tuple> <state> <tuple> - <float>1477405871.59</float> + <float>1477583198.23</float> <string>UTC</string> </tuple> </state> diff --git a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_software_js.js b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_software_js.js index 4447bef90b..673573ce32 100644 --- a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_software_js.js +++ b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_software_js.js @@ -1,6 +1,6 @@ -/*globals window, RSVP, rJS, Handlebars*/ +/*globals window, RSVP, rJS, Handlebars, jIO*/ /*jslint indent: 2, nomen: true, maxlen: 80*/ -(function (window, RSVP, rJS, Handlebars) { +(function (window, RSVP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1FXFD8z1ysmGKCLEhcOFyPkQUH50IKbd+5M8sah6Qtbc9a8u4/Ls5dmDYvjDoGsWX3B9k+AD4c/vilTQ14eUAFXC+C2/hPptKgkQJHUt4rIf/tpj2JSgPFhcP/HNDOzDqnAvW8SRowkuAQBUiWN8nyFkK4ztlsuu+yLFAsJK4isRYmpllFjAdxC+c3/kb/7r7mprPGfsNv9G8JtRQJSD1Ymv1Ogrgsw/8UyPIKkryFGg9Sr2Gxa6UbO+lA+OqK9yC6mwNLr10BAqLdgix/UAUISFB5mbl2BQiIdguy/EEV+A9Em3PVuGWDlwAAAABJRU5ErkJggg=="; @@ -38,29 +38,23 @@ .declareAcquiredMethod('jio_get', 'jio_get') .declareMethod('render', function (options) { - var gadget = this, - content; + var gadget = this; return new RSVP.Queue() .push(function () { return gadget.jio_get(options.jio_key); }) .push(function (software) { - gadget.updateHeader({ - page_title: software.title, - }); - + // https://en.wikipedia.org/api/rest_v1/ + // only works in for english + var wikipedia_api_url = 'https://en.wikipedia.org/api/rest_v1/page/summary/'; + if (software.logo === "N/A" || software.logo === "") { software.logo = PLACEHOLDER; } - if (software.commercial_support == "N/A") { delete software.commercial_support; } - if (software.wikipedia_url == "N/A") { - delete software.wikipedia_url; - } - if (software.success_case_list.length === 0 || software.success_case_list === "N/A" || software.success_case_list[0].title === "N/A" || @@ -69,10 +63,37 @@ } else { software.success_case_list = clean(software.success_case_list); } - - content = display_widget_table(software); + if (software.wikipedia_url == "N/A") { + delete software.wikipedia_url; + return software; + } + + return new RSVP.Queue() + .push(function () { + return jIO.util.ajax({ + type: "GET", + headers: {"api-user-agent": "https://www.nexedi.com/contact"}, + url: wikipedia_api_url + software.wikipedia_url.split("/").pop() + }); + }) + .push( + function (my_content) { + var response = my_content.target.respons || my_content.target.responseText; + software.wikipedia_description = JSON.parse(response).extract; + return software; + }, function (my_error) { + // console.log(my_error) + // 404 or not allowed, swallow + return software; + }); + + }) + .push(function (my_software) { gadget.props.element.querySelector(".display-widget") - .innerHTML = content; + .innerHTML = display_widget_table(my_software); + + return gadget.updateHeader({page_title: my_software.title}); }); }); -}(window, RSVP, rJS, Handlebars)); \ No newline at end of file +}(window, RSVP, rJS, Handlebars, jIO)); + diff --git a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_software_js.xml b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_software_js.xml index c1fa0bd795..fe9b1ce5b2 100644 --- a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_software_js.xml +++ b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_software_js.xml @@ -228,7 +228,7 @@ </item> <item> <key> <string>serial</string> </key> - <value> <string>954.54720.14802.56064</string> </value> + <value> <string>954.57702.11675.11332</string> </value> </item> <item> <key> <string>state</string> </key> @@ -246,7 +246,7 @@ </tuple> <state> <tuple> - <float>1477405742.66</float> + <float>1477584428.71</float> <string>UTC</string> </tuple> </state> diff --git a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_success_case_html.html b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_success_case_html.html index 3920514384..d81f5e6d6f 100644 --- a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_success_case_html.html +++ b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_success_case_html.html @@ -17,23 +17,50 @@ <section class="ui-grid-container ui-responsive"> <h1>{{title}}</h1> {{#if image}} - <div class="custom-success-story-image-wrapper"><a href="{{url}}"><img src="{{image}}" alt></a></div> + <div class="custom-success-story-image-wrapper {{image_class}}"><a href="{{url}}"><img src="{{image}}" alt></a></div> {{else}} <div> </div> {{/if}} - - <p class="custom-success-story-description">{{description}} <a href="{{url}}">Read more</a></p> - <p>Industry: {{industry}}</p> - <ul class="custom-success-story-category-list"><lh>Categories:</lh> - {{#each ../category_list}} - <li>{{this}}</li> - {{/each}} - </ul> - <p class="custom-success-story-client">Customer: <span>{{customer}}</span></p> - <p>Country: {{country}}</p> - <p>Language: {{language}}</p> - <p>Software: {{software}}</p> - <p>Publisher: {{publisher}}</p> + <p class="custom-success-story-description">{{description}} <a href="{{url}}">Read More</a></p> + + <table class="custom-link-table"> + <tbody> + <tr> + <td>Categories</td> + <td> + <ul class="custom-success-story-category-list"> + {{#each category_list}} + <li>{{this}}</li> + {{/each}} + </ul> + </td> + </tr> + <tr> + <td class="custom-success-story-client">Customer</td> + <td><b>{{customer}}</b></td> + </tr> + <tr> + <td>Industry</td> + <td>{{industry}}</td> + </tr> + <tr> + <td>Country</td> + <td>{{country}}</td> + </tr> + <tr> + <td>Language</td> + <td>{{language}}</td> + </tr> + <tr> + <td>Product Site</td> + <td><a href="{{software_website}}">{{software}}</a></td> + </tr> + <tr> + <td>Publisher Site</td> + <td><a href="{{publisher_website}}">{{publisher}}</a></td> + </tr> + </tbody> + </table> </section> </script> diff --git a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_success_case_html.xml b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_success_case_html.xml index 1f3c8bfaa0..720b223f05 100644 --- a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_success_case_html.xml +++ b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_success_case_html.xml @@ -232,7 +232,7 @@ </item> <item> <key> <string>serial</string> </key> - <value> <string>953.59434.58669.54784</string> </value> + <value> <string>954.58729.24634.61081</string> </value> </item> <item> <key> <string>state</string> </key> @@ -250,7 +250,7 @@ </tuple> <state> <tuple> - <float>1473842594.93</float> + <float>1477653108.61</float> <string>UTC</string> </tuple> </state> diff --git a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_success_case_js.js b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_success_case_js.js index 1bf5327804..fd35b342c5 100644 --- a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_success_case_js.js +++ b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_success_case_js.js @@ -3,13 +3,14 @@ (function (window, RSVP, rJS, Handlebars) { "use strict"; + var PLACEHOLDER = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAACWCAYAAACb3McZAAANRUlEQVR4Xu2dB1cbOReGBaGEEloCGEglYVPI7v7/37GFEBJS6SmUUG3CnncSnU+fMuMyHln3jl+d42MHezTSe/XkSiPpqufq6urKMFEBKpCqQA8BYcugAtkKEBC2DipQRwECwuZBBQgI2wAVyKcAPUg+3XhVlyhAQLrE0KxmPgUISD7deFWXKEBAusTQrGY+BQhIPt14VZcoQEC6xNCsZj4FCEg+3XhVlyhAQLrE0KxmPgUISD7deFWXKEBASmroz5+/mLOzs+C1m5ycMMPDw8HvE+sGBCSW8oHv++bNO3NwcBj4LsbcvXvbTE1NBr9PrBsQkFjKB74vASlGYAJSjI7iciEgxZiEgBSjo7hcCEgxJiEgxegoLhcCUoxJCEgxOorLhYAUYxICUoyO4nIhIMWYhIAUo6O4XAhIMSYhIMXoKC4XAlKMSQhIMTqKy4WAFGOSUgNyeXlpqtWq6cbQeBsbm+bbt+NiWkmdXDiTHlzi4m4AGPb3D5LX6emZ+f79e3GZM6dUBW7cGDXz83NmaOh6KRUqhQcBGFtbO+bLl6+lNJKGSo2N3TCzs9NmZGREQ3GbLqN6QLBqdWNji96iaZOH/SE8yv37d821a9fC3qhDuasGZHt7x2xv73ZIKt6mWQWGh4fMw4cPSgGJWkA2N7fN7u5eszbj7zqsQFkgUQkIBuFv377vsMl5u1YVGBoaMktLi6a3t7fVS8X8Xh0gFxcXZnV1zVxe8gmVmFZUpyBzc5Vk8K41qQPk/fuPfFqlq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uY93CdcXT0GsY05a5DuQoHPdgDvzonwUW/g1p4z+3pzIGlexB2wu/MiBOTnIkS/m+XC4I5JfO9hl6D4a7ly2pWXFaBA2hos281yG7//FMv1HGlLUAooWq4sog3S3e6QCwg+uxODWZOFjRYv5lKDFxWiQDPdLPeRrg8HJwp/mqHeOizXW6R5DgJSSFsOkkkWIGmehEtNGpigESTu0yp39pxzIEHadqGZZo1FXFD8z1ysmGKCLEhcOFyPkQUH50IKbd+5M8sah6Qtbc9a8u4/Ls5dmDYvjDoGsWX3B9k+AD4c/vilTQ14eUAFXC+C2/hPptKgkQJHUt4rIf/tpj2JSgPFhcP/HNDOzDqnAvW8SRowkuAQBUiWN8nyFkK4ztlsuu+yLFAsJK4isRYmpllFjAdxC+c3/kb/7r7mprPGfsNv9G8JtRQJSD1Ymv1Ogrgsw/8UyPIKkryFGg9Sr2Gxa6UbO+lA+OqK9yC6mwNLr10BAqLdgix/UAUISFB5mbl2BQiIdguy/EEV+A9Em3PVuGWDlwAAAABJRU5ErkJggg=="; + var gadget_klass = rJS(window), templater = gadget_klass.__template_element, display_widget_table = Handlebars.compile( templater.getElementById("display-template").innerHTML ); - rJS(window) .ready(function (g) { g.props = {}; @@ -29,13 +30,15 @@ return gadget.jio_get(options.jio_key); }) .push(function (story) { - gadget.updateHeader({ - page_title: story.title, - }); - - var content = display_widget_table(story); + console.log(story) + if (story.image === "N/A" || story.image === "") { + story.image = PLACEHOLDER; + story.image_class = "custom-placeholder"; + } + gadget.props.element.querySelector(".display-widget") - .innerHTML = content; + .innerHTML = display_widget_table(story); + return gadget.updateHeader({page_title: story.title}); }); }); }(window, RSVP, rJS, Handlebars)); \ No newline at end of file diff --git a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_success_case_js.xml b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_success_case_js.xml index 50d0b5a590..5f58d1eac3 100644 --- a/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_success_case_js.xml +++ b/bt5/erp5_officejs_afs_directory/PathTemplateItem/web_page_module/gadget_erp5_page_afs_success_case_js.xml @@ -228,7 +228,7 @@ </item> <item> <key> <string>serial</string> </key> - <value> <string>953.59444.54208.4488</string> </value> + <value> <string>954.57730.56023.48657</string> </value> </item> <item> <key> <string>state</string> </key> @@ -246,7 +246,7 @@ </tuple> <state> <tuple> - <float>1473843213.7</float> + <float>1477644942.36</float> <string>UTC</string> </tuple> </state> -- 2.30.9