Skip to content

Instantly share code, notes, and snippets.

@artofhuman
Forked from varya/gist:4177350
Created November 30, 2012 19:39
Show Gist options
  • Save artofhuman/4178030 to your computer and use it in GitHub Desktop.
Save artofhuman/4178030 to your computer and use it in GitHub Desktop.
block goods {
tag: 'ul'
content: {
var content = [];
this.ctx.goods.forEach(function(item){
var mods = {};
if (item.new) mods.new = 'yes';
content.push({
elem: 'item',
mods: mods,
mix: [{ block: 'box' }],
content: [
{
elem: 'title',
content: item.title
},
{
elem: 'image',
url: item.image
},
{
elem: 'price',
content: {
block: 'b-link',
mix: [{ block: 'goods', elem: 'link' }],
url: item.url,
content: item.price
}
}
]
});
content.push(' ');
});
for(var i = 0; i < 10; i++) content.push({ elem: 'sizer' });
return content;
}
elem item, tag: 'li'
elem sizer, tag: 'li'
elem title, tag: 'h3'
elem image {
tag: 'img'
attrs: {
src: this.ctx.url
}
}
elem price, tag: 'span'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment