Last active
December 17, 2015 02:59
-
-
Save yumike/5539438 to your computer and use it in GitHub Desktop.
skel.js usage preview
This file contains 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
class Item extends Backbone.Model | |
initialize: -> | |
@variants = new Backbone.Collection(@get('variants')) | |
class Items extends Backbone.Collection | |
url: '/api/items' | |
model: Item | |
parse: (response) -> response.objects | |
class FilterView extends Skel.View | |
events: | |
'keypress .field': 'filter' | |
filter: (event) => | |
return unless event.which == 13 | |
event.preventDefault() | |
@collection.fetch(reset: true, data: {title: @$('.field').val()}) | |
jQuery -> | |
view = new Skel.View | |
el: $('#application') | |
template: t('application') | |
filter: FilterView | |
collection: new Items | |
view.render() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment