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

ya-share2, move yashare, bem-contrib #74

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "bem-social",
"version": "0.3.1",
"version": "0.3.2",
"description": "BEM Social Components Library",
"repository": {
"type": "git",
"url": "git://github.com/bem-incubator/bem-social"
"url": "git://github.com/bem-contrib/bem-social"
},
"keywords": [
"bem",
Expand All @@ -24,7 +24,7 @@
"Ivan Voischev <[email protected]>"
],
"dependencies": {
"bem-components": "2.3.0"
"bem-components": "^2.3.0"
},
"license": "MIT"
}
21 changes: 21 additions & 0 deletions common.blocks/yashare/yashare.bemhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
block('yashare')(
js()(true),
cls()('ya-share2'),
attrs()(function() {
var ctx = this.ctx,
attrs = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

кмк, либо дописать еще один var, либо отбить все объявление вправо.

но вообще предлагаю что-нибудь типа:

var ctx = this.ctx;

return ['bare', 'counter', 'copy', 'description', 'image', 'lang', 'limit', 'size', 'title', 'url'].reduce(function(prev, attr) {
    prev['data-' + attr] = ctx[attr];
    return prev;
}, { 'data-services': (ctx.services || []).join(',') });

'data-bare' : ctx.bare,
'data-counter' : ctx.counter,
'data-copy' : ctx.copy,
'data-description' : ctx.description,
'data-image' : ctx.image,
'data-lang' : ctx.lang,
'data-limit' : ctx.limit,
'data-services' : (ctx.services || []).join(','),
'data-size' : ctx.size,
'data-title' : ctx.title,
'data-url' : ctx.url,
};
return attrs;
})
);
21 changes: 21 additions & 0 deletions common.blocks/yashare/yashare.bh.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = function(bh) {

bh.match('yashare', function(ctx, json) {
ctx.js(true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

методы ctx можно чейнить:

ctx
    .js(true)
    .cls('ya-share2')
    .attrs();

ctx.cls('ya-share2');
ctx.attrs({
'data-bare' : json.bare,
'data-counter' : json.counter,
'data-copy' : json.copy,
'data-description' : json.description,
'data-image' : json.image,
'data-lang' : json.lang,
'data-limit' : json.limit,
'data-services' : (json.services || []).join(','),
'data-size' : json.size,
'data-title' : json.title,
'data-url' : json.url,
});
});

};
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ modules.define(
onSetMod : {
js : {
inited : function() {
Loader('//yandex.st/share/share.js');
Loader('https://yastatic.net/share2/share.js');
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions common.blocks/yashare/yashare.tmpl-specs/01-plain.bemjson.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[{
block : 'yashare'
}, {
block : 'yashare',
services : ['a,b,c'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут точно не должно быть ['a', 'b', 'c']?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, верно, поправлю

}]
2 changes: 2 additions & 0 deletions common.blocks/yashare/yashare.tmpl-specs/01-plain.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<div class="yashare i-bem ya-share2" data-services="" data-bem="{&quot;yashare&quot;:{}}"></div>
<div class="yashare i-bem ya-share2" data-services="a,b,c" data-bem="{&quot;yashare&quot;:{}}"></div>
Empty file added desktop.blocks/.gitkeeper
Empty file.
12 changes: 0 additions & 12 deletions desktop.blocks/yashare/yashare.bemhtml

This file was deleted.

13 changes: 0 additions & 13 deletions desktop.blocks/yashare/yashare.bh.js

This file was deleted.

8 changes: 0 additions & 8 deletions desktop.blocks/yashare/yashare.tmpl-specs/01-plain.bemjson.js

This file was deleted.

2 changes: 0 additions & 2 deletions desktop.blocks/yashare/yashare.tmpl-specs/01-plain.html

This file was deleted.

45 changes: 20 additions & 25 deletions desktop.bundles/index/index.bemjson.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,13 +378,12 @@
'moimir',
'gplus'
],
theme : 'counter',
l10n : 'ru',
url : 'http://bem-incubator.github.io/bem-social/',
title : 'BEM Social Components Library',
description : 'Fork me on GitHub',
image : 'https://raw.githubusercontent.com/voischev/bem-social/' +
'master/desktop.bundles/index/blocks/page/image/bem.png'
'master/desktop.bundles/index/blocks/page/image/bem.png',
counter : true
},
{
tag : 'br'
Expand All @@ -401,37 +400,33 @@
'friendfeed',
'gplus'
],
theme : 'default',
l10n : 'ru',
url : 'http://bem-incubator.github.io/bem-social/',
title : 'BEM Social Components Library',
description : 'Fork me on GitHub',
image : 'https://raw.githubusercontent.com/voischev/bem-social/' +
'master/desktop.bundles/index/blocks/page/image/bem.png'
'master/desktop.bundles/index/blocks/page/image/bem.png',
limit : 4,
copy : 'last'

},
{
tag : 'br'
},
{
attrs : { style : 'background: #212121' },
content : [
{
block : 'yashare',
quickServices : [
'vkontakte',
'facebook',
'twitter',
'odnoklassniki',
'lj'
],
theme : 'dark',
url : 'http://bem-incubator.github.io/bem-social/',
title : 'BEM Social Components Library',
description : 'Fork me on GitHub',
image : 'https://raw.githubusercontent.com/voischev/bem-social/' +
'master/desktop.bundles/index/blocks/page/image/bem.png'
}
]
block : 'yashare',
quickServices : [
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Оставить поддержку поля quickServices, которое в новом api просто services, или тоже вырезать?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adinvadim думаю двигаться нужно на упрощение) так что вырезай

'vkontakte',
'facebook',
'twitter',
'odnoklassniki',
'lj'
],
url : 'http://bem-incubator.github.io/bem-social/',
title : 'BEM Social Components Library',
description : 'Fork me on GitHub',
image : 'https://raw.githubusercontent.com/voischev/bem-social/' +
'master/desktop.bundles/index/blocks/page/image/bem.png',
size : 's'
}
]
},
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "BEM Social Components Library",
"repository": {
"type": "git",
"url": "https://github.com/bem-incubator/bem-social"
"url": "https://github.com/bem-contrib/bem-social"
},
"keywords": [
"bem",
Expand All @@ -18,9 +18,11 @@
"bem-environ": "^1.4.0"
},
"devDependencies": {
"bh": "^3.3.0",
"borschik": "^1.4.1",
"borschik-tech-cleancss": "^2.0.1",
"bower": "^1.3.12",
"csscomb": "~2.0.5",
"enb": "^0.17.2",
"enb-autoprefixer": "^0.3.0",
"enb-bem-techs": "^2.0.0",
Expand All @@ -29,16 +31,15 @@
"enb-bh": "^0.5.0",
"enb-borschik": "^2.0.0",
"enb-diverse-js": "^0.1.0",
"enb-magic-factory": "^0.5.0",
"enb-magic-platform": "^0.5.0",
"enb-modules": "^0.2.0",
"enb-stylus": "^2.0.0",
"bh": "^3.3.0",
"ym": "^0.1.0",
"csscomb": "~2.0.5",
"git-hooks": "0.0.7",
"jscs": "1.5.3",
"jshint": "2.3.0",
"jshint-groups": "0.6.0"
"jshint-groups": "0.6.0",
"ym": "^0.1.0"
},
"scripts": {
"start": "magic server",
Expand Down