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
var assets = new Chute.API.Assets({ album: 'ALBUM_SHORTCUT' }).toData({ filters: [PopularAssetsFilter] }); |
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
var PopularAssetsFilter = Chute.Data.Filter.extend({ | |
initialize: function(data) { | |
this.data = data; // saving reference to Chute.Data object | |
this.filter(); | |
}, | |
filter: function() { | |
var assets = this.data; | |
var popularAssets = _.filter(assets, function(asset){ |
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
var assets = new Chute.API.Assets({ album: 'ALBUM_SHORTCUT '}).toData(); | |
assets.on('data:load', function(){ | |
var items = assets.data.items(); | |
var popularAssets = _.filter(items, function(item){ | |
return item.hearts > 10; | |
}); | |
var filteredAssets = []; |
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
var MyView = Chute.View.extend({ | |
}); | |
var view = new MyView({ container: 'div.some-view' }); |
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
<div class="example"> | |
<h1>I am a view</h1> | |
</div> |
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
<script class="my-template" type="application/x-template"> | |
<div class="example"> | |
<h1>I am a view</h1> | |
</div> | |
</script> |
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
var MyView = Chute.View.extend({ | |
template: '<div class="example"><h1>I am a view</h1></div>' | |
}); | |
var view = new MyView({ container: 'div.some-view' }); |
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
<script class="asset-template" type="application/x-template"> | |
<div class="image"> | |
<img src="{{ url }}"> | |
<span class="username">By {{ user.username }}</span> | |
</div> | |
</script> |
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
<script class="asset-template" type="application/x-template"> | |
<div class="image"> | |
<img src="{{ url }}"> | |
<span class="username">By {{ user.username }}</span> | |
</div> | |
</script> | |
<script class="assets-template" type="application/x-template" | |
<div class="assets"> | |
<!-- Assets will be rendered here --> |
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
var scroll = Chute.View.Plugins.InfiniteScroll.extend({ | |
container: 'div.assets' | |
}); | |
var AssetCollectionView = Chute.CollectionView.extend({ | |
... | |
plugins: [scroll] | |
... | |
}); |