Hi! Thank you for this great module.
Please provide some exampleas of using UserModel and CommentModel. I am trying to make module which show index list of users. Code based on example app. But with no luck. I receive this error: "node is not defined .. unders...v=1.3.1 (строка 1030)".I spend so much hours with that. What I am doung wrong. Thank you. My code mdrive_app.js:

(function($) {
  Drupal.behaviors.mdrive = {
    // ## attach()
    attach: function() {
      // ### NodeView
      var NodeView = Drupal.Backbone.View.extend({
        templateSelector: '#mdrive-node-template',
        // #### NodeView.initialize()
        initialize: function(opts) {
          this.model = opts.model;
          this.model.bind('change', this.render, this);
          Drupal.Backbone.View.prototype.initialize.apply(this);
        }
      });
      // ### AppView
      var AppView = Drupal.Backbone.View.extend({
        templateSelector: '#mdrive-app-template',
        // #### AppView.events
        events: {
          'click .loadme': 'doLoadProfile'
        },
        // #### AppView.initialize()
        initialize: function() {
          Drupal.Backbone.View.prototype.initialize.apply(this);
          _.bindAll(this, 'doLoadProfile');
          this.userModel = new Drupal.Backbone.UserModel();
          this.userView = new NodeView({model: this.userModel});
          $('#mdrive-app').append(this.render().el);
          this.$('#mdrive-profile-container').append(this.userView.render().el);
        },
        // #### AppView.doLoadProfile()
        doLoadProfile: function() {
          var uid = 2;
          this.userModel.set('user', uid);
          this.userModel.fetch();
        }
      });
      // ### Start the app!
      var app = new AppView();
    },
    // ## unattach()
    unattach: function() {
      $('#mdrive-app').html('');
    }
  };
})(jQuery);

Comments

ethanw’s picture

Now that we have RestWS working, you should be able to easily adapt the new backbone_restws_examples module to work with users. I think that examples for each of the common entity types is a good idea.

ethanw’s picture

Title: Please provide some examples » Please provide some examples using other entity types (users, comments, etc.)
ethanw’s picture

Title: Please provide some examples using other entity types (users, comments, etc.) » Provide some examples using other entity types (users, comments, etc.)