Sha256: 615b7e918becc5a0762b3338a82f32cb20f8b64c42f0b528e41bc9954d93c25d

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

pageflow.EncodingConfirmation = Backbone.Model.extend({
  paramRoot: 'encoding_confirmation',

  initialize: function() {
    this.videoFiles = new Backbone.Collection();
    this.audioFiles = new Backbone.Collection();

    this.watchCollections();
  },

  watchCollections: function() {
    this.listenTo(this.videoFiles, 'add remove', this.check);
    this.listenTo(this.audioFiles, 'add remove', this.check);

    this.check();
  },

  check: function() {
    var model = this;

    this.set('empty', this.videoFiles.length === 0 && this.audioFiles.length === 0);
    this.set('checking', true);

    this.save({}, {
      url: this.url() + '/check',
      success: function() {
        model.set('checking', false);
      },
      error: function() {
        model.set('checking', false);
      }
    });
  },

  url: function() {
    return '/editor/entries/' + pageflow.entry.get('id') + '/encoding_confirmations';
  },

  toJSON: function() {
    return {
      video_file_ids: this.videoFiles.pluck('id'),
      audio_file_ids: this.audioFiles.pluck('id'),
    };
  }
});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pageflow-0.3.0 app/assets/javascripts/pageflow/editor/models/encoding_confirmation.js
pageflow-0.2.1 app/assets/javascripts/pageflow/editor/models/encoding_confirmation.js
pageflow-0.2.0 app/assets/javascripts/pageflow/editor/models/encoding_confirmation.js