diff --git a/js/app/map/map.js b/js/app/map/map.js index 07178811..070738d7 100644 --- a/js/app/map/map.js +++ b/js/app/map/map.js @@ -35,6 +35,7 @@ define([ systemLockedClass: 'pf-system-locked', // class for locked systems on a map systemHeadClass: 'pf-system-head', // class for system head systemHeadNameClass: 'pf-system-head-name', // class for system name + systemHeadCounterClass: 'pf-system-head-counter', // class for system user counter systemHeadExpandClass: 'pf-system-head-expand', // class for system head expand arrow systemHeadInfoClass: 'pf-system-head-info', // class for system info systemBodyClass: 'pf-system-body', // class for system body @@ -125,16 +126,21 @@ define([ * @param map * @param data * @param currentUserIsHere boolean - if the current user is in this system + * @param options */ - $.fn.updateSystemUserData = function(map, data, currentUserIsHere){ + $.fn.updateSystemUserData = function(map, data, currentUserIsHere, options){ let system = $(this); let systemId = system.attr('id'); + let compactView = Util.getObjVal(options, 'compactView'); + + // find countElement -> minimizedUI + let systemCount = system.find('.' + config.systemHeadCounterClass); // find system body - let systemBody = $( system.find('.' + config.systemBodyClass) ); + let systemBody = system.find('.' + config.systemBodyClass); // find expand arrow - let systemHeadExpand = $( system.find('.' + config.systemHeadExpandClass) ); + let systemHeadExpand = system.find('.' + config.systemHeadExpandClass); let oldCacheKey = system.data('userCache'); let oldUserCount = system.data('userCount'); @@ -154,6 +160,11 @@ define([ data.user ){ let cacheArray = []; + + // we need to add "view mode" option to key + // -> if view mode change detected -> key no longer valid + cacheArray.push(compactView ? 'compact' : 'default'); + // loop all active pilots and build cache-key for(let i = 0; i < data.user.length; i++){ userCounter++; @@ -171,71 +182,73 @@ define([ // remove all content systemBody.empty(); - // loop "again" and build DOM object with user information - for(let j = 0; j < data.user.length; j++){ - let userData = data.user[j]; + if(compactView){ + // compact system layout-> pilot count shown in systemHead + systemCount.text(userCounter); - let statusClass = Util.getStatusInfoForCharacter(userData, 'class'); - let userName = userData.name; + system.toggleSystemTooltip('destroy', {}); + systemHeadExpand.hide(); + system.toggleBody(false, map, {}); - let item = $('