From 8d55014364025fd446a3664ddbf22ba30f984edb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 16 Sep 2015 18:52:15 +0200 Subject: [PATCH] gadjo: add progressive rendering of publik menu (#7996) --- data/themes/gadjo/static/js/agent-portal.js | 7 +++++++ data/themes/gadjo/static/js/publik.js | 17 ++++------------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/data/themes/gadjo/static/js/agent-portal.js b/data/themes/gadjo/static/js/agent-portal.js index 15610f7..132b5a2 100644 --- a/data/themes/gadjo/static/js/agent-portal.js +++ b/data/themes/gadjo/static/js/agent-portal.js @@ -1,5 +1,12 @@ $(function() { $(document).on('publik:environment-loaded', function(event, services) { + /* empty all apps cells */ + var service_ids = Array('authentic', 'wcs', 'combo', 'passerelle', 'hobo'); + $(service_ids).each(function(index, service_id) { + $('#portal-agent-content div.services-' + service_id + ' ul.apps').empty(); + }); + $('#portal-agent-content div.services ul.apps').empty(); + /* and fill them with current services */ $(services.services).each(function(index, element) { var $content = $('#portal-agent-content div.services-' + element.service_id); if ($content.length === 0) { diff --git a/data/themes/gadjo/static/js/publik.js b/data/themes/gadjo/static/js/publik.js index 46a29f8..ce937a1 100644 --- a/data/themes/gadjo/static/js/publik.js +++ b/data/themes/gadjo/static/js/publik.js @@ -4,19 +4,10 @@ $(function() { var all_done = false; function check_all_done() { - var local_done = true; - $(COMBO_KNOWN_SERVICES).each(function(index, service) { - if (service.data === undefined) { - local_done = false; - } - }); - all_done = local_done; - if (all_done) { - window.sessionStorage.hobo_environment = JSON.stringify(COMBO_KNOWN_SERVICES); - window.sessionStorage.hobo_environment_timestamp = Date.now(); - create_menu_items(); - $(document).trigger('publik:environment-loaded', {services: COMBO_KNOWN_SERVICES}); - } + window.sessionStorage.hobo_environment = JSON.stringify(COMBO_KNOWN_SERVICES); + window.sessionStorage.hobo_environment_timestamp = Date.now(); + create_menu_items(); + $(document).trigger('publik:environment-loaded', {services: COMBO_KNOWN_SERVICES}); } function create_menu_items() { -- 2.5.1