diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-02-08 15:07:47 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-02-08 15:07:47 -0500 |
commit | acf3941b4aa95bff9e80aa03e22dc064036e69cf (patch) | |
tree | fa00598349637eb125c8eb132f3dd74a2e3e9e6f /assets/js/src | |
parent | 813b7c4c0036a73c3bb5ef31f98e83cce2630e9e (diff) |
Improve js and add native language support for datepicker and calendar
Diffstat (limited to 'assets/js/src')
-rw-r--r-- | assets/js/src/analytic.js | 26 | ||||
-rw-r--r-- | assets/js/src/base.js | 12 | ||||
-rw-r--r-- | assets/js/src/board.js | 7 | ||||
-rw-r--r-- | assets/js/src/calendar.js | 19 | ||||
-rw-r--r-- | assets/js/src/init.js | 18 | ||||
-rw-r--r-- | assets/js/src/task.js | 13 |
6 files changed, 36 insertions, 59 deletions
diff --git a/assets/js/src/analytic.js b/assets/js/src/analytic.js index 14cbc815..26050a49 100644 --- a/assets/js/src/analytic.js +++ b/assets/js/src/analytic.js @@ -1,20 +1,20 @@ Kanboard.Analytic = (function() { - return { - Init: function() { - - if (Kanboard.Exists("analytic-task-repartition")) { - Kanboard.Analytic.TaskRepartition.Init(); - } - else if (Kanboard.Exists("analytic-user-repartition")) { - Kanboard.Analytic.UserRepartition.Init(); - } - else if (Kanboard.Exists("analytic-cfd")) { - Kanboard.Analytic.CFD.Init(); - } + jQuery(document).ready(function() { + + if (Kanboard.Exists("analytic-task-repartition")) { + Kanboard.Analytic.TaskRepartition.Init(); } - }; + else if (Kanboard.Exists("analytic-user-repartition")) { + Kanboard.Analytic.UserRepartition.Init(); + } + else if (Kanboard.Exists("analytic-cfd")) { + Kanboard.Analytic.CFD.Init(); + } + }); + + return {}; })(); diff --git a/assets/js/src/base.js b/assets/js/src/base.js index a10f5cce..090f0656 100644 --- a/assets/js/src/base.js +++ b/assets/js/src/base.js @@ -1,6 +1,10 @@ // Common functions var Kanboard = (function() { + jQuery(document).ready(function() { + Kanboard.Init(); + }); + return { // Return true if the element#id exists @@ -174,11 +178,17 @@ var Kanboard = (function() { // Check the session every 60s window.setInterval(Kanboard.CheckSession, 60000); + $(".popover-subtask-restriction").click(Kanboard.Popover); + + // Image preview for attachments + $(".file-popover").click(Kanboard.Popover); + + // Keyboard shortcuts Mousetrap.bind("ctrl+enter", function() { $("form").submit(); }); - $(".popover-subtask-restriction").click(Kanboard.Popover); + $.datepicker.setDefaults($.datepicker.regional[$("body").data("js-lang")]); Kanboard.InitAfterAjax(); }, diff --git a/assets/js/src/board.js b/assets/js/src/board.js index e86d8018..696e2145 100644 --- a/assets/js/src/board.js +++ b/assets/js/src/board.js @@ -272,12 +272,13 @@ Kanboard.Board = (function() { filter_apply(); } - return { - Init: function() { + jQuery(document).ready(function() { + + if (Kanboard.Exists("board")) { board_load_events(); filter_load_events(); keyboard_shortcuts(); } - }; + }); })(); diff --git a/assets/js/src/calendar.js b/assets/js/src/calendar.js index fd6570f3..bdd43db0 100644 --- a/assets/js/src/calendar.js +++ b/assets/js/src/calendar.js @@ -9,20 +9,16 @@ Kanboard.Calendar = (function() { var translations = calendar.data("translations"); calendar.fullCalendar({ + lang: $("body").data("js-lang"), editable: true, eventLimit: true, header: { left: 'prev,next today', center: 'title', - right: '' + right: 'month,agendaWeek,agendaDay' }, viewRender: load_filters, - eventDrop: move_calendar_event, - monthNames: [translations.January, translations.February, translations.March, translations.April, translations.May, translations.June, translations.July, translations.August, translations.September, translations.October, translations.November, translations.December], - monthNamesShort: [translations.Jan, translations.Feb, translations.Mar, translations.Apr, translations.May, translations.Jun, translations.Jul, translations.Aug, translations.Sep, translations.Oct, translations.Nov, translations.Dec], - buttonText: {today: translations.Today}, - dayNames: [translations.Sunday, translations.Monday, translations.Tuesday, translations.Wednesday, translations.Thursday, translations.Friday, translations.Saturday], - dayNamesShort: [translations.Sun, translations.Mon, translations.Tue, translations.Wed, translations.Thu, translations.Fri, translations.Sat] + eventDrop: move_calendar_event }); } @@ -70,7 +66,7 @@ Kanboard.Calendar = (function() { { var filters = Kanboard.GetStorageItem(filter_storage_key); - if (filters !== "undefined" && filters !== "") { + if (filters !== "") { filters = JSON.parse(filters); for (var filter in filters) { @@ -96,12 +92,13 @@ Kanboard.Calendar = (function() { refresh_calendar(filters); } - return { - Init: function() { + jQuery(document).ready(function() { + + if (Kanboard.Exists("calendar")) { filter_storage_key = "calendar_filters_" + $("#calendar").data("project-id"); show_calendar(); load_filters(); } - }; + }); })(); diff --git a/assets/js/src/init.js b/assets/js/src/init.js deleted file mode 100644 index 649ca6d0..00000000 --- a/assets/js/src/init.js +++ /dev/null @@ -1,18 +0,0 @@ -// Initialization -jQuery(document).ready(function() { - - Kanboard.Init(); - - if (Kanboard.Exists("board")) { - Kanboard.Board.Init(); - } - else if (Kanboard.Exists("calendar")) { - Kanboard.Calendar.Init(); - } - else if (Kanboard.Exists("task-section")) { - Kanboard.Task.Init(); - } - else if (Kanboard.Exists("analytic-section")) { - Kanboard.Analytic.Init(); - } -});
\ No newline at end of file diff --git a/assets/js/src/task.js b/assets/js/src/task.js deleted file mode 100644 index 968f25db..00000000 --- a/assets/js/src/task.js +++ /dev/null @@ -1,13 +0,0 @@ -// Task related functions -Kanboard.Task = (function() { - - return { - - Init: function() { - - // Image preview for attachments - $(".file-popover").click(Kanboard.Popover); - } - }; - -})(); |