diff options
Diffstat (limited to 'assets/js/src')
-rw-r--r-- | assets/js/src/base.js | 40 | ||||
-rw-r--r-- | assets/js/src/board.js | 11 | ||||
-rw-r--r-- | assets/js/src/init.js | 4 |
3 files changed, 32 insertions, 23 deletions
diff --git a/assets/js/src/base.js b/assets/js/src/base.js index a8fd470f..956064fb 100644 --- a/assets/js/src/base.js +++ b/assets/js/src/base.js @@ -160,17 +160,8 @@ var Kanboard = (function() { } }, - // Common init Init: function() { - // Datepicker - $(".form-date").datepicker({ - showOtherMonths: true, - selectOtherMonths: true, - dateFormat: 'yy-mm-dd', - constrainInput: false - }); - // Project select box $("#board-selector").chosen({ width: 180 @@ -180,23 +171,38 @@ var Kanboard = (function() { window.location = $(this).attr("data-board-url").replace(/PROJECT_ID/g, $(this).val()); }); + // Check the session every 60s + window.setInterval(Kanboard.CheckSession, 60000); + + Mousetrap.bind("ctrl+enter", function() { + $("form").submit(); + }); + + Kanboard.InitAfterAjax(); + }, + + InitAfterAjax: function() { + + // Datepicker + $(".form-date").datepicker({ + showOtherMonths: true, + selectOtherMonths: true, + dateFormat: 'yy-mm-dd', + constrainInput: false + }); + // Markdown Preview for textareas $("#markdown-preview").click(Kanboard.MarkdownPreview); $("#markdown-write").click(Kanboard.MarkdownWriter); - // Check the session every 60s - window.setInterval(Kanboard.CheckSession, 60000); - // Auto-select input fields $(".auto-select").focus(function() { $(this).select(); }); - Mousetrap.bind("ctrl+enter", function() { - $("form").submit(); - }); - - $('.dropdown').dropit(); + // Dropdown + $(".dropit-submenu").hide(); + $('.dropdown').not(".dropit").dropit(); } }; diff --git a/assets/js/src/board.js b/assets/js/src/board.js index b061b24c..6bc52326 100644 --- a/assets/js/src/board.js +++ b/assets/js/src/board.js @@ -4,7 +4,7 @@ Kanboard.Board = (function() { function on_popover(e) { - Kanboard.Popover(e, Kanboard.Init); + Kanboard.Popover(e, Kanboard.InitAfterAjax); } function keyboard_shortcuts() @@ -13,7 +13,7 @@ Kanboard.Board = (function() { Kanboard.OpenPopover( $(".task-creation-popover").attr('href'), - Kanboard.Init + Kanboard.InitAfterAjax ); }); } @@ -38,10 +38,10 @@ Kanboard.Board = (function() { }); // Assignee change - $(".assignee-popover").click(Kanboard.Popover); + $(".assignee-popover").click(on_popover); // Category change - $(".category-popover").click(Kanboard.Popover); + $(".category-popover").click(on_popover); // Task edit popover $(".task-edit-popover").click(on_popover); @@ -50,6 +50,7 @@ Kanboard.Board = (function() { // Description popover $(".task-description-popover").click(on_popover); + // Tooltip for column description $(".column-tooltip").tooltip({ content: function(e) { return $(this).attr("title"); @@ -175,6 +176,7 @@ Kanboard.Board = (function() { success: function(data) { $("#board").remove(); $("#main").append(data); + Kanboard.InitAfterAjax(); board_load_events(); filter_apply(); } @@ -192,6 +194,7 @@ Kanboard.Board = (function() { 200: function(data) { $("#board").remove(); $("#main").append(data); + Kanboard.InitAfterAjax(); board_unload_events(); board_load_events(); filter_apply(); diff --git a/assets/js/src/init.js b/assets/js/src/init.js index e6d16085..649ca6d0 100644 --- a/assets/js/src/init.js +++ b/assets/js/src/init.js @@ -1,6 +1,6 @@ // Initialization -$(function() { - +jQuery(document).ready(function() { + Kanboard.Init(); if (Kanboard.Exists("board")) { |