Conversation
common.blocks/pager/pager.bemtree.js
Outdated
| var pagination = Object.assign({ current: true }, this.data.pagination); | ||
| block('pager').content()(node => { | ||
| const { data } = node; | ||
| var pagination = Object.assign({ current: true }, data.pagination); |
common.blocks/pager/pager.bemtree.js
Outdated
| var pagination = Object.assign({ current: true }, data.pagination); | ||
| const pageCount = pagination.last ? pagination.last.match(/\&page=(\d+)/i)[1] : | ||
| parseInt(pagination.prev.match(/\&page=(\d+)/i)[1]) + 1; | ||
| var result = []; |
common.blocks/pager/pager.bemtree.js
Outdated
|
|
||
| return ['first', 'prev', 'current', 'next', 'last'].reduce((acc, type) => { | ||
| pagination[type] && acc.push({ | ||
| var createItem = (type, index) => { |
common.blocks/pager/pager.bemtree.js
Outdated
| }; | ||
| }; | ||
|
|
||
| for (var i = 1; i <= pageCount; i++) { |
common.blocks/pager/pager.bemtree.js
Outdated
| result.push(createItem('number', i)); | ||
| } | ||
|
|
||
| return ['first', 'prev'].reduce((acc, type, index) => { |
There was a problem hiding this comment.
к этому блоку не хватает комментария
|
А еще это получается не добавление пагинации, а фикс/доработка |
common.blocks/pager/pager.bemtree.js
Outdated
| block('pager').content()(node => { | ||
| const { data } = node; | ||
| const pagination = Object.assign({ current: true }, data.pagination); | ||
| const pageCount = pagination.last ? pagination.last.match(/\&page=(\d+)/i)[1] : |
common.blocks/pager/pager.bemhtml.js
Outdated
| block('pager') | ||
| .elem('item') | ||
| .match(function() { return this.ctx.url !== true; }) | ||
| .replace()(function() { |
common.blocks/pager/pager.bemtree.js
Outdated
| elemMods: { type: type }, | ||
| url: pagination[type] | ||
| }); | ||
| url: pagination[type] || `?page=${index}`, |
There was a problem hiding this comment.
keep other params
common.blocks/pager/pager.bemtree.js
Outdated
| } | ||
|
|
||
| // собираем последовательность из стрелок начала, цифер и стрелок конца | ||
| return ['first', 'prev'].reduce((acc, type, index) => { |
There was a problem hiding this comment.
return [
[].reduce(),
result,
[].reduce()
];d937b26 to
55254ce
Compare
| delete params.page; | ||
|
|
||
| Location.change({ params: params }); | ||
| window.location.reload(); |
There was a problem hiding this comment.
Ajax will not work with location.reload :(
There was a problem hiding this comment.
мы хотим здесь ajax?
common.blocks/pager/pager.bemhtml.js
Outdated
| block('pager').elem('item').match(function() { return this.ctx.url !== true; }).replace()(function() { | ||
| block('pager') | ||
| .elem('item') | ||
| .match(node => { return node.ctx.url !== true; }) |
There was a problem hiding this comment.
- .match(node => { return node.ctx.url !== true; })
+ .match(node => node.ctx.url !== true)
common.blocks/pager/pager.bemtree.js
Outdated
| result.push(createItem('number', i)); | ||
| } | ||
|
|
||
| // собираем последовательность из стрелок начала, цифер и стрелок конца |
There was a problem hiding this comment.
- цифер
+ цифрbut let's keep comments in English ;)
| Location.getUri().queryParams, | ||
| { sort, direction }, | ||
| { pagination: undefined } | ||
| { sort, direction } |
server/controllers/gh.js
Outdated
| querystring.parse(issuesData.pagination.last).page : | ||
| parseInt(querystring.parse(issuesData.pagination.prev).page) + 1; | ||
|
|
||
| var exceptPagUrl = querystring.parse(issuesData.pagination.last || issuesData.pagination.prev); |
8a5022e to
437922a
Compare
server/controllers/gh.js
Outdated
| querystring.parse(issuesPag.last).page : | ||
| parseInt(querystring.parse(issuesPag.prev).page) + 1; | ||
|
|
||
| let exceptPagUrl = querystring.parse(issuesPag.last || issuesPag.prev); |
There was a problem hiding this comment.
if there is ? at the beginning use .substr(1) here
server/controllers/gh.js
Outdated
| let exceptPagUrl = querystring.parse(issuesPag.last || issuesPag.prev); | ||
| delete exceptPagUrl.page; | ||
|
|
||
| exceptPagUrl = Object.keys(exceptPagUrl).reduce((resStr, key) => { |
There was a problem hiding this comment.
use querystring.stringify() instead
server/controllers/gh.js
Outdated
| labels: labelsData | ||
| labels: labelsData, | ||
| pageCount: paginationData.pageCount, | ||
| exceptPagUrl: paginationData.exceptPagUrl |
There was a problem hiding this comment.
replace *pag* with pagination
server/controllers/gh.js
Outdated
| render(req, res, { | ||
| view: 'page-post' | ||
| }, | ||
| Object.assign({ |
| function getPaginationData(issuesPag) { | ||
| const querystring = require('querystring'), | ||
| pageCount = issuesPag.last ? | ||
| querystring.parse(issuesPag.last).page : |
There was a problem hiding this comment.
indentation here and everywhere
No description provided.