Sha256: 5c159bff71229453527786d8141ddbc2598f792064024429f4b1c5adec3f77bf

Contents?: true

Size: 1.48 KB

Versions: 2

Compression:

Stored size: 1.48 KB

Contents

I"â(function() {
  window.dorsaleComments = {
    load: function() {
      return $("#dorsale-comments").map(function() {
        var container, url;
        container = $(this);
        url = this.dataset.url;
        return $.ajax({
          url: url,
          success: function(data) {
            container.html(data);
            setupUploadInputs(container);
            dorsaleComments.setupCreateForm();
            dorsaleComments.setupEditButtons();
            return dorsaleComments.setupDeleteButtons();
          }
        });
      });
    },
    reload: function() {
      return dorsaleComments.load();
    },
    setupCreateForm: function() {
      return $("#new_comment").on("ajax:success", dorsaleComments.reload);
    },
    setupEditForm: function() {
      return $("#edit_comment").on("ajax:success", dorsaleComments.reload);
    },
    setupEditButtons: function() {
      return $("#dorsale-comments [href$=edit]").click(function() {
        var container, url;
        container = $(this).parents(".comment");
        url = this.href;
        $.ajax({
          url: url,
          success: function(data) {
            container.replaceWith(data);
            return dorsaleComments.setupEditForm();
          }
        });
        return false;
      });
    },
    setupDeleteButtons: function() {
      return $("#dorsale-comments [data-method=delete]").map(function() {
        return $(this).on("ajax:success", dorsaleComments.reload);
      });
    }
  };

}).call(this);
:ET

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dorsale-3.1.1 spec/dummy/tmp/cache/assets/sprockets/v3.0/9S/9SQPnx-mAbcvT47e7YMokRGCiLzY97CtomlFGP5SEhg.cache
dorsale-3.1.0 spec/dummy/tmp/cache/assets/sprockets/v3.0/9S/9SQPnx-mAbcvT47e7YMokRGCiLzY97CtomlFGP5SEhg.cache