Sha256: c0b23ed10eae0f3b0a53c7bdd6f265dc9695930d659df8e21c3004aef57b27c2

Contents?: true

Size: 1.58 KB

Versions: 6

Compression:

Stored size: 1.58 KB

Contents

I"B(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);
      return $(document).trigger("page:load");
    },
    close: function() {
      $(".modal").remove();
      return $("body").removeClass("modal-open");
    },
    xhrLoad: function() {
      var type, url;
      modal.open("Chargement...");
      if (this.method) {
        type = this.method.toUpperCase();
      } else {
        type = "GET";
      }
      alert(type);
      url = this.href || this.action || null;
      $.ajax({
        url: url,
        type: type,
        dataType: "html",
        success: function(data) {
          return modal.open(data);
        },
        error: function() {
          return modal.open("Erreur");
        }
      });
      return false;
    },
    setup: function(scope) {
      scope = $(scope || document);
      scope.find("a[data-modal=1], .modal-body a:not([data-modal=0])").off("click", modal.xhrLoad).on("click", modal.xhrLoad);
      return scope.find("form[data-modal=1], .modal-body form:not([data-modal=0])").off("submit", modal.xhrLoad).on("submit", modal.xhrLoad);
    }
  };

  $(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/lvjbL7wF3S1AS2x2IlXjx5U6tPUCN_5VgH_Yl5W_eyk.cache
dorsale-2.6.2 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/lvjbL7wF3S1AS2x2IlXjx5U6tPUCN_5VgH_Yl5W_eyk.cache
dorsale-2.6.1 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/lvjbL7wF3S1AS2x2IlXjx5U6tPUCN_5VgH_Yl5W_eyk.cache
dorsale-2.6.0 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/lvjbL7wF3S1AS2x2IlXjx5U6tPUCN_5VgH_Yl5W_eyk.cache
dorsale-2.5.0 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/lvjbL7wF3S1AS2x2IlXjx5U6tPUCN_5VgH_Yl5W_eyk.cache
dorsale-2.4.3 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/lvjbL7wF3S1AS2x2IlXjx5U6tPUCN_5VgH_Yl5W_eyk.cache