summaryrefslogtreecommitdiff
path: root/assets/js/src/Task.js
blob: 75087a4006b84bdf4f16809ce6a18fd5cc168805 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function Task() {
}

Task.prototype.listen = function() {
    $(document).on("click", ".color-square", function() {
        $(".color-square-selected").removeClass("color-square-selected");
        $(this).addClass("color-square-selected");
        $("#form-color_id").val($(this).data("color-id"));
    });

    $(document).on("click", ".assign-me", function(e) {
        e.preventDefault();

        var currentId = $(this).data("current-id");
        var dropdownId = "#" + $(this).data("target-id");

        if ($(dropdownId + ' option[value=' + currentId + ']').length) {
            $(dropdownId).val(currentId);
        }
    });
};