Sha256: 5631e0773a2d7392b3e90cb6c30a1c8a45ed896944e4b79533256f750d857b0d

Contents?: true

Size: 1.66 KB

Versions: 6

Compression:

Stored size: 1.66 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);
      return $(document).trigger("page:load");
    },
    close: function() {
      $(".modal").remove();
      return $("body").removeClass("modal-open");
    },
    openLink: 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;
    },
    openForm: 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;
    },
    setup: function(scope) {
      scope = $(scope || document);
      scope.find("a[data-modal=1], .modal-body a:not([data-modal=0])").on("click", openLink);
      return scope.find("form[data-modal=1], .modal-body form:not([data-modal=0])").on("submit", openForm);
    }
  };

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