summaryrefslogtreecommitdiff
path: root/assets/js/components/board-task-click.js
blob: a8c193ed653f615545193a503cf41d71e1a05ed6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
(function () {
    function redirectToTaskView(e) {
        var ignoreParentElement = KB.dom(e.target).parent('a, .task-board-change-assignee');
        if (ignoreParentElement) {
            return;
        }

        var taskElement = KB.dom(e.target).parent('.task-board');
        if (taskElement) {
            var taskUrl = KB.dom(taskElement).data('taskUrl');

            if (taskUrl) {
                window.location = taskUrl;
            }
        }
    }

    function openEditTask(e) {
        var baseElement = KB.dom(e.target).parent('.task-board-change-assignee');
        var url = KB.dom(baseElement).data('url');

        if (url) {
            KB.modal.open(url, 'medium', false);
        }
    }

    KB.onClick('.task-board *', redirectToTaskView, true);
    KB.onClick('.task-board-change-assignee *', openEditTask, true);
}());