diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-07-04 15:04:41 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-07-04 15:04:41 -0400 |
commit | ad23b4961a0ac31a7f9c5259b48db868c3e26cf0 (patch) | |
tree | 06608436b467b1bd5677f67aed52736c179d9c4e /assets/js/src | |
parent | 4f3088a33145ecc37a07845fb84b865d80b2c347 (diff) |
Add keyboard shortcuts to switch between board/calendar/list view
Diffstat (limited to 'assets/js/src')
-rw-r--r-- | assets/js/src/base.js | 40 | ||||
-rw-r--r-- | assets/js/src/filter.js | 12 |
2 files changed, 39 insertions, 13 deletions
diff --git a/assets/js/src/base.js b/assets/js/src/base.js index 2c7e9b34..2d8ca133 100644 --- a/assets/js/src/base.js +++ b/assets/js/src/base.js @@ -185,16 +185,18 @@ var Kanboard = (function() { // Check the session every 60s window.setInterval(Kanboard.CheckSession, 60000); - // Keyboard shortcuts + // Submit form Mousetrap.bindGlobal("mod+enter", function() { $("form").submit(); }); + // Open board selector Mousetrap.bind("b", function(e) { e.preventDefault(); $('#board-selector').trigger('chosen:open'); }); + // Focus to the search box Mousetrap.bind("f", function(e) { e.preventDefault(); @@ -205,10 +207,46 @@ var Kanboard = (function() { } }); + // Switch view mode for projects: go to the board + Mousetrap.bind("v b", function(e) { + var link = $(".view-board"); + + if (link.length) { + window.location = link.attr('href'); + } + }); + + // Switch view mode for projects: go to the calendar + Mousetrap.bind("v c", function(e) { + var link = $(".view-calendar"); + + if (link.length) { + window.location = link.attr('href'); + } + }); + + // Switch view mode for projects: go to the listing + Mousetrap.bind("v l", function(e) { + var link = $(".view-listing"); + + if (link.length) { + window.location = link.attr('href'); + } + }); + + // Place cursor at the end when focusing on the search box $(document).on("focus", "#form-search", function() { $(this).val($(this).val()); }); + // Filter helper for search + $(document).on("click", ".filter-helper", function (e) { + e.preventDefault(); + $("#form-search").val($(this).data("filter")); + $("form.search").submit(); + }); + + // Datepicker translation $.datepicker.setDefaults($.datepicker.regional[$("body").data("js-lang")]); Kanboard.InitAfterAjax(); diff --git a/assets/js/src/filter.js b/assets/js/src/filter.js deleted file mode 100644 index cd8434ab..00000000 --- a/assets/js/src/filter.js +++ /dev/null @@ -1,12 +0,0 @@ -(function() { - - jQuery(document).ready(function() { - - $(document).on("click", ".filter-helper", function (e) { - e.preventDefault(); - $("#form-search").val($(this).data("filter")); - $("form.search").submit(); - }); - }); - -})(); |