diff --git a/common.blocks/github-button/_type/github-button_type_download.bemhtml b/common.blocks/github-button/_type/github-button_type_download.bemhtml index 05115fb..c377e95 100644 --- a/common.blocks/github-button/_type/github-button_type_download.bemhtml +++ b/common.blocks/github-button/_type/github-button_type_download.bemhtml @@ -3,10 +3,11 @@ block('github-button').mod('type', 'download')( var mods = this.ctx.mods; var user = this.ctx.user; var repo = this.ctx.repo; + var isLarge = mods.size === 'l'; return this.extend(applyNext(), { href : 'https://github.com/' + user + '/' + repo + '/archive/master.zip', - 'data-style' : mods.large && 'mega', + 'data-style' : isLarge && 'mega', 'data-icon' : 'octicon-cloud-download' }); }), diff --git a/common.blocks/github-button/_type/github-button_type_follow.bemhtml b/common.blocks/github-button/_type/github-button_type_follow.bemhtml index bf4f418..369671b 100644 --- a/common.blocks/github-button/_type/github-button_type_follow.bemhtml +++ b/common.blocks/github-button/_type/github-button_type_follow.bemhtml @@ -2,10 +2,11 @@ block('github-button').mod('type', 'follow')( attrs()(function() { var mods = this.ctx.mods; var user = this.ctx.user; + var isLarge = mods.size === 'l'; return this.extend(applyNext(), { href : 'https://github.com/' + user, - 'data-style' : mods.large && 'mega', + 'data-style' : isLarge && 'mega', 'data-count-href' : mods.count && ('/' + user + '/followers'), 'data-count-api' : mods.count && ('/users/' + user + '#followers') }); diff --git a/common.blocks/github-button/_type/github-button_type_fork.bemhtml b/common.blocks/github-button/_type/github-button_type_fork.bemhtml index fda602b..4ef8af3 100644 --- a/common.blocks/github-button/_type/github-button_type_fork.bemhtml +++ b/common.blocks/github-button/_type/github-button_type_fork.bemhtml @@ -3,10 +3,11 @@ block('github-button').mod('type', 'fork')( var mods = this.ctx.mods; var user = this.ctx.user; var repo = this.ctx.repo; + var isLarge = mods.size === 'l'; return this.extend(applyNext(), { href : 'https://github.com/' + user + '/' + repo, - 'data-style' : mods.large && 'mega', + 'data-style' : isLarge && 'mega', 'data-count-href' : mods.count && ('/' + user + '/' + repo + '/network'), 'data-count-api' : mods.count && ('/repos/' + user + '/' + repo + '#forks_count'), 'data-icon' : 'octicon-git-branch' diff --git a/common.blocks/github-button/_type/github-button_type_issue.bemhtml b/common.blocks/github-button/_type/github-button_type_issue.bemhtml index e1429ab..46a3ff4 100644 --- a/common.blocks/github-button/_type/github-button_type_issue.bemhtml +++ b/common.blocks/github-button/_type/github-button_type_issue.bemhtml @@ -3,10 +3,11 @@ block('github-button').mod('type', 'issue')( var mods = this.ctx.mods; var user = this.ctx.user; var repo = this.ctx.repo; + var isLarge = mods.size === 'l'; return this.extend(applyNext(), { href : 'https://github.com/' + user + '/' + repo + '/issues', - 'data-style' : mods.large && 'mega', + 'data-style' : isLarge && 'mega', 'data-count-api' : mods.count && ('/repos/' + user + '/' + repo + '#open_issues_count'), 'data-icon' : 'octicon-issue-opened' }); diff --git a/common.blocks/github-button/_type/github-button_type_star.bemhtml b/common.blocks/github-button/_type/github-button_type_star.bemhtml index 3a2c429..b6ed753 100644 --- a/common.blocks/github-button/_type/github-button_type_star.bemhtml +++ b/common.blocks/github-button/_type/github-button_type_star.bemhtml @@ -3,10 +3,11 @@ block('github-button').mod('type', 'star')( var mods = this.ctx.mods; var user = this.ctx.user; var repo = this.ctx.repo; + var isLarge = mods.size === 'l'; return this.extend(applyNext(), { href : 'https://github.com/' + user + '/' + repo, - 'data-style' : mods.large && 'mega', + 'data-style' : isLarge && 'mega', 'data-count-href' : mods.count && ('/' + user + '/' + repo + '/stargazers'), 'data-count-api' : mods.count && ('/repos/' + user + '/' + repo + '#stargazers_count'), 'data-icon' : 'octicon-star' diff --git a/common.blocks/github-button/_type/github-button_type_watch.bemhtml b/common.blocks/github-button/_type/github-button_type_watch.bemhtml index 0350443..67fea7a 100644 --- a/common.blocks/github-button/_type/github-button_type_watch.bemhtml +++ b/common.blocks/github-button/_type/github-button_type_watch.bemhtml @@ -3,10 +3,11 @@ block('github-button').mod('type', 'watch')( var mods = this.ctx.mods; var user = this.ctx.user; var repo = this.ctx.repo; + var isLarge = mods.size === 'l'; return this.extend(applyNext(), { href : 'https://github.com/' + user + '/' + repo, - 'data-style' : mods.large && 'mega', + 'data-style' : isLarge && 'mega', 'data-count-href' : mods.count && ('/' + user + '/' + repo + '/watchers'), 'data-count-api' : mods.count && ('/repos/' + user + '/' + repo + '#subscribers_count'), 'data-icon' : 'octicon-eye' diff --git a/common.blocks/github-button/github-button.ru.md b/common.blocks/github-button/github-button.ru.md new file mode 100644 index 0000000..5a6c21c --- /dev/null +++ b/common.blocks/github-button/github-button.ru.md @@ -0,0 +1,65 @@ +# github-button + +Блок `github-button` используется для подключения GitHub:Buttons на страницы. +Не работает без модификаторов. + +## Использование +```js +{ + block : 'github-button', + mods : { type : 'star', size : 'l', count : true }, + user : 'voischev', + repo : 'bem-social' +} +``` + +## Модификаторы `type` + +- `download` +- `follow` +- `fork` +- `issue` +- `star` +- `watch` + +## Модификатор `size` + +- Большая кнопка со значением 'l' + +## Модификатор `count` + +Что бы отобразить счетчик нужно установть в значение `true`. +Доступен для типов кнопоу к кроторых возможен счетчик. + +- `follow` +- `fork` +- `issue` +- `star` +- `watch` + + +## Специализированные поля блока + +Список зарезервированных полей входного BEMJSON: + + + + + + + + + + + + + + + + + +
ПолеТипОписание
user + String + Пользователь на GitHub
repo + String + Репозиторий на GitHub. Для типа `follow` неуказывается
diff --git a/desktop.bundles/index/index.bemjson.js b/desktop.bundles/index/index.bemjson.js index e6db091..f743ce9 100644 --- a/desktop.bundles/index/index.bemjson.js +++ b/desktop.bundles/index/index.bemjson.js @@ -46,7 +46,7 @@ content : [ { block : 'github-button', - mods : { type : 'star', large : true, count : true }, + mods : { type : 'star', size : 'l', count : true }, user : 'voischev', repo : 'bem-social' } @@ -58,7 +58,7 @@ content : [ { block : 'github-button', - mods : { type : 'follow', large : true, count : true }, + mods : { type : 'follow', size : 'l', count : true }, user : 'voischev' } ] @@ -79,7 +79,7 @@ content : [ { block : 'github-button', - mods : { type : 'watch', large : true, count : true }, + mods : { type : 'watch', size : 'l', count : true }, user : 'voischev', repo : 'bem-social' } @@ -91,7 +91,7 @@ content : [ { block : 'github-button', - mods : { type : 'issue', large : true, count : true }, + mods : { type : 'issue', size : 'l', count : true }, user : 'voischev', repo : 'bem-social' } @@ -103,7 +103,7 @@ content : [ { block : 'github-button', - mods : { type : 'fork', large : true, count : true }, + mods : { type : 'fork', size : 'l', count : true }, user : 'voischev', repo : 'bem-social' } @@ -115,7 +115,7 @@ content : [ { block : 'github-button', - mods : { type : 'download', large : true }, + mods : { type : 'download', size : 'l' }, user : 'voischev', repo : 'bem-social' }