Sha256: 973ff8f8ff1e500c629fc2665565c9e291072480f690926d80c307d0b86d57b9

Contents?: true

Size: 1.32 KB

Versions: 58

Compression:

Stored size: 1.32 KB

Contents

/**
 * pageflow.Failure and subclasses are used in the failures api.
 *
 * Subclasses that represent failures that are can not be retried should
 * override `catRetry` with false.
 * Retryable failures should implement `retryAction`.
 *
 * @class
 * @memberof module:pageflow/editor
 */
pageflow.Failure = pageflow.Object.extend({
  canRetry: true,
  type: 'Failure',

  initialize: function(model) {
    this.model = model;
  },

  retry: function() {
    if (this.canRetry) {
      return this.retryAction();
    }
  },

  retryAction: function() {
    return this.model.save();
  },

  key: function() {
    return this.model.cid + '-' + this.type;
  }
});

/**
 * SavingFailure represents a unsuccessful attempt to save
 * a model on the server.
 *
 * @class
 * @memberof module:pageflow/editor
 */
pageflow.SavingFailure = pageflow.Failure.extend({
  type: 'SavingFailure'
});

/**
 *  OrderingFailure represent a unsuccessful attempt to save
 *  the ordering of a pageflow.orderedCollection.
 *
 * @class
 * @memberof module:pageflow/editor
 */
pageflow.OrderingFailure = pageflow.Failure.extend({
  type: 'OrderingFailure',

  initialize: function(model, collection) {
    pageflow.Failure.prototype.initialize.call(this, model);
    this.collection = collection;
  },

  retryAction: function() {
    return this.collection.saveOrder();
  }
});

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
pageflow-14.5.2 app/assets/javascripts/pageflow/editor/api/failure.js
pageflow-15.0.2 app/assets/javascripts/pageflow/editor/api/failure.js
pageflow-15.0.1 app/assets/javascripts/pageflow/editor/api/failure.js
pageflow-15.0.0 app/assets/javascripts/pageflow/editor/api/failure.js
pageflow-14.5.1 app/assets/javascripts/pageflow/editor/api/failure.js
pageflow-14.5.0 app/assets/javascripts/pageflow/editor/api/failure.js
pageflow-15.0.0.rc2 app/assets/javascripts/pageflow/editor/api/failure.js
pageflow-15.0.0.rc1 app/assets/javascripts/pageflow/editor/api/failure.js
pageflow-15.0.0.beta4 app/assets/javascripts/pageflow/editor/api/failure.js
pageflow-15.0.0.beta3 app/assets/javascripts/pageflow/editor/api/failure.js
pageflow-14.4.0 app/assets/javascripts/pageflow/editor/api/failure.js
pageflow-15.0.0.beta2 app/assets/javascripts/pageflow/editor/api/failure.js
pageflow-15.0.0.beta1 app/assets/javascripts/pageflow/editor/api/failure.js
pageflow-14.3.0 app/assets/javascripts/pageflow/editor/api/failure.js
pageflow-14.2.1 app/assets/javascripts/pageflow/editor/api/failure.js
pageflow-14.2.0 app/assets/javascripts/pageflow/editor/api/failure.js
pageflow-14.1.1 app/assets/javascripts/pageflow/editor/api/failure.js
pageflow-14.1.0 app/assets/javascripts/pageflow/editor/api/failure.js
pageflow-14.0.0 app/assets/javascripts/pageflow/editor/api/failure.js
pageflow-14.0.0.rc2 app/assets/javascripts/pageflow/editor/api/failure.js