Permalink
Browse files

changed namespace of books example & update README

  • Loading branch information...
1 parent 50e2cdd commit b9948fd31d6dfaf5cf6b1f6a1eeb13a1b1ef64e1 @charly committed Mar 14, 2012
View
@@ -1,6 +1,6 @@
# Backbone.Grid
-Backbone.Grid is a set of [Backbone][2] View Extensions to help out build a nice Grid and a few nice things around it. It is composed of a **PageView** (the layout) an **IndexView** (the table) a **NewView** (a form) and an **EditView** (a row in the indexView) which all share a common collection to stay in sync.
+Backbone.Grid is a set of [Backbone][2] View Extensions to help out build a Grid with a few nice things around it. It is composed of a **PageView** (the layout) an **IndexView** (the table) a **NewView** (a form) and an **EditView** (a row in the indexView) which all share a common collection to stay in sync.
## PageView
PageView holds the same role the __layout__ holds in a rails view. But it is also close to a controller since it is responsible for instantiating the main subviews - such as the NewView and the IndexView. It can be used to add a FilterView a NavigationView etc etc.
@@ -18,7 +18,7 @@ Is instantiated by a click on the __cell of the table__. The "editCell" function
## Usage (e.g EditView)
- App.Views.AModel.EditView = Grid.EditView({
+ App.Views.AModel.EditView = Grid.EditView.extend({
tagName : "tr",
className : "new_matter",
template : JST["templates/matters/show"],
@@ -29,9 +29,10 @@ Is instantiated by a click on the __cell of the table__. The "editCell" function
...
})
-To quickly build an admin like interface use [Backbonify][1] which heavily uses backbone.grid to create all it's views. Check the examples to have a better idea of how it works.
+To quickly build an admin like interface use [Backbonify][1] which heavily uses backbone.grid to create all it's views. Check the [examples][3] to have a better idea of how it works.
TODO : build an example site to have a better grasp of the overall concepts.
[1]: https://github.com/charly/backbonify
-[2]: https://github.com/documentcloud/backbone
+[2]: https://github.com/documentcloud/backbone
+[3]: https://github.com/charly/backbone.grid/tree/master/examples
@@ -1,9 +1,9 @@
//
// EDIT : Book
//
-Fees.Views.Books = Fees.Views.Books || {};
+App.Views.Books = App.Views.Books || {};
-Fees.Views.Books.EditView = Grid.EditView.extend({
+App.Views.Books.EditView = Grid.EditView.extend({
tagName : "tr",
className : "new_book",
template : JST["templates/books/show"],
@@ -29,4 +29,4 @@ Fees.Views.Books.EditView = Grid.EditView.extend({
noop:null
});
-//_.extend(Fees.Views.Books.EditView.prototype, Fees.FormHelpers);
+//_.extend(App.Views.Books.EditView.prototype, App.FormHelpers);
@@ -1,9 +1,9 @@
//
// FILTER : Book
//
-Fees.Views.Books = Fees.Views.Books || {};
+App.Views.Books = App.Views.Books || {};
-Fees.Views.Books.FilterView = Backbone.View.extend({
+App.Views.Books.FilterView = Backbone.View.extend({
events : {
"keypress input": "filter"
},
@@ -1,14 +1,14 @@
//
// INDEX : Book
//
-Fees.Views.Books = Fees.Views.Books || {};
+App.Views.Books = App.Views.Books || {};
-Fees.Views.Books.IndexView = Grid.IndexView.extend({
+App.Views.Books.IndexView = Grid.IndexView.extend({
id: "books",
template : JST["templates/books/index"],
initialize: function(){
- this.editView = Fees.Views.Books.EditView;
+ this.editView = App.Views.Books.EditView;
},
noop: null
@@ -1,9 +1,9 @@
//
// NEW : Book
//
-Fees.Views.Books = Fees.Views.Books || {};
+App.Views.Books = App.Views.Books || {};
-Fees.Views.Books.NewView = Grid.NewView.extend({
+App.Views.Books.NewView = Grid.NewView.extend({
id: "new_book",
className: "new_view",
template : JST["templates/books/new"],
@@ -19,4 +19,4 @@ Fees.Views.Books.NewView = Grid.NewView.extend({
});
-//_.extend(Fees.Views.Books.EditView.prototype, Fees.FormHelpers);
+//_.extend(App.Views.Books.EditView.prototype, App.FormHelpers);
@@ -1,9 +1,9 @@
//
// PAGE : Book
//
-Fees.Views.Books = Fees.Views.Books || {};
+App.Views.Books = App.Views.Books || {};
-Fees.Views.Books.PageView = Grid.PageView.extend({
+App.Views.Books.PageView = Grid.PageView.extend({
id: "bookPage",
template: JST["templates/books/page"],
data: {},
@@ -13,14 +13,14 @@ Fees.Views.Books.PageView = Grid.PageView.extend({
},
initialize: function() {
- this.collection = Fees.books; // or new Fees.Collections.Books;
+ this.collection = App.books; // or new App.Collections.Books;
this.collection.fetch({data: this.data});
- this.indexView = new Fees.Views.Books.IndexView({collection: this.collection});
- this.newView = new Fees.Views.Books.NewView({collection: this.collection});
+ this.indexView = new App.Views.Books.IndexView({collection: this.collection});
+ this.newView = new App.Views.Books.NewView({collection: this.collection});
},
addToPage: function() {
- this.filterView = new Fees.Views.Fees.FilterView({
+ this.filterView = new App.Views.App.FilterView({
collection: this.collection,
el: this.$(".filters")
})
@@ -1,9 +1,9 @@
//
// SHOW : Book
//
-Fees.Views.Books = Fees.Views.Books || {};
+App.Views.Books = App.Views.Books || {};
-Fees.Views.Books.ShowView = Grid.EditView.extend({
+App.Views.Books.ShowView = Grid.EditView.extend({
tagName : "tr",
className : "new_book",
template : JST["templates/books/show"],
@@ -15,4 +15,4 @@ Fees.Views.Books.ShowView = Grid.EditView.extend({
noop:null
});
-//_.extend(Fees.Views.Books.EditView.prototype, Fees.FormHelpers);
+//_.extend(App.Views.Books.EditView.prototype, App.FormHelpers);

0 comments on commit b9948fd

Please sign in to comment.