/cdnsrc/js/collection/DocumentCollection.js
JavaScript | 30 lines | 27 code | 1 blank | 2 comment | 0 complexity | 08a6c6455a63ea5a3cd118d9989975ea MD5 | raw file
Possible License(s): Apache-2.0
- var DocumentCollection = Backbone.Collection.extend({
- initialize : function (args) {
- return this;
- }
-
- // A helper method to allow a collection to insert new models without
- // requiring user input.
- ,addRandomDocument : function (i)
- {
- var d = new Date();
- var instance =
- {
- id:
- i
- ,summary:
- 'Random: ' + randomWords(Math.floor(Math.random()*8)+2)
- ,created:
- d.getMonth() + '/' + d.getDate() + '/' + d.getFullYear()
- ,modified:
- d.getMonth() + '/' + d.getDate() + '/' + d.getFullYear()
- ,description:
- 'This content was randomly generated. ' +
- randomWords(Math.floor(Math.random()*106)+2)
- ,author:
- 'Aaron Greenlee'
- };
- var doc = new DocumentModel(instance);
- this.add( doc );
- }
- });