Sha256: e3a73a60379562941b4dc8c0251d2f38fb3d0aa5387527765d672e7cdf841254

Contents?: true

Size: 1.58 KB

Versions: 77

Compression:

Stored size: 1.58 KB

Contents

pageflow.NotificationsView = Backbone.Marionette.ItemView.extend({
  className: 'notifications',
  tagName: 'ul',
  template: 'templates/notifications',

  ui: {
    failedCount: '.failed .count',
    uploadingCount: '.uploading .count',
    confirmableFilesCount: '.confirmable_files .count',
  },

  events: {
    'click .retry': function() {
      pageflow.editor.failures.retry();
    }
  },

  onRender: function() {
    this.listenTo(pageflow.entry, 'change:uploading_files_count', this.notifyUploadCount);
    this.listenTo(pageflow.entry, 'change:confirmable_files_count', this.notifyConfirmableFilesCount);

    this.listenTo(pageflow.savingRecords, 'add', this.update);
    this.listenTo(pageflow.savingRecords, 'remove', this.update);

    this.listenTo(pageflow.editor.failures, 'add', this.update);
    this.listenTo(pageflow.editor.failures, 'remove', this.update);

    this.update();
    this.notifyConfirmableFilesCount();
  },

  update: function() {
    this.$el.toggleClass('failed', !pageflow.editor.failures.isEmpty());
    this.$el.toggleClass('saving', !pageflow.savingRecords.isEmpty());
    this.ui.failedCount.text(pageflow.editor.failures.count());
  },

  notifyUploadCount: function(model, uploadCount) {
    this.$el.toggleClass('uploading', uploadCount > 0);
    this.ui.uploadingCount.text(uploadCount);
  },

  notifyConfirmableFilesCount: function() {
    var confirmableFilesCount = pageflow.entry.get('confirmable_files_count');

    this.$el.toggleClass('has_confirmable_files', confirmableFilesCount > 0);
    this.ui.confirmableFilesCount.text(confirmableFilesCount);
  }
});

Version data entries

77 entries across 77 versions & 1 rubygems

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