couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From garrensmith <...@git.apache.org>
Subject [GitHub] couchdb-fauxton pull request: Changes page Filters tab moved to Re...
Date Fri, 13 Feb 2015 11:22:08 GMT
Github user garrensmith commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/265#discussion_r24658179
  
    --- Diff: app/addons/documents/changes/changes-header.react.jsx ---
    @@ -0,0 +1,236 @@
    +// Licensed under the Apache License, Version 2.0 (the "License"); you may not
    +// use this file except in compliance with the License. You may obtain a copy of
    +// the License at
    +//
    +//   http://www.apache.org/licenses/LICENSE-2.0
    +//
    +// Unless required by applicable law or agreed to in writing, software
    +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
    +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
    +// License for the specific language governing permissions and limitations under
    +// the License.
    +
    +define([
    +  'react',
    +  'addons/documents/changes/actions',
    +  'addons/documents/changes/stores'
    +], function (React, Actions, Stores) {
    +
    +  var changesFilterStore = Stores.changesFilterStore;
    +  var ReactCSSTransitionGroup = React.addons.CSSTransitionGroup;
    +
    +
    +  var ChangesHeader = React.createClass({
    +    getInitialState: function () {
    +      return {
    +        showTabContent: changesFilterStore.isTabVisible()
    +      };
    +    },
    +
    +    componentDidMount: function () {
    +      changesFilterStore.on('change', this.onChange, this);
    +    },
    +
    +    onChange: function () {
    +      this.setState({
    +        showTabContent: changesFilterStore.isTabVisible()
    +      });
    +    },
    +
    +    toggleFilterSection: function () {
    +      Actions.toggleTabVisibility();
    +    },
    +
    +    render: function () {
    +      var tabContent = '';
    +
    +      if (this.state.showTabContent) {
    +        tabContent = <ChangesHeaderTabContent key="changesFilterSection" />;
    +      }
    +
    +      return (
    +        <div className="changes-header-section">
    +          <ChangesHeaderTab onToggle={this.toggleFilterSection} />
    +          <ReactCSSTransitionGroup transitionName="toggleChangesFilter" component="div"
className="changes-tab-content">
    +            {tabContent}
    +          </ReactCSSTransitionGroup>
    +        </div>
    +      );
    +    }
    +  });
    +
    +  var ChangesHeaderTab = React.createClass({
    +    propTypes: {
    +      onToggle: React.PropTypes.func.isRequired
    +    },
    +
    +    render: function () {
    +      return (
    +        <div className="dashboard-upper-menu">
    +          <ul className="nav nav-tabs" id="db-views-tabs-nav">
    +            <li>
    +              <a href="#filter" onClick={this.props.onToggle} data-bypass="true" data-toggle="tab">
    +                <i className="fonticon fonticon-plus"></i> Filter
    +              </a>
    +            </li>
    +          </ul>
    +        </div>
    +      );
    +    }
    +  });
    +
    +  var ChangesHeaderTabContent = React.createClass({
    +    render: function () {
    +      return (
    +        <div className="tab-content">
    +          <div className="tab-pane active" ref="filterTab">
    +            <div className="changes-header js-filter">
    +              <ChangesFilter />
    +            </div>
    +          </div>
    +        </div>
    +      );
    +    }
    +  });
    +
    +  var ChangesFilter = React.createClass({
    +    getStoreState: function () {
    +      return {
    +        filters: changesFilterStore.getFilters()
    +      };
    +    },
    +
    +    onChange: function () {
    +      this.setState(this.getStoreState());
    +    },
    +
    +    // props belong to the parent, so these aren't stored in the related store
    +    getDefaultProps: function () {
    --- End diff --
    
    I don't think we need these as props since they are never changed by the parent.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message