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

[DASH-814] We should provide the method for linking from outside #2

Open
wants to merge 4 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
3 changes: 1 addition & 2 deletions dist/PageView.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ var PageView = React.createClass({
React.createElement(
Link,
_extends({}, this.props, {
to: this.props.location,
query: query }),
to: { pathname: this.props.location, query: query } }),
this.props.page
)
);
Expand Down
12 changes: 6 additions & 6 deletions dist/PaginationBoxView.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ var PaginationBoxView = React.createClass({
pageNum: 10,
pageRangeDisplayed: 2,
marginPagesDisplayed: 3,
previousLabel: 'Previous',
nextLabel: 'Next',
breakLabel: '...'
previousLabel: "Previous",
nextLabel: "Next",
breakLabel: "..."
};
},

Expand All @@ -51,7 +51,7 @@ var PaginationBoxView = React.createClass({

this.setState({ selected: selected });

if (typeof this.props.clickCallback !== 'undefined' && typeof this.props.clickCallback === 'function') {
if (typeof this.props.clickCallback !== "undefined" && typeof this.props.clickCallback === "function") {
this.props.clickCallback({ selected: selected });
}
},
Expand Down Expand Up @@ -92,7 +92,7 @@ var PaginationBoxView = React.createClass({
{ onClick: this.handlePreviousPage, className: previousClasses },
React.createElement(
Link,
{ query: previousQuery, to: location.pathname },
{ to: { pathname: location.pathname, query: previousQuery } },
this.props.previousLabel
)
);
Expand Down Expand Up @@ -120,7 +120,7 @@ var PaginationBoxView = React.createClass({
{ onClick: this.handleNextPage, className: nextClasses },
React.createElement(
Link,
{ query: nextQuery, to: location.pathname },
{ to: { pathname: location.pathname, query: nextQuery } },
this.props.nextLabel
)
);
Expand Down
8 changes: 6 additions & 2 deletions dist/PaginationListView.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
'use strict';

var _ = require('underscore');
var React = require('react/addons');
var React = require('react');
var PageView = require('./PageView');

var createFragment = require('react-addons-create-fragment');

var PaginationListView = React.createClass({
displayName: 'PaginationListView',

Expand All @@ -15,6 +17,7 @@ var PaginationListView = React.createClass({
var pageViews = _.range(0, this.props.pageNum).map((function (page) {
return React.createElement(PageView, {
onClick: this.props.onPageSelected.bind(null, page),
generateLinkFor: this.props.generateLinkFor,
selected: this.props.selected === page,
activeClass: this.props.activeClass,
page: page + 1,
Expand Down Expand Up @@ -47,6 +50,7 @@ var PaginationListView = React.createClass({

var pageView = React.createElement(PageView, {
onClick: this.props.onPageSelected.bind(null, index),
generateLinkFor: this.props.generateLinkFor,
selected: this.props.selected === index,
activeClass: this.props.activeClass,
page: index + 1,
Expand Down Expand Up @@ -81,7 +85,7 @@ var PaginationListView = React.createClass({
return React.createElement(
'ul',
{ className: this.props.subContainerClassName },
React.addons.createFragment(items)
createFragment(items)
);
}
});
Expand Down
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@
"url": "https://github.com/AdeleD/react-paginate/issues"
},
"dependencies": {
"underscore": "^1.7.0",
"classnames": "^1.2.0"
"babel": "^5.8.35",
"babel-core": "^5.8.35",
"babel-loader": "^5.4.0",
"classnames": "^1.2.0",
"react-addons-create-fragment": "^0.14.7",
"underscore": "^1.7.0"
},
"devDependencies": {
"babelify": "^6.0.2",
Expand All @@ -34,9 +38,9 @@
"gulp-uglify": "^1.1.0",
"jest-cli": "^0.2.2",
"jquery": "^2.1.3",
"react": "~0.13.1",
"react-router": "^0.13.3",
"react-tools": "~0.12.2",
"react": "0.14.7",
"react-addons-create-fragment": "^0.14.7",
"react-router": "^2.0.1",
"serve-static": "^1.9.1",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "~1.0.0",
Expand Down
3 changes: 1 addition & 2 deletions react_components/PageView.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ var PageView = React.createClass({
return (
<li className={cssClass}>
<Link {...this.props}
to={this.props.location}
query={query}>
to={{ pathname: this.props.location, query }}>
{this.props.page}
</Link>
</li>
Expand Down
4 changes: 2 additions & 2 deletions react_components/PaginationBoxView.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ var PaginationBoxView = React.createClass({
}
return (
<li onClick={this.handlePreviousPage} className={previousClasses}>
<Link query={previousQuery} to={location.pathname}>
<Link to={{ pathname: location.pathname, query: previousQuery }}>
{this.props.previousLabel}
</Link>
</li>
Expand All @@ -115,7 +115,7 @@ var PaginationBoxView = React.createClass({
}
return (
<li onClick={this.handleNextPage} className={nextClasses}>
<Link query={nextQuery} to={location.pathname}>
<Link to={{ pathname: location.pathname, query: nextQuery }}>
{this.props.nextLabel}
</Link>
</li>
Expand Down
8 changes: 6 additions & 2 deletions react_components/PaginationListView.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
'use strict';

var _ = require('underscore');
var React = require('react/addons');
var React = require('react');
var PageView = require('./PageView');

var createFragment = require('react-addons-create-fragment');

var PaginationListView = React.createClass({
render: function() {
var items = {};
Expand All @@ -14,6 +16,7 @@ var PaginationListView = React.createClass({
return (
<PageView
onClick={this.props.onPageSelected.bind(null, page)}
generateLinkFor={this.props.generateLinkFor}
selected={this.props.selected === page}
activeClass={this.props.activeClass}
page={page + 1}
Expand Down Expand Up @@ -50,6 +53,7 @@ var PaginationListView = React.createClass({
var pageView = (
<PageView
onClick={this.props.onPageSelected.bind(null, index)}
generateLinkFor={this.props.generateLinkFor}
selected={this.props.selected === index}
activeClass={this.props.activeClass}
page={index + 1}
Expand Down Expand Up @@ -84,7 +88,7 @@ var PaginationListView = React.createClass({

return (
<ul className={this.props.subContainerClassName}>
{React.addons.createFragment(items)}
{createFragment(items)}
</ul>
);
}
Expand Down