Sha256: 86f2cef57add4fe0d46cbaf0a36634b12e8096571c40d18a5f78f3307fe6be23

Contents?: true

Size: 1.23 KB

Versions: 7

Compression:

Stored size: 1.23 KB

Contents

/**
 * Extends / overrides:
 * decidim/admin/dynamic_fields.component
 *
 * Fixes broken attachments in IE11 by overriding the `_addField` method in the
 *`DynamicFieldsComponent` coming from the `decidim-admin` component.
 *
 * For further details, see:
 * https://github.com/mainio/decidim-module-plans/issues/13
**/

((exports) => {
  const { DynamicFieldsComponent } = exports.DecidimAdmin;

  class DynamicFieldsComponentExtended extends DynamicFieldsComponent {
    _addField() {
      const $container = $(this.wrapperSelector).find(this.containerSelector);
      // START OVERRIDE
      const $template = $(this.wrapperSelector).children(".decidim-template");
      // END OVERRIDE
      const $newField = $($template.html()).template(this.placeholderId, this._getUID());

      $newField.find("ul.tabs").attr("data-tabs", true);

      $newField.appendTo($container);
      $newField.foundation();

      if (this.onAddField) {
        this.onAddField($newField);
      }
    }
  }

  exports.DecidimAdmin = exports.DecidimAdmin || {};
  exports.DecidimAdmin.DynamicFieldsComponent = DynamicFieldsComponentExtended;
  exports.DecidimAdmin.createDynamicFields = (options) => {
    return new DynamicFieldsComponentExtended(options);
  };
})(window);

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-plans-0.18.2 app/assets/javascripts/decidim/plans/multifield/dynamic_fields.component.js.es6
decidim-plans-0.18.1 app/assets/javascripts/decidim/plans/multifield/dynamic_fields.component.js.es6
decidim-plans-0.18.0 app/assets/javascripts/decidim/plans/multifield/dynamic_fields.component.js.es6
decidim-plans-0.17.0 app/assets/javascripts/decidim/plans/multifield/dynamic_fields.component.js.es6
decidim-plans-0.16.9 app/assets/javascripts/decidim/plans/multifield/dynamic_fields.component.js.es6
decidim-plans-0.16.8 app/assets/javascripts/decidim/plans/multifield/dynamic_fields.component.js.es6
decidim-plans-0.16.7 app/assets/javascripts/decidim/plans/multifield/dynamic_fields.component.js.es6