From abcd66ee9eae94b3149c963a6814510c07f9de1b Mon Sep 17 00:00:00 2001 From: allyoucanmap Date: Tue, 31 Jan 2017 17:56:11 +0100 Subject: [PATCH] Changed logic of 'back to search' * Set max and min height of dock query in props/localConfig * Add disabled control on drawer menu * Update FR and DE translation --- .../data/featuregrid/DockedFeatureGrid.jsx | 23 +++++++++++-------- .../components/data/query/QueryBuilder.jsx | 3 ++- .../components/data/query/QueryToolbar.jsx | 6 +++-- web/client/localConfig.json | 4 +++- web/client/plugins/DrawerMenu.jsx | 21 ++++------------- web/client/plugins/FeatureGrid.jsx | 7 +++--- web/client/plugins/QueryPanel.jsx | 3 +-- web/client/plugins/TOC.jsx | 5 ++-- web/client/translations/data.de-DE | 2 +- web/client/translations/data.fr-FR | 2 +- 10 files changed, 38 insertions(+), 38 deletions(-) diff --git a/web/client/components/data/featuregrid/DockedFeatureGrid.jsx b/web/client/components/data/featuregrid/DockedFeatureGrid.jsx index db60016028..c6b6a26fca 100644 --- a/web/client/components/data/featuregrid/DockedFeatureGrid.jsx +++ b/web/client/components/data/featuregrid/DockedFeatureGrid.jsx @@ -54,8 +54,11 @@ const DockedFeatureGrid = React.createClass({ selectAllToggle: React.PropTypes.func, zoomToFeatureAction: React.PropTypes.func, onClose: React.PropTypes.func, - onToggleDrawer: React.PropTypes.func, + openDrawer: React.PropTypes.func, + enableDrawer: React.PropTypes.func, dockSize: React.PropTypes.number, + minDockSize: React.PropTypes.number, + maxDockSize: React.PropTypes.number, setDockSize: React.PropTypes.func }, contextTypes: { @@ -93,8 +96,11 @@ const DockedFeatureGrid = React.createClass({ onQuery: () => {}, cleanError: () => {}, selectAllToggle: () => {}, - onToggleDrawer: () => {}, + openDrawer: () => {}, + enableDrawer: () => {}, dockSize: 0.35, + minDockSize: 0.1, + maxDockSize: 1.0, setDockSize: () => {} }; }, @@ -299,16 +305,15 @@ const DockedFeatureGrid = React.createClass({ this.props.selectFeatures(features); }, backToSearch() { - this.props.onToggleDrawer(); + this.props.openDrawer(); + this.props.enableDrawer(); this.props.onClose(); }, limitDockHeight(size) { - const minSize = 0.25; - const maxSize = 0.85; - if (size >= maxSize) { - this.props.setDockSize(maxSize); - } else if (size <= minSize) { - this.props.setDockSize(minSize); + if (size >= this.props.maxDockSize) { + this.props.setDockSize(this.props.maxDockSize); + } else if (size <= this.props.minDockSize) { + this.props.setDockSize(this.props.minDockSize); } else { this.props.setDockSize(size); } diff --git a/web/client/components/data/query/QueryBuilder.jsx b/web/client/components/data/query/QueryBuilder.jsx index b89ed01460..f66da46178 100644 --- a/web/client/components/data/query/QueryBuilder.jsx +++ b/web/client/components/data/query/QueryBuilder.jsx @@ -95,7 +95,8 @@ const QueryBuilder = React.createClass({ onQuery: () => {}, onReset: () => {}, onChangeDrawingStatus: () => {}, - onToggleDrawer: () => {} + closeDrawer: () => {}, + disableDrawer: () => {} } }; }, diff --git a/web/client/components/data/query/QueryToolbar.jsx b/web/client/components/data/query/QueryToolbar.jsx index c232d039e1..16d5c930d5 100644 --- a/web/client/components/data/query/QueryToolbar.jsx +++ b/web/client/components/data/query/QueryToolbar.jsx @@ -51,7 +51,8 @@ const QueryToolbar = React.createClass({ onQuery: () => {}, onReset: () => {}, onChangeDrawingStatus: () => {}, - onToggleDrawer: () => {} + closeDrawer: () => {}, + disableDrawer: () => {} } }; }, @@ -104,7 +105,8 @@ const QueryToolbar = React.createClass({ sortOptions: this.props.sortOptions, hits: this.props.hits }; - this.props.actions.onToggleDrawer(); + this.props.actions.closeDrawer(); + this.props.actions.disableDrawer(); this.props.actions.onQuery(this.props.searchUrl, filterObj, this.props.params); }, reset() { diff --git a/web/client/localConfig.json b/web/client/localConfig.json index 810001ce40..4dff470a6a 100644 --- a/web/client/localConfig.json +++ b/web/client/localConfig.json @@ -321,7 +321,9 @@ },{ "name": "FeatureGrid", "cfg": { - "pagination": true + "pagination": true, + "minDockSize": 0.1, + "maxDockSize":1.0 } }, { "name": "TOC", diff --git a/web/client/plugins/DrawerMenu.jsx b/web/client/plugins/DrawerMenu.jsx index 81e97cd2f8..f5b2d4731a 100644 --- a/web/client/plugins/DrawerMenu.jsx +++ b/web/client/plugins/DrawerMenu.jsx @@ -15,8 +15,6 @@ const {toggleControl, setControlProperty} = require('../actions/controls'); const {changeMapStyle} = require('../actions/map'); -const {featureClose} = require('../actions/wfsquery'); - const {Button, Glyphicon, Panel} = require('react-bootstrap'); const Section = require('./drawer/Section'); @@ -47,8 +45,7 @@ const DrawerMenu = React.createClass({ singleSection: React.PropTypes.bool, buttonClassName: React.PropTypes.string, menuButtonStyle: React.PropTypes.object, - featureClose: React.PropTypes.func, - queryIsOpen: React.PropTypes.bool + disabled: React.PropTypes.bool }, contextTypes: { messages: React.PropTypes.object, @@ -64,8 +61,7 @@ const DrawerMenu = React.createClass({ menuOptions: {}, singleSection: false, buttonClassName: "drawer-menu-button", - featureClose: () => {}, - queryIsOpen: false + disabled: false }; }, renderItems() { @@ -92,28 +88,21 @@ const DrawerMenu = React.createClass({ render() { return (
- + } alignment="left"> {this.renderItems()}
); - }, - closeAll() { - this.props.toggleMenu(); - if (this.props.queryIsOpen) { - this.props.featureClose(); - } } }); module.exports = { DrawerMenuPlugin: connect((state) => ({ active: state.controls && state.controls.drawer && state.controls.drawer.active, - queryIsOpen: state.query.open + disabled: state.controls && state.controls.drawer && state.controls.drawer.disabled }), { - toggleMenu: toggleControl.bind(null, 'drawer', null), - featureClose + toggleMenu: toggleControl.bind(null, 'drawer', null) })(DrawerMenu), reducers: {} }; diff --git a/web/client/plugins/FeatureGrid.jsx b/web/client/plugins/FeatureGrid.jsx index defaf26fd4..b03493c779 100644 --- a/web/client/plugins/FeatureGrid.jsx +++ b/web/client/plugins/FeatureGrid.jsx @@ -9,7 +9,7 @@ const {connect} = require('react-redux'); const {selectFeatures} = require('../actions/featuregrid'); const {query, featureClose, queryDockSize} = require('../actions/wfsquery'); const {changeMapView} = require('../actions/map'); -const {toggleControl} = require('../actions/controls'); +const {setControlProperty} = require('../actions/controls'); module.exports = { FeatureGridPlugin: connect((state) => ({ @@ -31,14 +31,15 @@ module.exports = { query: state.query && state.query.queryObj, isNew: state.query && state.query.isNew, totalFeatures: state.query && state.query.result && state.query.result.totalFeatures, - dockSize: state.query.dockSize + dockSize: state.query && state.query.dockSize }), { selectFeatures, changeMapView, onQuery: query, onClose: featureClose, - onToggleDrawer: toggleControl.bind(null, 'drawer', null), + openDrawer: setControlProperty.bind(null, 'drawer', 'enabled', true), + enableDrawer: setControlProperty.bind(null, 'drawer', 'disabled', false), setDockSize: queryDockSize })(require('../components/data/featuregrid/DockedFeatureGrid')), reducers: {highlight: require('../reducers/featuregrid')} diff --git a/web/client/plugins/QueryPanel.jsx b/web/client/plugins/QueryPanel.jsx index 222316a53b..36958b4f3f 100644 --- a/web/client/plugins/QueryPanel.jsx +++ b/web/client/plugins/QueryPanel.jsx @@ -106,8 +106,7 @@ const SmartQueryForm = connect((state) => { queryToolbarActions: bindActionCreators({ onQuery: createQuery, onReset: reset, - onChangeDrawingStatus: changeDrawingStatus, - onToggleDrawer: toggleControl.bind(null, 'drawer', null) + onChangeDrawingStatus: changeDrawingStatus }, dispatch) }; })(QueryBuilder); diff --git a/web/client/plugins/TOC.jsx b/web/client/plugins/TOC.jsx index f3a904ff31..914067f8b1 100644 --- a/web/client/plugins/TOC.jsx +++ b/web/client/plugins/TOC.jsx @@ -14,7 +14,7 @@ const {changeLayerProperties, changeGroupProperties, toggleNode, sortNode, showSettings, hideSettings, updateSettings, updateNode, removeNode} = require('../actions/layers'); const {getLayerCapabilities} = require('../actions/layerCapabilities'); const {zoomToExtent} = require('../actions/map'); -const {toggleControl} = require('../actions/controls'); +const {setControlProperty} = require('../actions/controls'); const {groupsSelector} = require('../selectors/layers'); const LayersUtils = require('../utils/LayersUtils'); @@ -117,7 +117,8 @@ const SmartQueryForm = connect((state) => { onQuery: createQuery, onReset: reset, onChangeDrawingStatus: changeDrawingStatus, - onToggleDrawer: toggleControl.bind(null, 'drawer', null) + closeDrawer: setControlProperty.bind(null, 'drawer', 'enabled', false), + disableDrawer: setControlProperty.bind(null, 'drawer', 'disabled', true) }, dispatch) }; })(QueryBuilder); diff --git a/web/client/translations/data.de-DE b/web/client/translations/data.de-DE index 687db61f85..2d253061ab 100644 --- a/web/client/translations/data.de-DE +++ b/web/client/translations/data.de-DE @@ -691,7 +691,7 @@ "export": "Export", "selectall": "Alle auswählen", "deselectall": "Auswahl aufheben", - "backtosearch": "Back to search", + "backtosearch": "Zurück zur suche", "pagination": { "page": "Seite", "of": "von", diff --git a/web/client/translations/data.fr-FR b/web/client/translations/data.fr-FR index 3ac2e6a4d6..5fa2c5b424 100644 --- a/web/client/translations/data.fr-FR +++ b/web/client/translations/data.fr-FR @@ -693,7 +693,7 @@ "export": "Exporter", "selectall": "Tout sélectionner", "deselectall": "Tout désélectionner", - "backtosearch": "Back to search", + "backtosearch": "Retour à la recherche", "pagination": { "page": "Page", "of": "de",