Sha256: 4540ed7e1b7c479d7ff90da2644e81429951201dfb0b65bbdf38d9d7ca330171

Contents?: true

Size: 1.69 KB

Versions: 6

Compression:

Stored size: 1.69 KB

Contents

I"²(function() {
  window.modal = {
    open: function(content) {
      var modal_html;
      this.close();
      $("body").addClass("modal-open");
      modal_html = $("<div class='modal'> <div class='modal-overlay'></div> <button class='modal-close'></button> <div class='modal-body'>" + content + "</div> </div>");
      modal_html.find(".modal-overlay, .modal-close").click(function() {
        return modal.close();
      });
      $("body").append(modal_html);
      this.setup(modal_html);
      return $(modal_html).trigger("page:load");
    },
    close: function() {
      $(".modal").remove();
      return $("body").removeClass("modal-open");
    },
    setup: function(scope) {
      scope = $(scope || document);
      scope.find("a[data-modal=1], .modal-body a:not([data-modal=0])").click(function() {
        modal.open("Chargement...");
        $.ajax({
          url: this.href,
          dataType: "html",
          success: function(data) {
            return modal.open(data);
          },
          error: function() {
            return modal.open("Erreur");
          }
        });
        return false;
      });
      return scope.find("form[data-modal=1], .modal-body form:not([data-modal=0])").submit(function() {
        $.ajax({
          url: this.action,
          dataType: "html",
          type: this.method.toUpperCase(),
          data: $(this).serialize(),
          success: function(data) {
            return modal.open(data);
          },
          error: function() {
            return modal.open("Erreur");
          }
        });
        return false;
      });
    }
  };

  $(document).on("ready page:load", function() {
    return modal.setup();
  });

}).call(this);
:ET

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dorsale-2.6.3 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/k742ncxpq0djWbYw2XBXnQrWDaBBzGH2VuiDeOioLqM.cache
dorsale-2.6.2 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/k742ncxpq0djWbYw2XBXnQrWDaBBzGH2VuiDeOioLqM.cache
dorsale-2.6.1 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/k742ncxpq0djWbYw2XBXnQrWDaBBzGH2VuiDeOioLqM.cache
dorsale-2.6.0 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/k742ncxpq0djWbYw2XBXnQrWDaBBzGH2VuiDeOioLqM.cache
dorsale-2.5.0 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/k742ncxpq0djWbYw2XBXnQrWDaBBzGH2VuiDeOioLqM.cache
dorsale-2.4.3 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/k742ncxpq0djWbYw2XBXnQrWDaBBzGH2VuiDeOioLqM.cache