Sha256: 9ea97b78e4d118a70713322b3179edda9c6ced873e9bf632b642f3f39b0888b3

Contents?: true

Size: 1.61 KB

Versions: 45

Compression:

Stored size: 1.61 KB

Contents

(function() {
  var DATA_ATTRIBUTES, _deprecationLogged;

  DATA_ATTRIBUTES = ['autosave', 'date-format', 'filter-context', 'filters', 'max', 'min', 'newlines', 'placeholder', 'reload', 'step', 'time-format', 'values'];

  _deprecationLogged = [];

  scrivito.on('content', function(element) {
    var attribute, cmsElement, cmsField, cmsFields, i, len, newAttribute, results, value;
    if (!scrivito.in_editable_view()) {
      return;
    }
    cmsFields = $(element).addBack().find('[data-scrivito-field-type]');
    results = [];
    for (i = 0, len = cmsFields.length; i < len; i++) {
      cmsElement = cmsFields[i];
      cmsField = $(cmsElement);
      results.push((function() {
        var j, len1, results1;
        results1 = [];
        for (j = 0, len1 = DATA_ATTRIBUTES.length; j < len1; j++) {
          attribute = DATA_ATTRIBUTES[j];
          value = cmsField.data(attribute);
          if (value !== void 0) {
            newAttribute = attribute.replace('newlines', 'multiline');
            cmsField.data("scrivito-editors-" + newAttribute, value);
            cmsField.attr("data-scrivito-editors-" + newAttribute, cmsField.attr("data-" + attribute));
            if (!_deprecationLogged[attribute]) {
              _deprecationLogged[attribute] = true;
              results1.push(console.warn("data-" + attribute + " is deprecated, please use data-scrivito-editors-" + newAttribute + "."));
            } else {
              results1.push(void 0);
            }
          } else {
            results1.push(void 0);
          }
        }
        return results1;
      })());
    }
    return results;
  });

}).call(this);

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
scrivito_editors-1.0.0.rc1 app/assets/javascripts/scrivito_editors/deprecated_data_attrs.js
scrivito_editors-0.90.0 app/assets/javascripts/scrivito_editors/deprecated_data_attrs.js
scrivito_editors-0.90.0.rc3 app/assets/javascripts/scrivito_editors/deprecated_data_attrs.js
scrivito_editors-0.90.0.rc2 app/assets/javascripts/scrivito_editors/deprecated_data_attrs.js
scrivito_editors-0.90.0.rc1 app/assets/javascripts/scrivito_editors/deprecated_data_attrs.js