From a2df6f43efc20ec99c8b39727bf6d28c99c46350 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Tue, 14 Jun 2016 16:59:11 +0200 Subject: [PATCH] Fix apps-toggle shows wrong icon in mobile sidebox --- pixelegg/js/fw_mobile.js | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/pixelegg/js/fw_mobile.js b/pixelegg/js/fw_mobile.js index 131522b6ae..6504baf56c 100644 --- a/pixelegg/js/fw_mobile.js +++ b/pixelegg/js/fw_mobile.js @@ -354,26 +354,19 @@ this._super.apply(this,arguments); this.setSidebarState(this.activeApp.preferences.toggleMenu); var self = this; - var $apps = jQuery('#egw_fw_appsToggle'); var $user = jQuery('#egw_fw_userinfo .user'); var $avatar = jQuery('#egw_fw_userinfo .avatar img'); $avatar.attr('src', egw.webserverUrl + '/index.php?menuaction=addressbook.addressbook_ui.photo&account_id=' + egw.user('account_id')); + var $sidebar = jQuery('#egw_fw_sidebar'); $sidebar.removeClass('avatarSubmenu'); + this.updateAppsToggle(); // Open edit contact on click $avatar.off().on('click',function(){ $sidebar.toggleClass('avatarSubmenu',!$sidebar.hasClass('avatarSubmenu')); }); - $apps.attr('style',''); - $apps.off().on('click',function(){ - var $sidebar = jQuery('#'+egw.app_name()+'_sidebox_content'); - $sidebar.toggle(); - jQuery(this).css({ - 'background-image':'url('+egw.webserverUrl+'/' + ($sidebar.is(":visible")?'pixelegg/images/apps.svg':egw.app_name()+'/templates/mobile/images/navbar.svg)') - }); - }); }, @@ -630,6 +623,7 @@ applicationClickCallback: function(_sender) { this._super.apply(this,arguments); + framework.updateAppsToggle(); }, /** @@ -934,6 +928,21 @@ var index = _index || 1; history.pushState({type:_type, index:_index}, _type, '#'+ egw.app_name()+"."+_type); history.pushState({type:_type, index:_index}, _type, '#'+ egw.app_name()+"."+_type + '#' + index); + }, + + updateAppsToggle: function () + { + var $apps = jQuery('#egw_fw_appsToggle'); + var $sidebar = jQuery('#egw_fw_sidebar'); + $apps.attr('style',''); + $apps.off().on('click',function(){ + var $sidebar = jQuery('#'+egw.app_name()+'_sidebox_content'); + $sidebar.toggle(); + jQuery(this).css({ + 'background-image':'url('+egw.webserverUrl+'/' + ($sidebar.is(":visible")?'pixelegg/images/apps.svg':egw.app_name()+'/templates/mobile/images/navbar.svg)') + }); + + }); } });