Skip to content

Instantly share code, notes, and snippets.

@ericf
Created November 23, 2011 19:52
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ericf/b877c5586135596b9b63 to your computer and use it in GitHub Desktop.
Save ericf/b877c5586135596b9b63 to your computer and use it in GitHub Desktop.
var Photo, Photos, Album, Albums;
Photo = Y.Base.create('photo', Y.Model, [], {}, {
ATTRS: {
imgUrl: {},
caption: {}
}
});
Photos = Y.Base.create('photos', Y.ModelList, [], {model: Photo});
Album = Y.Base.create('album', Y.Model, [], {
initializer: function () {
this._photos = new Y.Photos();
},
_getPhotos: function () {
return this._photos;
},
_setPhotos: function (photos) {
return this._photos.reset(photos);
}
}, {
ATTRS: {
name: {},
photos: {
getter : '_getPhotos',
setter : '_setPhotos',
validator: Y.Lang.isArray
}
}
});
Albums = Y.Base.create('albums', Y.ModelList, [], {model: Album});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment