Sha256: 02c5b7af1415269d7c7b4488bb9f171a4345c1cf73ce0f3427fd5f45845a29a5

Contents?: true

Size: 1.17 KB

Versions: 32

Compression:

Stored size: 1.17 KB

Contents

!(angular => {
  'use strict';

  function StandardModelImports(DirtyAwareModel, ActionHandler) {

    return class StandardModel extends DirtyAwareModel {
      constructor(name, resource, newItem, dirtyAwareFields, dirtyAwareComparators) {
        super(resource, dirtyAwareFields, dirtyAwareComparators);
        this._handler = new ActionHandler(name, { modelItem: () => this.item });
        this._newItemObj = newItem;
      }

      fetch(params) {
        return this._handler.wrapFetch(super.fetch.bind(this, params));
      }

      destroy() {
        return this._handler.wrapDestroy(super.destroy.bind(this));
      }

      update(params) {
        return this._handler.wrapUpdate(super.update.bind(this, params));
      }

      create(params) {
        return this._handler.wrapCreate(super.create.bind(this, params));
      }

      _newItem() {
        // must ensure this method returns a fresh new object each time
        return angular.copy(this._newItemObj);
      }
    };
  }

  StandardModelImports.$inject = ['DirtyAwareModel', 'ActionHandler'];
  angular.module('modelGeneration.standardModel', ['models']).service('StandardModel', StandardModelImports);
}(angular));

Version data entries

32 entries across 16 versions & 1 rubygems

Version Path
aleph_analytics-0.4.9.pre.dev public/assets/angular/services/model_generation/standard_model.js-74439b041eebfc7e0fad454cf6e32192.es6
aleph_analytics-0.4.9.pre.dev app/assets/javascripts/angular/services/model_generation/standard_model.js.es6
aleph_analytics-0.4.8 public/assets/angular/services/model_generation/standard_model.js-74439b041eebfc7e0fad454cf6e32192.es6
aleph_analytics-0.4.8 app/assets/javascripts/angular/services/model_generation/standard_model.js.es6
aleph_analytics-0.4.7 app/assets/javascripts/angular/services/model_generation/standard_model.js.es6
aleph_analytics-0.4.7 public/assets/angular/services/model_generation/standard_model.js-74439b041eebfc7e0fad454cf6e32192.es6
aleph_analytics-0.4.4 public/assets/angular/services/model_generation/standard_model.js-74439b041eebfc7e0fad454cf6e32192.es6
aleph_analytics-0.4.4 app/assets/javascripts/angular/services/model_generation/standard_model.js.es6
aleph_analytics-0.4.2 public/assets/angular/services/model_generation/standard_model.js-74439b041eebfc7e0fad454cf6e32192.es6
aleph_analytics-0.4.2 app/assets/javascripts/angular/services/model_generation/standard_model.js.es6
aleph_analytics-0.4.1 public/assets/angular/services/model_generation/standard_model.js-74439b041eebfc7e0fad454cf6e32192.es6
aleph_analytics-0.4.1 app/assets/javascripts/angular/services/model_generation/standard_model.js.es6
aleph_analytics-0.3.0 public/assets/angular/services/model_generation/standard_model.js-74439b041eebfc7e0fad454cf6e32192.es6
aleph_analytics-0.3.0 app/assets/javascripts/angular/services/model_generation/standard_model.js.es6
aleph_analytics-0.2.0 app/assets/javascripts/angular/services/model_generation/standard_model.js.es6
aleph_analytics-0.2.0 public/assets/angular/services/model_generation/standard_model.js-74439b041eebfc7e0fad454cf6e32192.es6
aleph_analytics-0.1.0 public/assets/angular/services/model_generation/standard_model.js-74439b041eebfc7e0fad454cf6e32192.es6
aleph_analytics-0.1.0 app/assets/javascripts/angular/services/model_generation/standard_model.js.es6
aleph_analytics-0.0.6 public/assets/angular/services/model_generation/standard_model.js-74439b041eebfc7e0fad454cf6e32192.es6
aleph_analytics-0.0.6 app/assets/javascripts/angular/services/model_generation/standard_model.js.es6