From 14dcc9a8b386870f82df042c0f16ac704ab8ad49 Mon Sep 17 00:00:00 2001 From: Matias De lellis Date: Tue, 12 Nov 2019 11:58:41 -0300 Subject: [PATCH] Fix double use of data-id on tags --- js/script.js | 12 ++++++------ js/templates/navigation.handlebars | 4 ++-- js/templates/note-item.handlebars | 2 +- js/templates/notes.handlebars | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/js/script.js b/js/script.js index 3272a3c..ec9d9c3 100644 --- a/js/script.js +++ b/js/script.js @@ -314,7 +314,7 @@ View.prototype = { var color = this.colorToHex($("#modal-note-div .quicknote").css("background-color")); var tags = $("#modal-note-div .slim-tag").toArray().map(function (value) { return { - id: value.getAttribute('data-id'), + id: value.getAttribute('tag-id'), name: value.textContent.trim() }; }); @@ -468,11 +468,11 @@ View.prototype = { $('#app-content').on('click', '.slim-tag', function (event) { event.stopPropagation(); - var tagId = parseInt($(this).data('id'), 10); + var tagId = parseInt($(this).attr('tag-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); + var id = parseInt($(this).attr('tag-id'), 10); if (tagId === id) match = true; }); @@ -621,7 +621,7 @@ View.prototype = { modalTags.html(''); newTags.forEach(function (item, index) { var noteId = parseInt(item.id) || -1; - var tag = $('
' + item.text + '
'); + var tag = $('
' + item.text + '
'); modalTags.append(tag); }); } @@ -773,11 +773,11 @@ View.prototype = { $('#app-navigation .nav-tag > a').click(function (event) { event.stopPropagation(); - var tagId = parseInt($(this).parent().data('id'), 10); + var tagId = parseInt($(this).parent().attr('tag-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); + var id = parseInt($(this).attr('tag-id'), 10); if (tagId === id) match = true; }); diff --git a/js/templates/navigation.handlebars b/js/templates/navigation.handlebars index b4002df..3f0b3aa 100644 --- a/js/templates/navigation.handlebars +++ b/js/templates/navigation.handlebars @@ -33,10 +33,10 @@
  • - {{tagsTxt}} + {{tagsTxt}}