Github user michellephung commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/370#discussion_r28532960
--- Diff: app/addons/fauxton/components.react.jsx ---
@@ -84,9 +84,129 @@ function (app, FauxtonAPI, React, ZeroClipboard) {
});
+ var Tray = React.createClass({
+
+ getInitialState: function () {
+ return {
+ show: false
+ };
+ },
+
+ toggle: function (done) {
+ if (this.state.show) {
+ this.hide(done);
+ } else {
+ this.show(done);
+ }
+ },
+
+ componentDidMount: function () {
+ $('body').on('click.Tray-' + this.props.trayid + "-" +
this._rootNodeID, function (e) {
+ var tgt = $(e.target);
+ if (this.state.show && tgt.closest('.tray').length === 0) {
+ this.hide();
+ }
+ }.bind(this));
+ },
+
+ componentWillUnmount: function () {
+ $('body').off('click.Tray-' + this.props.trayid + "-" +
this._rootNodeID);
+ },
+
+ show: function (done) {
+ this.setState({show: true});
+ $(this.refs.myself.getDOMNode()).velocity('transition.slideDownIn',
FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED, function () {
+ if (done) {
+ done(true);
+ }
+ });
+ },
+
+ hide: function (done) {
+ $(this.refs.myself.getDOMNode()).velocity('reverse',
FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED, function () {
+ this.setState({show: false});
+ if (done) {
+ done(false);
+ }
+ }.bind(this));
+ },
+
+ render: function () {
+ var styleSpec = this.state.show ? {"display": "block", "opacity": 1}
: {"display": "none", "opacity": 0};
+ var classSpec = this.props.className || "";
+ classSpec += " tray";
+ return (
+ <div ref="myself" style={styleSpec}
className={classSpec}>{this.props.children}</div>
+ );
+ }
+ });
+
+ var Pagination = React.createClass({
+
+ getInitialState: function () {
+ return {};
+ },
+
+ getDefaultProps: function () {
+ return {
+ perPage: FauxtonAPI.constants.MISC.DEFAULT_PAGE_SIZE,
+ page: 1,
+ total: 0
+ };
+ },
+
+ render: function () {
+ function getVisiblePages (page, totalPages) {
--- End diff --
you can pull this function out of the render, and add it to the Pagination
object
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---