Sha256: b37c680478253dafa141abdebb8db4919b5d24bdb700c55fa4a181240f45ee94

Contents?: true

Size: 847 Bytes

Versions: 18

Compression:

Stored size: 847 Bytes

Contents

!(angular => {
  'use strict';

  function QueryRequestTransformers() {
    const saveFields =  ['id', 'title', 'body', 'tags', 'result_id', 'version', 'roles'];

    // see https://github.com/mbenford/ngTagsInput
    function transformNgTagsInput(fieldName, query) {
      let ngTags = query[fieldName];
      if (_.exists(ngTags)) {
        query[fieldName] = _.map(ngTags, ngTagItem =>  _.exists(ngTagItem.text) ? ngTagItem.text : ngTagItem);
      }
      return query;
    }

    return [
      query => transformNgTagsInput('tags', query),
      query => transformNgTagsInput('roles', query),
      query => { return { query: _.selectKeys(query, saveFields) }; },
      angular.toJson
    ];
  }

  angular.module('alephServices.queryRequestTransformers', [])
    .service('QueryRequestTransformers', QueryRequestTransformers);
}(angular));

Version data entries

18 entries across 9 versions & 1 rubygems

Version Path
aleph_analytics-0.2.0 app/assets/javascripts/angular/services/query/query_request_transformers.js.es6
aleph_analytics-0.2.0 public/assets/angular/services/query/query_request_transformers.js-522901477c7848324cd5c014005a85c8.es6
aleph_analytics-0.1.0 app/assets/javascripts/angular/services/query/query_request_transformers.js.es6
aleph_analytics-0.1.0 public/assets/angular/services/query/query_request_transformers.js-522901477c7848324cd5c014005a85c8.es6
aleph_analytics-0.0.6 public/assets/angular/services/query/query_request_transformers.js-522901477c7848324cd5c014005a85c8.es6
aleph_analytics-0.0.6 app/assets/javascripts/angular/services/query/query_request_transformers.js.es6
aleph_analytics-0.0.5 app/assets/javascripts/angular/services/query/query_request_transformers.js.es6
aleph_analytics-0.0.5 public/assets/angular/services/query/query_request_transformers.js-522901477c7848324cd5c014005a85c8.es6
aleph_analytics-0.0.4 public/assets/angular/services/query/query_request_transformers.js-522901477c7848324cd5c014005a85c8.es6
aleph_analytics-0.0.4 app/assets/javascripts/angular/services/query/query_request_transformers.js.es6
aleph_analytics-0.0.3 public/assets/angular/services/query/query_request_transformers.js-522901477c7848324cd5c014005a85c8.es6
aleph_analytics-0.0.3 app/assets/javascripts/angular/services/query/query_request_transformers.js.es6
aleph_analytics-0.0.2 public/assets/angular/services/query/query_request_transformers.js-522901477c7848324cd5c014005a85c8.es6
aleph_analytics-0.0.2 app/assets/javascripts/angular/services/query/query_request_transformers.js.es6
aleph_analytics-0.0.1.alpha app/assets/javascripts/angular/services/query/query_request_transformers.js.es6
aleph_analytics-0.0.1.alpha public/assets/angular/services/query/query_request_transformers.js-522901477c7848324cd5c014005a85c8.es6
aleph_analytics-0.0.0.alpha public/assets/angular/services/query/query_request_transformers.js-522901477c7848324cd5c014005a85c8.es6
aleph_analytics-0.0.0.alpha app/assets/javascripts/angular/services/query/query_request_transformers.js.es6