Sha256: 363ee0a50379f28629e3dd3bff5ca069f33fe63330ca2add73c1b92be5fbed00

Contents?: true

Size: 731 Bytes

Versions: 23

Compression:

Stored size: 731 Bytes

Contents

mumuki.Button = class {

  constructor($button, $container) {
    this.$button = $button;
    this.$container = $container || $button;
    this.originalContent = $button.html();
  }

  disable () {
    this.$container.attr('disabled', 'disabled');
  }

  setWaiting () {
    this.preventClick();
    this.setWaitingText();
  }

  enable () {
    this.setOriginalContent();
    this.$container.removeAttr('disabled');
  }

  setWaitingText () {
    this.$button.html('<i class="fa fa-refresh fa-spin"></i> ' + this.$button.attr('data-waiting'));
  }

  setOriginalContent () {
    this.$button.html(this.originalContent);
  }

  preventClick () {
    this.disable();
    this.$button.on('click', (e) => e.preventDefault());
  }
};

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
mumuki-laboratory-7.6.2 app/assets/javascripts/mumuki_laboratory/application/button.js
mumuki-laboratory-7.6.1 app/assets/javascripts/mumuki_laboratory/application/button.js
mumuki-laboratory-7.6.0 app/assets/javascripts/mumuki_laboratory/application/button.js
mumuki-laboratory-7.5.2 app/assets/javascripts/mumuki_laboratory/application/button.js
mumuki-laboratory-7.5.1 app/assets/javascripts/mumuki_laboratory/application/button.js
mumuki-laboratory-7.5.0 app/assets/javascripts/mumuki_laboratory/application/button.js
mumuki-laboratory-7.4.2 app/assets/javascripts/mumuki_laboratory/application/button.js
mumuki-laboratory-7.4.1 app/assets/javascripts/mumuki_laboratory/application/button.js
mumuki-laboratory-7.4.0 app/assets/javascripts/mumuki_laboratory/application/button.js
mumuki-laboratory-7.3.1 app/assets/javascripts/mumuki_laboratory/application/button.js
mumuki-laboratory-7.3.0 app/assets/javascripts/mumuki_laboratory/application/button.js
mumuki-laboratory-7.2.0 app/assets/javascripts/mumuki_laboratory/application/button.js
mumuki-laboratory-7.1.0 app/assets/javascripts/mumuki_laboratory/application/button.js
mumuki-laboratory-7.0.12 app/assets/javascripts/mumuki_laboratory/application/button.js
mumuki-laboratory-7.0.11 app/assets/javascripts/mumuki_laboratory/application/button.js
mumuki-laboratory-7.0.10 app/assets/javascripts/mumuki_laboratory/application/button.js
mumuki-laboratory-7.0.9 app/assets/javascripts/mumuki_laboratory/application/button.js
mumuki-laboratory-7.0.8 app/assets/javascripts/mumuki_laboratory/application/button.js
mumuki-laboratory-7.0.7 app/assets/javascripts/mumuki_laboratory/application/button.js
mumuki-laboratory-7.0.6 app/assets/javascripts/mumuki_laboratory/application/button.js