Sha256: a47dd9b329c00291cbb862013c0341599fb5a21f733397437d0af8b6f36aa516

Contents?: true

Size: 653 Bytes

Versions: 32

Compression:

Stored size: 653 Bytes

Contents

!(angular => {
  'use strict';

  /* Dirty Aware methods for a collection of DirtyAwareModel's */

  class CollectionDirtyAwareness {

    constructor(models) {
      this._models = models;
    }

    dirtyItems() {
      return _.filter(this._models(), model => model.isDirty());
    }

    isDirty() {
      return this.dirtyItems().length > 0;
    }

    isPristine() {
      return !this.isDirty();
    }

    revert() {
      _.each(this._models(), model => {
        model.revert();
      });
    }
  }

  angular.module('models.collectionDirtyAwareness', [])
    .service('CollectionDirtyAwareness', () => CollectionDirtyAwareness);
}(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/collection_dirty_awareness.js-8a78450bd8b565fb03633ab735893508.es6
aleph_analytics-0.4.9.pre.dev app/assets/javascripts/angular/services/model/collection_dirty_awareness.js.es6
aleph_analytics-0.4.8 public/assets/angular/services/model/collection_dirty_awareness.js-8a78450bd8b565fb03633ab735893508.es6
aleph_analytics-0.4.8 app/assets/javascripts/angular/services/model/collection_dirty_awareness.js.es6
aleph_analytics-0.4.7 app/assets/javascripts/angular/services/model/collection_dirty_awareness.js.es6
aleph_analytics-0.4.7 public/assets/angular/services/model/collection_dirty_awareness.js-8a78450bd8b565fb03633ab735893508.es6
aleph_analytics-0.4.4 public/assets/angular/services/model/collection_dirty_awareness.js-8a78450bd8b565fb03633ab735893508.es6
aleph_analytics-0.4.4 app/assets/javascripts/angular/services/model/collection_dirty_awareness.js.es6
aleph_analytics-0.4.2 public/assets/angular/services/model/collection_dirty_awareness.js-8a78450bd8b565fb03633ab735893508.es6
aleph_analytics-0.4.2 app/assets/javascripts/angular/services/model/collection_dirty_awareness.js.es6
aleph_analytics-0.4.1 public/assets/angular/services/model/collection_dirty_awareness.js-8a78450bd8b565fb03633ab735893508.es6
aleph_analytics-0.4.1 app/assets/javascripts/angular/services/model/collection_dirty_awareness.js.es6
aleph_analytics-0.3.0 public/assets/angular/services/model/collection_dirty_awareness.js-8a78450bd8b565fb03633ab735893508.es6
aleph_analytics-0.3.0 app/assets/javascripts/angular/services/model/collection_dirty_awareness.js.es6
aleph_analytics-0.2.0 app/assets/javascripts/angular/services/model/collection_dirty_awareness.js.es6
aleph_analytics-0.2.0 public/assets/angular/services/model/collection_dirty_awareness.js-8a78450bd8b565fb03633ab735893508.es6
aleph_analytics-0.1.0 public/assets/angular/services/model/collection_dirty_awareness.js-8a78450bd8b565fb03633ab735893508.es6
aleph_analytics-0.1.0 app/assets/javascripts/angular/services/model/collection_dirty_awareness.js.es6
aleph_analytics-0.0.6 public/assets/angular/services/model/collection_dirty_awareness.js-8a78450bd8b565fb03633ab735893508.es6
aleph_analytics-0.0.6 app/assets/javascripts/angular/services/model/collection_dirty_awareness.js.es6