Sha256: 80781243e7735661fad3bd5d550a740d5164be8bead0d2a87c2f1b9ce834bafc

Contents?: true

Size: 1005 Bytes

Versions: 4

Compression:

Stored size: 1005 Bytes

Contents

(function() {
  (function($) {

    $.fn.dismissible = function(options) {
      return this.each(function() {
        var _this = $(this);
        $('[data-dismissible-hide]', this).click(function(event) {
          event.preventDefault();
          return _this.dismiss(options);
        })
      });
    };

    return $.fn.dismiss = function(options) {
      return $.ajax({
        type: 'POST',
        url: '/dismissible_blocks.json',
        dataType: 'json',
        contentType: 'application/json',
        data: JSON.stringify({
          block: $(this).attr('data-dismissible'),
          authenticity_token: $('meta[name=csrf-token]').attr('content')
        }),
        success: (function(_this) {
          return function() {
            if ((options != null) && options.dismiss !== void 0) {
              return options.dismiss(_this);
            } else {
              return $(_this).remove();
            }
          }
        })(this)
      });
    };

  })(jQuery);
}).call(this);

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dismissible_blocks-1.2.0 app/assets/javascripts/dismissible_blocks.js
dismissible_blocks-1.1.1 app/assets/javascripts/dismissible_blocks.js
dismissible_blocks-1.1.0 app/assets/javascripts/dismissible_blocks.js
dismissible_blocks-0.0.2 app/assets/javascripts/dismissible_blocks.js