From 6537acb11f0e3d0d7b75b95451e304f35af3d474 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 20 May 2015 16:12:29 +0000 Subject: [PATCH] Highlight currently selected favorite --- phpgwapi/js/jsapi/app_base.js | 24 ++++++++++++++++++++++-- pixelegg/css/mobile.css | 9 +++++++++ pixelegg/css/pixelegg.css | 9 +++++++++ pixelegg/less/etemplate2.less | 10 +++++++++- 4 files changed, 49 insertions(+), 3 deletions(-) diff --git a/phpgwapi/js/jsapi/app_base.js b/phpgwapi/js/jsapi/app_base.js index 3e778d8b38..d6a3dc1f5f 100644 --- a/phpgwapi/js/jsapi/app_base.js +++ b/phpgwapi/js/jsapi/app_base.js @@ -363,9 +363,17 @@ var AppJS = Class.extend( sidebox .off() // removed .on("mouse(enter|leave)" (wrapping trash icon), as it stalls delete in IE11 - .on("click","div.ui-icon-trash", this, this.delete_favorite) + .on("click.sidebox","div.ui-icon-trash", this, this.delete_favorite) // need to install a favorite handler, as we switch original one off with .off() - .on('click','li[data-id]', this, function(event) { + .on('click.sidebox','li[data-id]', this, function(event) { + var li = $j(this); + li.siblings().removeClass('ui-state-highlight'); + + // Wait an arbitrary 50ms to avoid having the class removed again + // by the change handler. + window.setTimeout(function() { + li.addClass('ui-state-highlight'); + },50); var href = jQuery('a[href^="javascript:"]', this).prop('href'); var matches = href ? href.match(/^javascript:([^\(]+)\((.*)?\);?$/) : null; if (matches && matches.length > 1 && matches[2] !== undefined) @@ -401,6 +409,18 @@ var AppJS = Class.extend( self._refresh_fav_nm(); } }); + + // Bind favorite de-select + var egw_fw = egw_getFramework(); + if(egw_fw && egw_fw.applications[this.appname] && egw_fw.applications[this.appname].browser + && egw_fw.applications[this.appname].browser.baseDiv) + { + $j(egw_fw.applications[this.appname].browser.baseDiv) + .off('.sidebox') + .on('change.sidebox', function() { + $j('li',self.sidebox).removeClass('ui-state-highlight'); + }); + } return true; } return false; diff --git a/pixelegg/css/mobile.css b/pixelegg/css/mobile.css index e3b93e1661..726c051aa6 100644 --- a/pixelegg/css/mobile.css +++ b/pixelegg/css/mobile.css @@ -1139,6 +1139,15 @@ background-size: 12px 12px; background-position: 0 0; } + .sidebox-favorites ul.favorites li.ui-menu-item.ui-state-highlight { + color: #000000; + background: #9b6ad6; + padding: 3px 0; + border: none; + } + .sidebox-favorites ul.favorites li.ui-menu-item.ui-state-highlight a { + color: #ffffff; + } .sidebox-favorites ul.favorites li:first-child a div.ui-icon-heart { background-image: url(../images/trash.png); background-size: 12px 12px; diff --git a/pixelegg/css/pixelegg.css b/pixelegg/css/pixelegg.css index 546a2cbc9a..f5bae95e94 100644 --- a/pixelegg/css/pixelegg.css +++ b/pixelegg/css/pixelegg.css @@ -1128,6 +1128,15 @@ background-size: 12px 12px; background-position: 0 0; } + .sidebox-favorites ul.favorites li.ui-menu-item.ui-state-highlight { + color: #000000; + background: #9b6ad6; + padding: 3px 0; + border: none; + } + .sidebox-favorites ul.favorites li.ui-menu-item.ui-state-highlight a { + color: #ffffff; + } .sidebox-favorites ul.favorites li:first-child a div.ui-icon-heart { background-image: url(../images/trash.png); background-size: 12px 12px; diff --git a/pixelegg/less/etemplate2.less b/pixelegg/less/etemplate2.less index fc24da1675..acd637fefc 100755 --- a/pixelegg/less/etemplate2.less +++ b/pixelegg/less/etemplate2.less @@ -1009,7 +1009,7 @@ button#admin-categories-index_add { a{color: @gray_100;} } - + a{ @@ -1045,7 +1045,15 @@ button#admin-categories-index_add { } // Ende li + li.ui-menu-item.ui-state-highlight { + .color_100_gray; + background: @egw_color_3_e; + padding: 3px 0; + border: none; + a{color: @gray_0;} + + } // Filter aufheben li:first-child{ a div.ui-icon-heart {background-image: url(../images/trash.png); background-size: 12px 12px;background-position: 0 0;}