PageRenderTime 55ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/src/js-example/collections/commits.js

https://github.com/coltonTB/ezel
JavaScript | 28 lines | 13 code | 6 blank | 9 comment | 0 complexity | 40abaf5825975192acb75530f61aaf33 MD5 | raw file
Possible License(s): MIT
  1. //
  2. // Collection for GitHub "commits".
  3. //
  4. // [Sharify](https://github.com/artsy/sharify) lets us require the API url
  5. // and Backbone.sync is replaced with a server-side HTTP module in /lib/setup
  6. // using [Backbone Super Sync](https://github.com/artsy/backbone-super-sync).
  7. // This combined with [browerify](https://github.com/substack/node-browserify)
  8. // makes it simple to share this module in the browser and on the server.
  9. //
  10. var Backbone = require('backbone'),
  11. sd = require('sharify').data,
  12. Commit = require('../models/commit');
  13. module.exports = Commits = Backbone.Collection.extend({
  14. model: Commit,
  15. url: function() {
  16. return sd.API_URL + '/repos/' + this.owner + '/' + this.repo + '/commits';
  17. },
  18. initialize: function(models, options) {
  19. this.owner = options.owner;
  20. this.repo = options.repo;
  21. }
  22. });