toh82/page-generator

View on GitHub
web/public/src/js/app/collections/page.js

Summary

Maintainability
A
0 mins
Test Coverage
import Backbone from 'backbone'
import TemplateModel from '../models/template'

export default Backbone.Collection.extend({
  model: TemplateModel,
  loadAndAdd: function (model, options) {
    var addOptions = options || null
    var pageCollection = this

    model.loadTemplateHtml()
      .then(function () {
        pageCollection.add(model, addOptions)
      })
  }
})