summaryrefslogtreecommitdiff
path: root/assets/js/calendar.js
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-01-25 13:09:54 -0500
committerFrederic Guillot <fred@kanboard.net>2015-01-25 13:09:54 -0500
commit746a3f8d235c073abba401f25ca9a379264d2b16 (patch)
treecb234239027f227e03001ef50963f28aa96e512e /assets/js/calendar.js
parent0812ceedde2f89a8e4b391e58d6463f832ecec8e (diff)
Move assets to seperate subfolders
Diffstat (limited to 'assets/js/calendar.js')
-rw-r--r--assets/js/calendar.js103
1 files changed, 0 insertions, 103 deletions
diff --git a/assets/js/calendar.js b/assets/js/calendar.js
deleted file mode 100644
index ca76377e..00000000
--- a/assets/js/calendar.js
+++ /dev/null
@@ -1,103 +0,0 @@
-Kanboard.Calendar = (function() {
-
- // Show the empty calendar
- function show_calendar()
- {
- var calendar = $("#calendar");
- var translations = calendar.data("translations");
-
- calendar.fullCalendar({
- editable: true,
- eventLimit: true,
- header: {
- left: 'prev,next today',
- center: 'title',
- right: ''
- },
- 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]
- });
- }
-
- // Save the new due date for a moved task
- function move_calendar_event(calendar_event)
- {
- $.ajax({
- cache: false,
- url: $("#calendar").data("save-url"),
- contentType: "application/json",
- type: "POST",
- processData: false,
- data: JSON.stringify({
- "task_id": calendar_event.id,
- "date_due": calendar_event.start.format()
- })
- });
- }
-
- // Refresh the calendar events
- function refresh_calendar(filters)
- {
- var calendar = $("#calendar");
- var url = calendar.data("check-url");
- var params = {
- "start": calendar.fullCalendar('getView').start.format(),
- "end": calendar.fullCalendar('getView').end.format()
- }
-
- jQuery.extend(params, filters);
-
- for (var key in params) {
- url += "&" + key + "=" + params[key];
- }
-
- $.getJSON(url, function(events) {
- calendar.fullCalendar('removeEvents');
- calendar.fullCalendar('addEventSource', events);
- calendar.fullCalendar('rerenderEvents');
- });
- }
-
- // Restore saved filters
- function load_filters()
- {
- var filters = Kanboard.GetStorageItem('calendar_filters');
-
- if (filters !== "undefined" && filters !== "") {
- filters = JSON.parse(filters);
-
- for (var filter in filters) {
- $("select[name=" + filter + "]").val(filters[filter]);
- }
- }
-
- refresh_calendar(filters || {});
-
- $('.calendar-filter').change(apply_filters);
- }
-
- // Apply filters on change
- function apply_filters()
- {
- var filters = {};
-
- $('.calendar-filter').each(function(index, element) {
- filters[$(this).attr("name")] = $(this).val();
- });
-
- Kanboard.SetStorageItem("calendar_filters", JSON.stringify(filters));
- refresh_calendar(filters);
- }
-
- return {
- Init: function() {
- show_calendar();
- load_filters();
- }
- };
-
-})();