PageRenderTime 60ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/js/listed.js

https://bitbucket.org/colinbate/listed
JavaScript | 41 lines | 32 code | 9 blank | 0 comment | 3 complexity | 863f0d80f07dc75ff9673228a54a348e MD5 | raw file
  1. jQuery(function () {
  2. Backbone.couch_connector.config.db_name = "listed-test";
  3. Backbone.couch_connector.config.ddoc_name = "listed_test";
  4. Backbone.couch_connector.config.base_url = "http://127.0.0.1:5984";
  5. Backbone.couch_connector.config.global_changes = false;
  6. _.templateSettings = {
  7. interpolate : /\{\{(.+?)\}\}/g
  8. };
  9. var ListItem = Backbone.Model.extend({
  10. initialize : function(){
  11. if (!this.get('date')) {
  12. this.set({'date': new Date().getTime()});
  13. }
  14. }
  15. });
  16. var ListItemCollection = Backbone.Collection.extend({
  17. model: ListItem
  18. });
  19. var ListModel = Backbone.Model.extend({
  20. defaults: {
  21. title: 'Untitled'
  22. },
  23. initialize : function(){
  24. if (!this.get('created')) {
  25. this.set({'created': new Date().getTime()});
  26. }
  27. if (!this.get('items')) {
  28. this.set('items', new ListItemCollection());
  29. }
  30. }
  31. });
  32. });