Skip to content

Instantly share code, notes, and snippets.

@rbpasker
Created February 5, 2013 18:56

Revisions

  1. rbpasker created this gist Feb 5, 2013.
    25 changes: 25 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    Backbone.Cloudant.database = "/sandbox/";
    // start the change handler
    // Backbone.Cloudant.changeHandler();


    PersonView = Backbone.View.extend({
    initialize: function () {
    this.render();
    },
    template: _.template($("#person_template").html()),

    render: function() {
    this.$el.html(this.template(this.model.attributes));
    return this;
    }

    }
    );


    var all_docs = new Backbone.Cloudant.Docs.Collection();
    var all_docs_view = new PersonView({collection: all_docs, id: '#person_template'});

    all_docs.fetch().fail(function(){console.log('Could not load all_docs collection');});

    13 changes: 13 additions & 0 deletions gistfile2.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    <script src="jquery/jquery-1.9.0.full.js"></script>
    <script src="underscore/underscore-1.4.4.full.js"></script>
    <script src="backbone/backbone-0.9.10.full.js"></script>
    <script src="cloudant/backbone.cloudant-0.0.1.full.js"></script>


    <script type="text/template" id="person_template">
    <input type="text" id="id" />
    </script>
    HELLOW WORLD
    <div id="person_container"></div>
    <script src="js/app2.js"></script>