mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-11-30 23:37:16 +01:00
Add checkmarks to color filter on navigation
This commit is contained in:
18
js/script.js
18
js/script.js
@@ -315,7 +315,7 @@ View.prototype = {
|
||||
$('#modal-note-div .circle-toolbar').click(function (event) {
|
||||
event.stopPropagation();
|
||||
|
||||
var oldColorTool = $('.circle-toolbar.icon-checkmark');
|
||||
var oldColorTool = $('#modal-note-div .circle-toolbar.icon-checkmark');
|
||||
$.each(oldColorTool, function(i, oct) {
|
||||
$(oct).removeClass('icon-checkmark');
|
||||
});
|
||||
@@ -365,6 +365,12 @@ View.prototype = {
|
||||
$('#all-notes').click(function () {
|
||||
self._notes.unsetActive();
|
||||
$('.notes-grid').isotope({ filter: '*'});
|
||||
|
||||
var oldColorTool = $('#app-navigation .circle-toolbar.icon-checkmark');
|
||||
$.each(oldColorTool, function(i, oct) {
|
||||
$(oct).removeClass('icon-checkmark');
|
||||
});
|
||||
$('#app-navigation .any-color').addClass('icon-checkmark');
|
||||
});
|
||||
|
||||
// create a new note
|
||||
@@ -423,10 +429,14 @@ View.prototype = {
|
||||
|
||||
// Handle colors.
|
||||
$('#app-navigation .circle-toolbar').click(function (event) {
|
||||
event.stopPropagation();
|
||||
var oldColorTool = $('#app-navigation .circle-toolbar.icon-checkmark');
|
||||
$.each(oldColorTool, function(i, oct) {
|
||||
$(oct).removeClass('icon-checkmark');
|
||||
});
|
||||
$(this).addClass('icon-checkmark');
|
||||
|
||||
var color = $(this).css("background-color");
|
||||
if (color != 'transparent') {
|
||||
if (!$(this).hasClass("any-color")) {
|
||||
var color = $(this).css("background-color");
|
||||
$('.notes-grid').isotope({ filter: function() {
|
||||
var itemColor = $(this).children().css("background-color");
|
||||
return color == itemColor;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<a href="#" class="icon-search svg">Colors</a>
|
||||
<ul>
|
||||
<li style="display: flex; justify-content: center;">
|
||||
<button class="circle-toolbar" style="background: transparent none; border: 1px solid;"></button>
|
||||
<button class="circle-toolbar icon-checkmark any-color"></button>
|
||||
{{#each colors}}
|
||||
<button class="circle-toolbar" style="background-color: {{color}} "></button>
|
||||
{{/each}}
|
||||
|
||||
Reference in New Issue
Block a user