summaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
Diffstat (limited to 'assets')
-rw-r--r--assets/js/app.js32
-rw-r--r--assets/js/base.js2
-rw-r--r--assets/js/board.js30
3 files changed, 26 insertions, 38 deletions
diff --git a/assets/js/app.js b/assets/js/app.js
index 2dbcdc42..55bc4039 100644
--- a/assets/js/app.js
+++ b/assets/js/app.js
@@ -97,7 +97,7 @@ var Kanboard = (function() {
});
$("#board-selector").change(function() {
- window.location = "?controller=board&action=show&project_id=" + $(this).val();
+ window.location = $(this).attr("data-board-url").replace(/%d/g, $(this).val());
});
}
};
@@ -140,9 +140,9 @@ Kanboard.Board = (function() {
$(".task-description-popover").click(Kanboard.Popover);
// Redirect to the task details page
- $("[data-task-id]").each(function() {
+ $("[data-task-url]").each(function() {
$(this).click(function() {
- window.location = "?controller=task&action=show&task_id=" + $(this).attr("data-task-id");
+ window.location = $(this).attr("data-task-url");
});
});
@@ -157,28 +157,26 @@ Kanboard.Board = (function() {
// Stop events
function board_unload_events()
{
- $("[data-task-id]").off();
+ $("[data-task-url]").off();
clearInterval(checkInterval);
}
// Save and refresh the board
function board_save(taskId, columnId, position)
{
- var boardSelector = $("#board");
- var projectId = boardSelector.attr("data-project-id");
-
board_unload_events();
$.ajax({
cache: false,
- url: "?controller=board&action=save&project_id=" + projectId,
- data: {
+ url: $("#board").attr("data-save-url"),
+ contentType: "application/json",
+ type: "POST",
+ processData: false,
+ data: JSON.stringify({
"task_id": taskId,
"column_id": columnId,
"position": position,
- "csrf_token": boardSelector.attr("data-csrf-token"),
- },
- type: "POST",
+ }),
success: function(data) {
$("#board").remove();
$("#main").append(data);
@@ -191,17 +189,13 @@ Kanboard.Board = (function() {
// Check if a board have been changed by someone else
function board_check()
{
- var boardSelector = $("#board");
- var projectId = boardSelector.attr("data-project-id");
- var timestamp = boardSelector.attr("data-time");
-
- if (Kanboard.IsVisible() && projectId != undefined && timestamp != undefined) {
+ if (Kanboard.IsVisible()) {
$.ajax({
cache: false,
- url: "?controller=board&action=check&project_id=" + projectId + "&timestamp=" + timestamp,
+ url: $("#board").attr("data-check-url"),
statusCode: {
200: function(data) {
- boardSelector.remove();
+ $("#board").remove();
$("#main").append(data);
board_unload_events();
board_load_events();
diff --git a/assets/js/base.js b/assets/js/base.js
index 1e5ff967..0a17696e 100644
--- a/assets/js/base.js
+++ b/assets/js/base.js
@@ -82,7 +82,7 @@ var Kanboard = (function() {
});
$("#board-selector").change(function() {
- window.location = "?controller=board&action=show&project_id=" + $(this).val();
+ window.location = $(this).attr("data-board-url").replace(/%d/g, $(this).val());
});
}
};
diff --git a/assets/js/board.js b/assets/js/board.js
index 1d890a33..09dbd069 100644
--- a/assets/js/board.js
+++ b/assets/js/board.js
@@ -36,9 +36,9 @@ Kanboard.Board = (function() {
$(".task-description-popover").click(Kanboard.Popover);
// Redirect to the task details page
- $("[data-task-id]").each(function() {
+ $("[data-task-url]").each(function() {
$(this).click(function() {
- window.location = "?controller=task&action=show&task_id=" + $(this).attr("data-task-id");
+ window.location = $(this).attr("data-task-url");
});
});
@@ -53,28 +53,26 @@ Kanboard.Board = (function() {
// Stop events
function board_unload_events()
{
- $("[data-task-id]").off();
+ $("[data-task-url]").off();
clearInterval(checkInterval);
}
// Save and refresh the board
function board_save(taskId, columnId, position)
{
- var boardSelector = $("#board");
- var projectId = boardSelector.attr("data-project-id");
-
board_unload_events();
$.ajax({
cache: false,
- url: "?controller=board&action=save&project_id=" + projectId,
- data: {
+ url: $("#board").attr("data-save-url"),
+ contentType: "application/json",
+ type: "POST",
+ processData: false,
+ data: JSON.stringify({
"task_id": taskId,
"column_id": columnId,
"position": position,
- "csrf_token": boardSelector.attr("data-csrf-token"),
- },
- type: "POST",
+ }),
success: function(data) {
$("#board").remove();
$("#main").append(data);
@@ -87,17 +85,13 @@ Kanboard.Board = (function() {
// Check if a board have been changed by someone else
function board_check()
{
- var boardSelector = $("#board");
- var projectId = boardSelector.attr("data-project-id");
- var timestamp = boardSelector.attr("data-time");
-
- if (Kanboard.IsVisible() && projectId != undefined && timestamp != undefined) {
+ if (Kanboard.IsVisible()) {
$.ajax({
cache: false,
- url: "?controller=board&action=check&project_id=" + projectId + "&timestamp=" + timestamp,
+ url: $("#board").attr("data-check-url"),
statusCode: {
200: function(data) {
- boardSelector.remove();
+ $("#board").remove();
$("#main").append(data);
board_unload_events();
board_load_events();