Highlight currently selected favorite

This commit is contained in:
Nathan Gray 2015-05-20 16:12:29 +00:00
parent c41156c47c
commit 6537acb11f
4 changed files with 49 additions and 3 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;}