Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update templates to support bem-xjst 2.x #1022

Merged
merged 1 commit into from
Jun 11, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
block('b1').def()(function() {
this.mods.foo = 'bar';
applyNext();
return applyNext();
});
block('b1').content()('foo bar');
block('b1').mod('foo', 'bar').content()('foo bar');
4 changes: 2 additions & 2 deletions common.blocks/page/page.bemhtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ block('page')(
var ctx = this.ctx;
this._nonceCsp = ctx.nonce;

applyCtx([
return applyCtx([
ctx.doctype || '<!DOCTYPE html>',
{
tag : 'html',
Expand All @@ -16,7 +16,7 @@ block('page')(
{ tag : 'meta', attrs : { charset : 'utf-8' } },
ctx.uaCompatible === false? '' : {
tag : 'meta',
attrs: {
attrs : {
'http-equiv' : 'X-UA-Compatible',
content : ctx.uaCompatible || 'IE=edge'
}
Expand Down
52 changes: 23 additions & 29 deletions desktop.blocks/page/__css/page__css.bemhtml
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
block('page').elem('css')(
def()
.match(function() { return this.ctx.hasOwnProperty('ie'); })
.match(function() { return !this.ctx._ieCommented; })(
function() {
var ie = this.ctx.ie,
hideRule = !ie?
['gt IE 9', '<!-->', '<!--'] :
ie === '!IE'?
[ie, '<!-->', '<!--'] :
[ie, '', ''];
apply(
'',
{ 'ctx._ieCommented' : true },
{
ctx : [
'<!--[if ' + hideRule[0] + ']>' + hideRule[1],
this.ctx,
hideRule[2] + '<![endif]-->'
]
}
);
},
match(function() { return this.ctx.ie === true; })(function() {
var url = this.ctx.url;
applyCtx([6, 7, 8, 9].map(function(v) {
return { elem : 'css', url : url + '.ie' + v + '.css', ie : 'IE ' + v };
}));
}))
block('page').elem('css').def().match(function() {
return this.ctx.hasOwnProperty('ie');
})(
function() {
var ie = this.ctx.ie,
hideRule = !ie?
['gt IE 9', '<!-->', '<!--'] :
ie === '!IE'?
[ie, '<!-->', '<!--'] :
[ie, '', ''];

return applyCtx([
'<!--[if ' + hideRule[0] + ']>' + hideRule[1],
this.ctx,
hideRule[2] + '<![endif]-->'
]);
},
match(function() { return this.ctx.ie === true; })(function() {
var url = this.ctx.url;
return applyCtx([6, 7, 8, 9].map(function(v) {
return { elem : 'css', url : url + '.ie' + v + '.css', ie : 'IE ' + v };
}));
})
);
2 changes: 1 addition & 1 deletion touch.blocks/page/__icon/page__icon.bemhtml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
block('page').elem('icon').def()(function() {
var ctx = this.ctx;
applyCtx([
return applyCtx([
ctx.src16 && {
elem : 'link',
attrs : { rel : 'shortcut icon', href : ctx.src16 }
Expand Down