Sha256: 4788f55a6977e171829896e08103b7de971591d4a2053625cbed4fe79c46566e

Contents?: true

Size: 869 Bytes

Versions: 5

Compression:

Stored size: 869 Bytes

Contents

function buttonhandler() {

    $("body").on("click", ".like-btn, .flag-confirm", function(e) {
        button = $(this);
        imageId = $(".fancybox-wrap, .image-show").attr("id");
        if (!$(button).is(".already-clicked")) {
            url = $(button).attr("href");
            $.post(url, function() {
                $(button).addClass("already-clicked");
                $("#" + imageId + " .text-overlay").find(".initial-state").addClass("already-clicked");
            });
        }

        if ($(button).is(".like-btn")) {
            $("#" + imageId + " .like-btn").toggle();
        } else if ($(button).is(".flag-confirm")) {
            $("#" + imageId + " .flag-btn.initial-state").remove();
            $("#" + imageId + " .flag-btn.secondary-state").show();
            $('.modal').modal('hide');
        }
        e.preventDefault();
    });
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lentil-0.9.1 app/assets/javascripts/lentil/buttonhandler.js
lentil-0.9.0 app/assets/javascripts/lentil/buttonhandler.js
lentil-0.8.0 app/assets/javascripts/lentil/buttonhandler.js
lentil-0.7.1 app/assets/javascripts/lentil/buttonhandler.js
lentil-0.6.0 app/assets/javascripts/lentil/buttonhandler.js