Open and collapse tag nav...

This commit is contained in:
Matias De lellis
2019-11-08 08:49:27 -03:00
parent b7b0158a72
commit b5294a4810
2 changed files with 39 additions and 23 deletions

View File

@@ -677,6 +677,8 @@ View.prototype = {
}); });
}); });
/* Colors Navigation */
$('#colors-folder').click(function () { $('#colors-folder').click(function () {
$(this).toggleClass("open"); $(this).toggleClass("open");
}); });
@@ -685,30 +687,11 @@ View.prototype = {
event.stopPropagation(); event.stopPropagation();
}); });
$('#notes-folder').click(function () {
$(this).toggleClass("open");
});
// show a note
$('#app-navigation .note > a').click(function (event) {
event.stopPropagation();
var id = parseInt($(this).parent().data('id'), 10);
$('.notes-grid').isotope({ filter: function() {
var itemId = parseInt($(this).children().data('id'), 10);
return id == itemId;
}});
var oldColorTool = $('#app-navigation .circle-toolbar.icon-checkmark');
$.each(oldColorTool, function(i, oct) {
$(oct).removeClass('icon-checkmark');
});
});
// Handle colors.
$('#app-navigation .circle-toolbar').click(function (event) { $('#app-navigation .circle-toolbar').click(function (event) {
event.stopPropagation(); event.stopPropagation();
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');
}); });
$(this).addClass('icon-checkmark'); $(this).addClass('icon-checkmark');
@@ -724,6 +707,39 @@ View.prototype = {
} }
}); });
/* Notes Navigation */
$('#notes-folder').click(function () {
$(this).toggleClass("open");
});
$('#app-navigation .nav-note > a').click(function (event) {
event.stopPropagation();
var id = parseInt($(this).parent().data('id'), 10);
$('.notes-grid').isotope({ filter: function() {
var itemId = parseInt($(this).children().data('id'), 10);
return id == itemId;
}});
var oldColorTool = $('#app-navigation .circle-toolbar.icon-checkmark');
$.each(oldColorTool, function(i, oct) {
$(oct).removeClass('icon-checkmark');
});
});
/* Tags Navigation */
$('#tags-folder').click(function () {
$(this).toggleClass("open");
});
$('#app-navigation .nav-tag > a').click(function (event) {
event.stopPropagation();
$('.notes-grid').isotope({ filter: '*'});
var oldColorTool = $('#app-navigation .circle-toolbar.icon-checkmark');
$.each(oldColorTool, function(i, oct) {
$(oct).removeClass('icon-checkmark');
});
});
}, },
render: function () { render: function () {
this.renderNavigation(); this.renderNavigation();

View File

@@ -25,18 +25,18 @@
<a href="#" class="icon-folder svg">{{notesTxt}}</a> <a href="#" class="icon-folder svg">{{notesTxt}}</a>
<ul> <ul>
{{#each notes}} {{#each notes}}
<li class="note with-menu {{#if active}}active{{/if}}" data-id="{{ id }}"> <li class="nav-note with-menu {{#if active}}active{{/if}}" data-id="{{ id }}">
<a href="#">{{{ title }}}</a> <a href="#">{{{ title }}}</a>
</li> </li>
{{/each}} {{/each}}
</ul> </ul>
</li> </li>
<li id="notes-folder" class="collapsible open"> <li id="tags-folder" class="collapsible open">
<button class="collapse"></button> <button class="collapse"></button>
<a href="#" class="icon-folder svg">{{tagsTxt}}</a> <a href="#" class="icon-folder svg">{{tagsTxt}}</a>
<ul> <ul>
{{#each tags}} {{#each tags}}
<li class="note with-menu {{#if active}}active{{/if}}" data-id="{{ id }}"> <li class="nav-tag with-menu {{#if active}}active{{/if}}" data-id="{{ id }}">
<a href="#">{{{ name }}}</a> <a href="#">{{{ name }}}</a>
</li> </li>
{{/each}} {{/each}}