Sha256: 1d6a00ef748a21ffbca11aaf5cf57b8e44e295d390dfeee0903a23a819c51dee

Contents?: true

Size: 1.52 KB

Versions: 96

Compression:

Stored size: 1.52 KB

Contents

(function() {
  var extendDeepData, mergeFilterContexts,
    hasProp = {}.hasOwnProperty;

  extendDeepData = function(data, prefix) {
    var i, key, len, name, obj, obj1, path, ref, results, value;
    results = [];
    for (key in data) {
      if (!hasProp.call(data, key)) continue;
      value = data[key];
      if (!(key.search(prefix) === 0)) {
        continue;
      }
      path = key.match(RegExp("([A-Z]|^" + prefix + ")[^A-Z]*", "g"));
      if (path[0] === prefix) {
        ref = path.slice(1).reverse();
        for (i = 0, len = ref.length; i < len; i++) {
          name = ref[i];
          value = (
            obj = {},
            obj["" + (name.toLowerCase())] = value,
            obj
          );
        }
        results.push($.extend(true, data, (
          obj1 = {},
          obj1["" + prefix] = value,
          obj1
        )));
      } else {
        results.push(void 0);
      }
    }
    return results;
  };

  mergeFilterContexts = function() {
    var cmsFields;
    cmsFields = $("[data-scrivito-field-type][data-scrivito-editors-filter-context],\n[data-scrivito-field-type^=\"html\"],\n[data-scrivito-field-type^=\"link\"],\n[data-scrivito-field-type^=\"reference\"]");
    return cmsFields.each(function() {
      var cmsField, data;
      cmsField = $(this);
      data = cmsField.data();
      return extendDeepData(data, 'scrivitoEditorsFilterContext');
    });
  };

  scrivito.on('content', function() {
    if (scrivito.in_editable_view()) {
      return mergeFilterContexts();
    }
  });

}).call(this);

Version data entries

96 entries across 96 versions & 1 rubygems

Version Path
scrivito_editors-1.7.0 app/assets/javascripts/scrivito_editors/filter_context.js
scrivito_editors-1.7.0.rc2 app/assets/javascripts/scrivito_editors/filter_context.js
scrivito_editors-1.5.5 app/assets/javascripts/scrivito_editors/filter_context.js
scrivito_editors-1.6.1 app/assets/javascripts/scrivito_editors/filter_context.js
scrivito_editors-1.6.1.rc1 app/assets/javascripts/scrivito_editors/filter_context.js
scrivito_editors-1.5.5.rc1 app/assets/javascripts/scrivito_editors/filter_context.js
scrivito_editors-1.4.3 app/assets/javascripts/scrivito_editors/filter_context.js
scrivito_editors-1.5.4 app/assets/javascripts/scrivito_editors/filter_context.js
scrivito_editors-1.7.0.rc1 app/assets/javascripts/scrivito_editors/filter_context.js
scrivito_editors-1.6.0 app/assets/javascripts/scrivito_editors/filter_context.js
scrivito_editors-1.6.0.rc5 app/assets/javascripts/scrivito_editors/filter_context.js
scrivito_editors-1.5.4.rc1 app/assets/javascripts/scrivito_editors/filter_context.js
scrivito_editors-1.6.0.rc4 app/assets/javascripts/scrivito_editors/filter_context.js
scrivito_editors-1.6.0.rc3 app/assets/javascripts/scrivito_editors/filter_context.js
scrivito_editors-1.5.3 app/assets/javascripts/scrivito_editors/filter_context.js
scrivito_editors-1.6.0.rc2 app/assets/javascripts/scrivito_editors/filter_context.js
scrivito_editors-1.5.3.rc1 app/assets/javascripts/scrivito_editors/filter_context.js
scrivito_editors-1.6.0.rc1 app/assets/javascripts/scrivito_editors/filter_context.js
scrivito_editors-1.5.2 app/assets/javascripts/scrivito_editors/filter_context.js
scrivito_editors-1.5.2.rc1 app/assets/javascripts/scrivito_editors/filter_context.js