Skip to content

Commit

Permalink
Changed logic of 'back to search'
Browse files Browse the repository at this point in the history
* Set max and min height of dock query in props/localConfig
* Add disabled control on drawer menu
* Update FR and DE translation
  • Loading branch information
allyoucanmap committed Jan 31, 2017
1 parent 031c1ad commit abcd66e
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 38 deletions.
23 changes: 14 additions & 9 deletions web/client/components/data/featuregrid/DockedFeatureGrid.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -93,8 +96,11 @@ const DockedFeatureGrid = React.createClass({
onQuery: () => {},
cleanError: () => {},
selectAllToggle: () => {},
onToggleDrawer: () => {},
openDrawer: () => {},
enableDrawer: () => {},
dockSize: 0.35,
minDockSize: 0.1,
maxDockSize: 1.0,
setDockSize: () => {}
};
},
Expand Down Expand Up @@ -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);
}
Expand Down
3 changes: 2 additions & 1 deletion web/client/components/data/query/QueryBuilder.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ const QueryBuilder = React.createClass({
onQuery: () => {},
onReset: () => {},
onChangeDrawingStatus: () => {},
onToggleDrawer: () => {}
closeDrawer: () => {},
disableDrawer: () => {}
}
};
},
Expand Down
6 changes: 4 additions & 2 deletions web/client/components/data/query/QueryToolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ const QueryToolbar = React.createClass({
onQuery: () => {},
onReset: () => {},
onChangeDrawingStatus: () => {},
onToggleDrawer: () => {}
closeDrawer: () => {},
disableDrawer: () => {}
}
};
},
Expand Down Expand Up @@ -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() {
Expand Down
4 changes: 3 additions & 1 deletion web/client/localConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,9 @@
},{
"name": "FeatureGrid",
"cfg": {
"pagination": true
"pagination": true,
"minDockSize": 0.1,
"maxDockSize":1.0
}
}, {
"name": "TOC",
Expand Down
21 changes: 5 additions & 16 deletions web/client/plugins/DrawerMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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,
Expand All @@ -64,8 +61,7 @@ const DrawerMenu = React.createClass({
menuOptions: {},
singleSection: false,
buttonClassName: "drawer-menu-button",
featureClose: () => {},
queryIsOpen: false
disabled: false
};
},
renderItems() {
Expand All @@ -92,28 +88,21 @@ const DrawerMenu = React.createClass({
render() {
return (
<div id={this.props.id}>
<Button id="drawer-menu-button" style={this.props.menuButtonStyle} bsStyle={this.props.buttonStyle} key="menu-button" className={this.props.buttonClassName} onClick={this.closeAll}><Glyphicon glyph={this.props.glyph}/></Button>
<Button id="drawer-menu-button" style={this.props.menuButtonStyle} bsStyle={this.props.buttonStyle} key="menu-button" className={this.props.buttonClassName} onClick={this.props.toggleMenu} disabled={this.props.disabled}><Glyphicon glyph={this.props.glyph}/></Button>
<Menu single={this.props.singleSection} {...this.props.menuOptions} title={<Message msgId="menu" />} alignment="left">
{this.renderItems()}
</Menu>
</div>
);
},
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: {}
};
7 changes: 4 additions & 3 deletions web/client/plugins/FeatureGrid.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => ({
Expand All @@ -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')}
Expand Down
3 changes: 1 addition & 2 deletions web/client/plugins/QueryPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions web/client/plugins/TOC.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion web/client/translations/data.de-DE
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion web/client/translations/data.fr-FR
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit abcd66e

Please sign in to comment.