Skip to content
forked from Palpiteros/muscle

A layer on top of Backbonejs to bring more control to views and a better integration between views and models/collections.

Notifications You must be signed in to change notification settings

lucasfs7/muscle

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Muscle.js

browser support

A layer on top of Backbonejs to bring more control to views and a better integration between views and models/collections.

Totally integrated with browserify.

installing:

$ npm install muscle

using:

// require the libs

var Backbone = require('backbone');
var $ = Backbone.$ = require('jquery');
var Muscle = require('muscle');

// create the model and collection

var Book = Backbone.Model.extend({});
var Books = Backbone.Collection.extend({ model: Book });

// create a model view

var BookShow = Muscle.ModelView.extend({
  className: 'book-show',
  tagName: 'article',
  template: function() {
    return require('book_show_template');
  }
});

var bookShow = new BookShow({
  model: new Book({
    name: 'Backbonejs is easy',
    author: 'unknown'
  })
});

// create a collection view

var BookItem = Muscle.ModelView.extend({
  className: 'book-item',
  tagName: 'li',
  template: function() {
    return require('book_item_template');
  }
});

var BookList = Muscle.CollectionView.extend({
  tagName: 'ul',
  className: 'book-list',
  modelView: BookItem
});

var bookList = new BookList({ collection: new Books });

building:

$ npm start

testing:

$ npm test

About

A layer on top of Backbonejs to bring more control to views and a better integration between views and models/collections.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • LiveScript 64.8%
  • JavaScript 29.8%
  • Shell 5.4%