summaryrefslogtreecommitdiff
path: root/assets/js/src
diff options
context:
space:
mode:
Diffstat (limited to 'assets/js/src')
-rw-r--r--assets/js/src/analytic.js5
-rw-r--r--assets/js/src/base.js1
-rw-r--r--assets/js/src/board.js92
-rw-r--r--assets/js/src/calendar.js188
-rw-r--r--assets/js/src/swimlane.js2
5 files changed, 47 insertions, 241 deletions
diff --git a/assets/js/src/analytic.js b/assets/js/src/analytic.js
index 8066165b..bec4d76e 100644
--- a/assets/js/src/analytic.js
+++ b/assets/js/src/analytic.js
@@ -1,5 +1,4 @@
-
-Kanboard.Analytic = (function() {
+(function() {
// CFD diagram
function drawCfd()
@@ -185,6 +184,4 @@ Kanboard.Analytic = (function() {
}
});
- return {};
-
})();
diff --git a/assets/js/src/base.js b/assets/js/src/base.js
index 0d46b503..992342e9 100644
--- a/assets/js/src/base.js
+++ b/assets/js/src/base.js
@@ -1,4 +1,3 @@
-// Common functions
var Kanboard = (function() {
jQuery(document).ready(function() {
diff --git a/assets/js/src/board.js b/assets/js/src/board.js
index 9f93a869..d11e39f5 100644
--- a/assets/js/src/board.js
+++ b/assets/js/src/board.js
@@ -1,4 +1,4 @@
-Kanboard.Board = (function() {
+(function() {
var checkInterval = null;
@@ -243,7 +243,6 @@ Kanboard.Board = (function() {
$("#main").append(data);
Kanboard.InitAfterAjax();
board_load_events();
- filter_apply();
stack_show();
compactview_reload();
}
@@ -264,7 +263,6 @@ Kanboard.Board = (function() {
Kanboard.InitAfterAjax();
board_unload_events();
board_load_events();
- filter_apply();
stack_show();
compactview_reload();
}
@@ -273,93 +271,6 @@ Kanboard.Board = (function() {
}
}
- // Apply user or date filter (change tasks opacity)
- function filter_apply()
- {
- var selectedUserId = $("#form-user_id").val();
- var selectedCategoryId = $("#form-category_id").val();
- var filterDueDate = $("#more-filters option[value=filter-due-date]").is(":selected")
- var filterRecent = $("#more-filters option[value=filter-recent]").is(":selected")
- var projectId = $('#board').data('project-id');
-
- $("[data-task-id]").each(function(index, item) {
-
- var ownerId = item.getAttribute("data-owner-id");
- var dueDate = item.getAttribute("data-due-date");
- var categoryId = item.getAttribute("data-category-id");
- var recent = $(item).hasClass("task-board-recent");
-
- if (ownerId != selectedUserId && selectedUserId != -1) {
- item.style.display = "none";
- }
- else {
- item.style.display = "block";
- }
-
- if (filterDueDate && (dueDate == "" || dueDate == "0")) {
- item.style.display = "none";
- }
-
- if (categoryId != selectedCategoryId && selectedCategoryId != -1) {
- item.style.display = "none";
- }
-
- if (filterRecent && ! recent) {
- item.style.display = "none";
- }
- });
-
- // Save filter settings
- Kanboard.SetStorageItem("board_filter_" + projectId + "_form-user_id", selectedUserId);
- Kanboard.SetStorageItem("board_filter_" + projectId + "_form-category_id", selectedCategoryId);
- Kanboard.SetStorageItem("board_filter_" + projectId + "_filter-due-date", ~~(filterDueDate));
- Kanboard.SetStorageItem("board_filter_" + projectId + "_filter-recent", ~~(filterRecent));
- }
-
- // Load filter events
- function filter_load_events()
- {
- var projectId = $('#board').data('project-id');
-
- $("#form-user_id").chosen({
- width: "180px",
- no_results_text: $("#form-user_id").data("notfound")
- });
-
- $("#form-category_id").chosen({
- width: "200px",
- no_results_text: $("#form-category_id").data("notfound")
- });
-
- $("#more-filters").chosen({
- width: "30%",
- no_results_text: $("#more-filters").data("notfound")
- });
-
- $(".apply-filters").change(function(e) {
- filter_apply();
- });
-
- // Get and set filters from localStorage
- $("#form-user_id").val(Kanboard.GetStorageItem("board_filter_" + projectId + "_form-user_id") || -1);
- $("#form-user_id").trigger("chosen:updated");
-
- $("#form-category_id").val(Kanboard.GetStorageItem("board_filter_" + projectId + "_form-category_id") || -1);
- $("#form-category_id").trigger("chosen:updated");
-
- if (+Kanboard.GetStorageItem("board_filter_" + projectId + "_filter-due-date")) {
- $("#more-filters option[value=filter-due-date]").attr("selected", true);
- }
-
- if (+Kanboard.GetStorageItem("board_filter_" + projectId + "_filter-recent")) {
- $("#more-filters option[value=filter-recent]").attr("selected", true);
- }
-
- $("#more-filters").trigger("chosen:updated");
-
- filter_apply();
- }
-
function compactview_load_events()
{
jQuery(document).on('click', ".filter-toggle-scrolling", function(e) {
@@ -401,7 +312,6 @@ Kanboard.Board = (function() {
if (Kanboard.Exists("board")) {
board_load_events();
- filter_load_events();
stack_load_events();
compactview_load_events();
keyboard_shortcuts();
diff --git a/assets/js/src/calendar.js b/assets/js/src/calendar.js
index 5e20f962..68da57ee 100644
--- a/assets/js/src/calendar.js
+++ b/assets/js/src/calendar.js
@@ -1,150 +1,50 @@
-Kanboard.Calendar = (function() {
-
- var filter_storage_key = "";
-
- // Save the new due date for a moved task
- function move_calendar_event(calendar_event)
- {
- var url = $("#calendar").data("save-url") || $("#user-calendar").data("save-url");
-
- $.ajax({
- cache: false,
- url: url,
- contentType: "application/json",
- type: "POST",
- processData: false,
- data: JSON.stringify({
- "task_id": calendar_event.id,
- "date_due": calendar_event.start.format()
- })
- });
- }
-
- // Show the user calendar
- function show_user_calendar()
- {
- var calendar = $("#user-calendar");
-
- calendar.fullCalendar({
- lang: $("body").data("js-lang"),
- editable: true,
- eventLimit: true,
- defaultView: "month",
- header: {
- left: 'prev,next today',
- center: 'title',
- right: 'month,agendaWeek,agendaDay'
- },
- viewRender: refresh_user_calendar,
- eventDrop: move_calendar_event
- });
- }
-
- // Refresh the calendar events
- function refresh_user_calendar()
- {
- var calendar = $("#user-calendar");
- var url = calendar.data("check-url");
- var params = {
- "start": calendar.fullCalendar('getView').start.format(),
- "end": calendar.fullCalendar('getView').end.format(),
- "user_id": calendar.data("user-id")
- };
-
- for (var key in params) {
- url += "&" + key + "=" + params[key];
- }
-
- $.getJSON(url, function(events) {
- calendar.fullCalendar('removeEvents');
- calendar.fullCalendar('addEventSource', events);
- calendar.fullCalendar('rerenderEvents');
- });
- }
-
- // Show the project calendar
- function show_project_calendar()
- {
- var calendar = $("#calendar");
-
- calendar.fullCalendar({
- lang: $("body").data("js-lang"),
- editable: true,
- eventLimit: true,
- defaultView: "month",
- header: {
- left: 'prev,next today',
- center: 'title',
- right: 'month,agendaWeek,agendaDay'
- },
- viewRender: load_project_filters,
- eventDrop: move_calendar_event
- });
- }
-
- // Refresh the calendar events
- function refresh_project_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_project_filters()
- {
- var filters = Kanboard.GetStorageItem(filter_storage_key);
-
- if (filters !== "") {
- filters = JSON.parse(filters);
-
- for (var filter in filters) {
- $("select[name=" + filter + "]").val(filters[filter]);
- }
- }
-
- refresh_project_calendar(filters || {});
-
- $('.calendar-filter').change(apply_project_filters);
- }
-
- // Apply filters on change
- function apply_project_filters()
- {
- var filters = {};
-
- $('.calendar-filter').each(function() {
- filters[$(this).attr("name")] = $(this).val();
- });
-
- Kanboard.SetStorageItem(filter_storage_key, JSON.stringify(filters));
- refresh_project_calendar(filters);
- }
+(function() {
jQuery(document).ready(function() {
-
if (Kanboard.Exists("calendar")) {
- filter_storage_key = "calendar_filters_" + $("#calendar").data("project-id");
- show_project_calendar();
- load_project_filters();
- }
- else if (Kanboard.Exists("user-calendar")) {
- show_user_calendar();
+ var calendar = $('#calendar');
+
+ calendar.fullCalendar({
+ lang: $("body").data("js-lang"),
+ editable: true,
+ eventLimit: true,
+ defaultView: "month",
+ header: {
+ left: 'prev,next today',
+ center: 'title',
+ right: 'month,agendaWeek,agendaDay'
+ },
+ eventDrop: function(event) {
+ $.ajax({
+ cache: false,
+ url: calendar.data("save-url"),
+ contentType: "application/json",
+ type: "POST",
+ processData: false,
+ data: JSON.stringify({
+ "task_id": event.id,
+ "date_due": event.start.format()
+ })
+ });
+ },
+ viewRender: function() {
+ var url = calendar.data("check-url");
+ var params = {
+ "start": calendar.fullCalendar('getView').start.format(),
+ "end": calendar.fullCalendar('getView').end.format()
+ };
+
+ for (var key in params) {
+ url += "&" + key + "=" + params[key];
+ }
+
+ $.getJSON(url, function(events) {
+ calendar.fullCalendar('removeEvents');
+ calendar.fullCalendar('addEventSource', events);
+ calendar.fullCalendar('rerenderEvents');
+ });
+ }
+ });
}
});
diff --git a/assets/js/src/swimlane.js b/assets/js/src/swimlane.js
index 77f45907..212d6d36 100644
--- a/assets/js/src/swimlane.js
+++ b/assets/js/src/swimlane.js
@@ -1,4 +1,4 @@
-Kanboard.Swimlane = (function() {
+(function() {
// Expand a Swimlane via display attributes
function expand(swimlaneId)