From 738d8a976693e7d30547a8a1ffaab6a72f56d934 Mon Sep 17 00:00:00 2001 From: Matias De lellis Date: Fri, 8 Nov 2019 09:22:22 -0300 Subject: [PATCH] Implement filter by tags in navigation bar --- js/script.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/js/script.js b/js/script.js index 77df9f0..6fc8235 100644 --- a/js/script.js +++ b/js/script.js @@ -734,7 +734,16 @@ View.prototype = { $('#app-navigation .nav-tag > a').click(function (event) { event.stopPropagation(); - $('.notes-grid').isotope({ filter: '*'}); + var tagId = parseInt($(this).parent().data('id'), 10); + $('.notes-grid').isotope({ filter: function() { + var match = false; + $(this).find(".slim-tag").siblings().addBack().each(function() { + var id = parseInt($(this).data('id'), 10); + if (tagId === id) + match = true; + }); + return match; + }}); var oldColorTool = $('#app-navigation .circle-toolbar.icon-checkmark'); $.each(oldColorTool, function(i, oct) { $(oct).removeClass('icon-checkmark');