Created
June 27, 2012 20:47
-
-
Save adjohu/3006759 to your computer and use it in GitHub Desktop.
Base Collection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BaseCollection = require("controllers/basecollection") | |
GalleryController = require("controllers/gallery/gallerycontroller") | |
class GalleryCollection extends BaseCollection | |
controller: GalleryController | |
itemTemplate: "abc" | |
constructor: -> | |
super | |
@load() | |
@render() | |
addOne: (atts) -> | |
super | |
console.log("woah") | |
load: -> | |
@addAll( | |
{name: 'test'}, | |
{name: "something"}, | |
{name: "awesome"}) | |
module.exports = GalleryCollection |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Spine = require('spine') | |
class BaseCollection extends Spine.Controller | |
items: [], | |
itemTemplate: "abc" | |
constructor: -> | |
super | |
addOne: (atts) -> | |
@items.push new @controller | |
atts: atts | |
template: @itemTemplate | |
console.log(@items) | |
addAll: (attsList...) -> | |
@addOne atts for atts in attsList | |
render: -> | |
for item in @items | |
console.log(item) | |
@el.append(item.render()) | |
module.exports = BaseCollection |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment