snipt/snipt/media/js/src/modules/snipt.js

38 lines
886 B
JavaScript

(function(Snipt) {
Snipt.SniptModel = Backbone.Model.extend({
});
SniptView = Backbone.View.extend({
initialize: function() {
this.model = new Snipt.SniptModel();
this.model.view = this;
this.$el = $(this.el);
this.$expand_button = $('a.expand', this.$el);
},
events: {
'click a.expand': 'expand'
},
expand: function() {
this.$el.toggleClass('expanded');
return false;
}
});
SniptListView = Backbone.View.extend({
el: 'section#snipts',
initialize: function(opts) {
opts.snipts.each(this.addSnipt);
},
addSnipt: function() {
model = new SniptView({ el: this });
}
});
Snipt.Views = {
'SniptListView': SniptListView
};
})(snipt.module('snipt'));