From 215d36c6e421333b16fe2c5707e5b8467d715491 Mon Sep 17 00:00:00 2001 From: Vladimir Grinenko Date: Sun, 24 May 2015 02:02:22 +0300 Subject: [PATCH] Update templates to support bem-xjst 2.x --- .../files/i-bem/redefine-mods.bemhtml | 2 +- common.blocks/page/page.bemhtml | 4 +- desktop.blocks/page/__css/page__css.bemhtml | 52 ++++++++----------- touch.blocks/page/__icon/page__icon.bemhtml | 2 +- 4 files changed, 27 insertions(+), 33 deletions(-) diff --git a/common.blocks/i-bem/i-bem.test.bemhtml/files/i-bem/redefine-mods.bemhtml b/common.blocks/i-bem/i-bem.test.bemhtml/files/i-bem/redefine-mods.bemhtml index 59ed322f..98f4a863 100644 --- a/common.blocks/i-bem/i-bem.test.bemhtml/files/i-bem/redefine-mods.bemhtml +++ b/common.blocks/i-bem/i-bem.test.bemhtml/files/i-bem/redefine-mods.bemhtml @@ -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'); diff --git a/common.blocks/page/page.bemhtml b/common.blocks/page/page.bemhtml index 4da884d3..ea02eee3 100644 --- a/common.blocks/page/page.bemhtml +++ b/common.blocks/page/page.bemhtml @@ -4,7 +4,7 @@ block('page')( var ctx = this.ctx; this._nonceCsp = ctx.nonce; - applyCtx([ + return applyCtx([ ctx.doctype || '', { tag : 'html', @@ -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' } diff --git a/desktop.blocks/page/__css/page__css.bemhtml b/desktop.blocks/page/__css/page__css.bemhtml index 01c07eac..518fdeab 100644 --- a/desktop.blocks/page/__css/page__css.bemhtml +++ b/desktop.blocks/page/__css/page__css.bemhtml @@ -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', '', '', '' - ] - } - ); - }, - 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', '', '', '' + ]); + }, + 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 }; + })); + }) ); diff --git a/touch.blocks/page/__icon/page__icon.bemhtml b/touch.blocks/page/__icon/page__icon.bemhtml index 0d811b3d..97caef85 100644 --- a/touch.blocks/page/__icon/page__icon.bemhtml +++ b/touch.blocks/page/__icon/page__icon.bemhtml @@ -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 }