Github user benkeen commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/654#discussion_r53811563
  
    --- Diff: app/addons/documents/queryoptions/queryoptions.react.jsx ---
    @@ -292,93 +294,126 @@ A key value is the first parameter emitted in a map 
function. For example emit("
       });
     
       var QueryOptionsController = React.createClass({
    -    getStoreState: function () {
    -      return {
    -        includeDocs: store.includeDocs(),
    -        showBetweenKeys: store.showBetweenKeys(),
    -        showByKeys: store.showByKeys(),
    -        betweenKeys: store.betweenKeys(),
    -        byKeys: store.byKeys(),
    -        descending: store.descending(),
    -        skip: store.skip(),
    -        limit: store.limit(),
    -        showReduce: store.showReduce(),
    -        reduce: store.reduce(),
    -        groupLevel: store.groupLevel()
    -      };
    +
    +    getWrap: function () {
    +      return connectToStores(TrayWrapper, [store], function () {
    +
    +        return {
    +          includeDocs: store.includeDocs(),
    +          showBetweenKeys: store.showBetweenKeys(),
    +          showByKeys: store.showByKeys(),
    +          betweenKeys: store.betweenKeys(),
    +          byKeys: store.byKeys(),
    +          descending: store.descending(),
    +          skip: store.skip(),
    +          limit: store.limit(),
    +          showReduce: store.showReduce(),
    +          reduce: store.reduce(),
    +          groupLevel: store.groupLevel(),
    +          contentVisible: store.getTrayVisible(),
    +          queryParams: store.getQueryParams()
    +        };
    +      });
         },
     
    -    getInitialState: function () {
    -      return this.getStoreState();
    +    render: function () {
    +      var TrayWrapper = this.getWrap();
    +      return (
    +        <TrayWrapper>
    +          <QueryTray contentVisible={false} />
    +        </TrayWrapper>
    +      );
    +    }
    +  });
    +
    +  var QueryTray = React.createClass({
    +
    +    propTypes: {
    +      contentVisible: React.PropTypes.bool.isRequired
    +    },
    +
    +    runQuery: function (e) {
    +      e.preventDefault();
    +
    +      Actions.runQuery(this.props.queryParams);
    +      Actions.toggleQueryBarVisibility(!this.props.contentVisible);
    +    },
    +
    +    toggleTrayVisibility: function () {
    +      Actions.toggleQueryBarVisibility(!this.props.contentVisible);
         },
     
         componentDidMount: function () {
    -      store.on('change', this.onChange, this);
    +      $('body').on('click.QueryTray', function (e) {
    +        if ($(e.target).parents('#query-options').length) {
    --- End diff --
    
    `.closest()` is a little more performant (just finds the first parent that 
matches the selector, rather than all. 


---
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.
---

Reply via email to