Highlight the note or filter used in the side panel

This commit is contained in:
Matias De lellis
2021-08-03 09:35:05 -03:00
parent 72a175e5ef
commit f26bd6bfdd

View File

@@ -607,6 +607,7 @@ View.prototype = {
$('#all-notes').click(function () { $('#all-notes').click(function () {
event.preventDefault(); event.preventDefault();
self._cleanNavigation(); self._cleanNavigation();
$(this).addClass("active");
$('.notes-grid').isotope({ filter: '*'}); $('.notes-grid').isotope({ filter: '*'});
setFilterUrl(); setFilterUrl();
}); });
@@ -621,6 +622,7 @@ View.prototype = {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
self._cleanNavigation(); self._cleanNavigation();
$(this).addClass("active");
$('.notes-grid').isotope({ filter: function() { $('.notes-grid').isotope({ filter: function() {
return $(this).children().hasClass('shared'); return $(this).children().hasClass('shared');
} }); } });
@@ -631,6 +633,7 @@ View.prototype = {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
self._cleanNavigation(); self._cleanNavigation();
$(this).addClass("active");
$('.notes-grid').isotope({ filter: function() { $('.notes-grid').isotope({ filter: function() {
return $(this).children().hasClass('shareowner'); return $(this).children().hasClass('shareowner');
} }); } });
@@ -656,6 +659,7 @@ View.prototype = {
var color = $(this).css("background-color"); var color = $(this).css("background-color");
self._filterColor(color); self._filterColor(color);
setFilterUrl('c', color); setFilterUrl('c', color);
$(this).parent().addClass("active");
} }
else { else {
self.showAll(); self.showAll();
@@ -673,6 +677,7 @@ View.prototype = {
event.stopPropagation(); event.stopPropagation();
var id = parseInt($(this).parent().data('id'), 10); var id = parseInt($(this).parent().data('id'), 10);
self._cleanNavigation(); self._cleanNavigation();
$(this).addClass("active");
self._filterNote(id); self._filterNote(id);
setFilterUrl('n', id); setFilterUrl('n', id);
}); });
@@ -688,6 +693,7 @@ View.prototype = {
event.stopPropagation(); event.stopPropagation();
var tagId = parseInt($(this).parent().attr('tag-id'), 10); var tagId = parseInt($(this).parent().attr('tag-id'), 10);
self._cleanNavigation(); self._cleanNavigation();
$(this).addClass("active");
self._filterTag(tagId); self._filterTag(tagId);
setFilterUrl('t', tagId); setFilterUrl('t', tagId);
}); });
@@ -1052,6 +1058,10 @@ View.prototype = {
}); });
}, },
_cleanNavigation: function () { _cleanNavigation: function () {
var navItems = $('#app-navigation .active');
$.each(navItems, function(i, item) {
$(item).removeClass('active');
});
var oldColorTool = $('#app-navigation .circle-toolbar.icon-checkmark'); var oldColorTool = $('#app-navigation .circle-toolbar.icon-checkmark');
$.each(oldColorTool, function(i, oct) { $.each(oldColorTool, function(i, oct) {
$(oct).removeClass('icon-checkmark'); $(oct).removeClass('icon-checkmark');