Sha256: 460794589fc5f30e3b29d0c5ec788bf397679f852bb89d3e8c475a874e115143

Contents?: true

Size: 1.2 KB

Versions: 32

Compression:

Stored size: 1.2 KB

Contents

!(angular => {
  'use strict';

  function VisualizationImports(ModelManager) {

    let VisualizationBase = ModelManager.forModelName('visualization').modelClass();
    return class Visualization extends VisualizationBase {

      constructor() {
        super();
        this.hasSource  = this.itemHas.bind(this, 'html_source');
        this.hasTitle   = this.itemHas.bind(this, 'title');
      }

      itemHas(property) {
        return Utils.stringHelpers.isPresent(this.item[property]);
      }

      save(queryId, queryVersionId) {
        return this._save(queryId, queryVersionId);
      }

      destroy() {
        return super.destroy().then(() => this.initItem());
      }

      // private methods

      _save(queryId, queryVersionId) {
        if(this.isPersisted()) {
          return super.update(this.item);
        } else {
          let createParams = _.merge({
            query_id: queryId,
            query_version_id: queryVersionId
          }, this.item);

          return super.create(createParams);
        }
      }
    };
  }

  VisualizationImports.$inject = ['ModelManager'];
  angular.module('alephServices.visualization', []).service('Visualization', VisualizationImports);

}(angular));

Version data entries

32 entries across 16 versions & 1 rubygems

Version Path
aleph_analytics-0.4.9.pre.dev public/assets/angular/services/visualization/visualization.js-23e36c87721aa263dd3f99769027cabb.es6
aleph_analytics-0.4.9.pre.dev app/assets/javascripts/angular/services/visualization/visualization.js.es6
aleph_analytics-0.4.8 public/assets/angular/services/visualization/visualization.js-23e36c87721aa263dd3f99769027cabb.es6
aleph_analytics-0.4.8 app/assets/javascripts/angular/services/visualization/visualization.js.es6
aleph_analytics-0.4.7 app/assets/javascripts/angular/services/visualization/visualization.js.es6
aleph_analytics-0.4.7 public/assets/angular/services/visualization/visualization.js-23e36c87721aa263dd3f99769027cabb.es6
aleph_analytics-0.4.4 public/assets/angular/services/visualization/visualization.js-23e36c87721aa263dd3f99769027cabb.es6
aleph_analytics-0.4.4 app/assets/javascripts/angular/services/visualization/visualization.js.es6
aleph_analytics-0.4.2 public/assets/angular/services/visualization/visualization.js-23e36c87721aa263dd3f99769027cabb.es6
aleph_analytics-0.4.2 app/assets/javascripts/angular/services/visualization/visualization.js.es6
aleph_analytics-0.4.1 public/assets/angular/services/visualization/visualization.js-23e36c87721aa263dd3f99769027cabb.es6
aleph_analytics-0.4.1 app/assets/javascripts/angular/services/visualization/visualization.js.es6
aleph_analytics-0.3.0 public/assets/angular/services/visualization/visualization.js-23e36c87721aa263dd3f99769027cabb.es6
aleph_analytics-0.3.0 app/assets/javascripts/angular/services/visualization/visualization.js.es6
aleph_analytics-0.2.0 app/assets/javascripts/angular/services/visualization/visualization.js.es6
aleph_analytics-0.2.0 public/assets/angular/services/visualization/visualization.js-23e36c87721aa263dd3f99769027cabb.es6
aleph_analytics-0.1.0 public/assets/angular/services/visualization/visualization.js-23e36c87721aa263dd3f99769027cabb.es6
aleph_analytics-0.1.0 app/assets/javascripts/angular/services/visualization/visualization.js.es6
aleph_analytics-0.0.6 public/assets/angular/services/visualization/visualization.js-23e36c87721aa263dd3f99769027cabb.es6
aleph_analytics-0.0.6 app/assets/javascripts/angular/services/visualization/visualization.js.es6