Sha256: 2f467b88e7c0446645ba4c6c4556b37be1f51d4c1cc99fc9d3716210e6fe5f9a

Contents?: true

Size: 1.65 KB

Versions: 4

Compression:

Stored size: 1.65 KB

Contents

I"Œ(function() {
  if (typeof window.Alchemy === 'undefined') {
    window.Alchemy = {};
  }

  Alchemy.Buttons = {
    observe: function(scope) {
      return $('form', scope).not('.button_with_label form').on('submit', function(event) {
        var $btn, $form, $outside_button;
        $form = $(this);
        $btn = $form.find(':submit');
        $outside_button = $('[data-alchemy-button][form="' + $form.attr('id') + '"]');
        if (($btn.attr('disabled') === 'disabled') || ($outside_button.attr('disabled') === 'disabled')) {
          event.preventDefault();
          event.stopPropagation();
          return false;
        } else {
          Alchemy.Buttons.disable($btn);
          if ($outside_button) {
            Alchemy.Buttons.disable($outside_button);
          }
          return true;
        }
      });
    },
    disable: function(button) {
      var $button, spinner;
      $button = $(button);
      spinner = new Alchemy.Spinner('small');
      $button.data('content', $button.html());
      $button.attr('disabled', true);
      $button.addClass('disabled');
      $button.css({
        width: $button.outerWidth()
      });
      $button.empty();
      spinner.spin($button);
      return true;
    },
    enable: function(scope) {
      var $buttons;
      $buttons = $('form :submit:disabled, [data-alchemy-button].disabled', scope);
      $.each($buttons, function() {
        var $button;
        $button = $(this);
        $button.removeClass('disabled');
        $button.removeAttr('disabled');
        $button.css("width", "");
        return $button.html($button.data('content'));
      });
      return true;
    }
  };

}).call(this);
:ET

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
alchemy-solidus-2.2.0 spec/dummy/tmp/cache/assets/sprockets/v3.0/Y7/y7ZbPUjCCIiZiixtWUwFDzzn8W0yRok1RMPrvnnGJrg.cache
alchemy-devise-4.0.0 spec/dummy/tmp/cache/assets/sprockets/v3.0/Y7/y7ZbPUjCCIiZiixtWUwFDzzn8W0yRok1RMPrvnnGJrg.cache
alchemy-devise-3.6.0 spec/dummy/tmp/cache/assets/sprockets/v3.0/Y7/y7ZbPUjCCIiZiixtWUwFDzzn8W0yRok1RMPrvnnGJrg.cache
alchemy-devise-3.5.0 spec/dummy/tmp/cache/assets/sprockets/v3.0/y7/y7ZbPUjCCIiZiixtWUwFDzzn8W0yRok1RMPrvnnGJrg.cache