mohnish/money

View on GitHub
app/assets/javascripts/money/views/repeat_intervals_view.js

Summary

Maintainability
C
1 day
Test Coverage

M.RepeatIntervalsView = M.BaseView.extend({
  el: '#repeat-intervals',

  collection: new M.RepeatIntervals(),

  templatePath: 'repeat_intervals/index',

  initialize: function() {
    this.listenTo(this.collection, 'sync', this.handleSync);
    this.listenTo(this.collection, 'error', this.handleError);
    this.collection.fetch();
  },

  render: function() {
    this.$el.html(this.template({ repeatIntervals: this.collection.toJSON(), selectedId: this.selectedId }));
    return this;
  },

  handleSync: function() {
    this.render();
  },

  handleError: function(collection, response, options) {
  }
});