Skip to content

Commit cbc36c5

Browse files
author
vikasrohit
authored
Merge pull request #598 from appirio-tech/feature/pagination_bar_reduce_number_of_pages
Github issue #372, [Pagination] - keep fixed pagination option displaying 5 pages.
2 parents 3285250 + 17b97aa commit cbc36c5

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

src/components/Grid/GridView.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,6 @@
496496
}
497497

498498
&.go-to-page-pill {
499-
// position: inherit;
500499
.tooltip-target {
501500
min-width: 27px;
502501
height: 28px;

src/components/Grid/PaginationBar.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ const GoToPagePill = ({minPage, maxPage, onPageClick}) => {
3737
}
3838
return (
3939
<li className="go-to-page-pill">
40-
<Tooltip popMethod="click">
41-
<div className="tooltip-target"><span>...</span></div>
40+
<Tooltip popMethod="click" theme="light">
41+
<div className="tooltip-target"><a href="javascript:">...</a></div>
4242
<div className="tooltip-body">
4343
<div className="go-to-page-tooltip">Go to page: <input type="number" min={minPage} max={maxPage} onKeyUp={handleChange} /></div>
4444
</div>
@@ -130,6 +130,7 @@ const PaginationBar = enhance(({onPageChange, currentPageNum, totalCount, pageSi
130130
pagePills.splice(1,
131131
0,
132132
<GoToPagePill
133+
key="goToPagePill-1"
133134
onPageClick={ handlePageSelection }
134135
minPage={currentPageNum - pagesBeforeCurrent + remainingPillsLeft }
135136
maxPage={currentPageNum}
@@ -141,6 +142,7 @@ const PaginationBar = enhance(({onPageChange, currentPageNum, totalCount, pageSi
141142
pagePills.splice(pagePills.length - 1,
142143
0,
143144
<GoToPagePill
145+
key="goToPagePill-2"
144146
onPageClick={ handlePageSelection }
145147
minPage={currentPageNum}
146148
maxPage={ currentPageNum + pagesAfterCurrent - remainingPillsRight}

src/projects/list/components/Projects/Projects.jsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class Projects extends Component {
1212
this.sortHandler = this.sortHandler.bind(this)
1313
this.onPageChange = this.onPageChange.bind(this)
1414
this.applyFilters = this.applyFilters.bind(this)
15+
this.init = this.init.bind(this)
1516
}
1617

1718
componentDidUpdate() {
@@ -23,13 +24,26 @@ class Projects extends Component {
2324
window.sessionStorage.setItem('projectsPageScrollTop', scrollingElement.scrollTop)
2425
}
2526

27+
componentWillReceiveProps(nextProps) {
28+
console.log(nextProps)
29+
const prevQueryParams = _.get(this.props, 'location.query', null)
30+
const queryParams = _.get(nextProps, 'location.query', null)
31+
if (!_.isEqual(prevQueryParams, queryParams)) {
32+
this.init(nextProps)
33+
}
34+
}
35+
2636
componentWillMount() {
37+
this.init(this.props)
38+
}
39+
40+
init(props) {
2741
document.title = 'Projects - Topcoder'
2842
// this.searchTermFromQuery = this.props.location.query.q || ''
29-
const {criteria, loadProjects} = this.props
30-
let pageNum = this.props.pageNum
43+
const {criteria, loadProjects} = props
44+
let pageNum = props.pageNum
3145
// check for criteria specified in URL.
32-
const queryParams = _.get(this.props, 'location.query', null)
46+
const queryParams = _.get(props, 'location.query', null)
3347
if (!_.isEmpty(queryParams)) {
3448
const initialCriteria = {}
3549
if (queryParams.sort) initialCriteria.sort = queryParams.sort

0 commit comments

Comments
 (0)