Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1633. Add scroll to top plugin #1652

Merged
merged 4 commits into from
Mar 29, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docma-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@
"web/client/plugins/BackgroundSwitcher.jsx",
"web/client/plugins/Map.jsx",
"web/client/plugins/Identify.jsx",
"web/client/plugins/Login.jsx"
"web/client/plugins/Login.jsx",

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove empty line

"web/client/plugins/ScrollTop.jsx"
]
},
"./docs/**/*md",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
"react-responsive": "1.1.3",
"react-router": "2.5.2",
"react-router-redux": "3.0.0",
"react-scroll-up": "^1.2.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix the version

"react-select": "1.0.0-rc.1",
"react-selectize": "2.0.3",
"react-share": "1.8.0",
Expand Down
2 changes: 1 addition & 1 deletion web/client/localConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
"cfg": {
"className": "navbar shadow navbar-home"
}
}, "ManagerMenu", "Login", "Language", "Attribution"],
}, "ManagerMenu", "Login", "Language", "Attribution", "ScrollTop"],
"maps": ["Header", "Fork", "MapSearch", "HomeDescription", "MapType", "ThemeSwitcher", "CreateNewMap", "Maps", "Examples", "Footer"],
"manager": ["Header", "Redirect", "Manager", "Home", "UserManager", "GroupManager", "Footer"]
}
Expand Down
54 changes: 54 additions & 0 deletions web/client/plugins/ScrollTop.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright 2017, GeoSolutions Sas.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
const React = require('react');
const ScrollUp = require('react-scroll-up');
const Message = require('../components/I18N/Message');
const {Glyphicon, Button, OverlayTrigger, Tooltip} = require('react-bootstrap');

/**
* ScrollUp Plugin. Show a button that allows to scroll to the top of the page. Only for full pages.
* @prop style {object} the style of the scrollUp div
* @prop showUnder {number} pixels of scroll before to show the button
* @memberof plugins
* @class
* @static
*/
const ScrollTop = React.createClass({
propTypes: {
style: React.PropTypes.object,
showUnder: React.PropTypes.number
},
getDefaultProps() {
return {
showUnder: 200,
style: {
zIndex: 10,
position: 'fixed',
bottom: 50,
right: 30,
cursor: 'pointer',
transitionDuration: '0.2s',
transitionTimingFunction: 'linear',
transitionDelay: '0s'
}
};
},
render() {
return (
<ScrollUp style={this.props.style} showUnder={this.props.showUnder}>
<OverlayTrigger placement="left" overlay={<Tooltip><Message msgId="home.scrollTop"/></Tooltip>}>
<Button bsStyle="primary"><Glyphicon glyph="arrow-up"/></Button>
</OverlayTrigger>
</ScrollUp>);
}
});


module.exports = {
ScrollTopPlugin: ScrollTop
};
3 changes: 2 additions & 1 deletion web/client/product/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ module.exports = {
QueryPanelPlugin: require('../plugins/QueryPanel'),
FeatureGridPlugin: require('../plugins/FeatureGrid'),
TutorialPlugin: require('../plugins/Tutorial'),
ThemeSwitchePluginr: require('../plugins/ThemeSwitcher')
ThemeSwitchePluginr: require('../plugins/ThemeSwitcher'),
ScrollTopPlugin: require('../plugins/ScrollTop')
},
requires: {
ReactSwipe: require('react-swipeable-views').default,
Expand Down
1 change: 1 addition & 0 deletions web/client/translations/data.de-DE
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"Applications": "Anwendungen",
"Examples": "Beispiele",
"LinkedinGroup": "Mapstore Linkedin Gruppe",
"scrollTop": "An den Anfang der Seite scrollen",
"ml": {
"title": "Bleibe in Verbindung und auf dem Laufenden mit der Mailing Liste",
"subscribe_users": "Abonniere die Benutzer Mailing Liste",
Expand Down
1 change: 1 addition & 0 deletions web/client/translations/data.en-US
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"Applications": "Applications",
"Examples": "Examples",
"LinkedinGroup": "Mapstore Linkedin Group",
"scrollTop": "Scroll to the top of the page",
"ml": {
"title": "Keep in touch and stay up-to-date with the mailing lists",
"subscribe_users": "Subscribe Users Mailing List",
Expand Down
1 change: 1 addition & 0 deletions web/client/translations/data.fr-FR
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"Applications": "Applications",
"Examples": "Exemples",
"LinkedinGroup": "Mapstore Linkedin groupe",
"scrollTop": "Retour en haut de la page",
"ml": {
"title": "Restez au fait des derniers développements via les mailing lists",
"subscribe_users": "Souscrire à la Mailing List utilisateurs",
Expand Down
1 change: 1 addition & 0 deletions web/client/translations/data.it-IT
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"Applications": "Applicazioni",
"Examples": "Esempi",
"LinkedinGroup": "Gruppo Linkedin Mapstore",
"scrollTop": "Torna all'inizio della pagina",
"ml": {
"title": "Resta in contatto e tieniti aggiornato con le mailing list",
"subscribe_users": "Sottoscrivi la mailing list degli utenti",
Expand Down