diff --git a/app/static/app/js/components/Map.jsx b/app/static/app/js/components/Map.jsx index 5bbd2f2f..a807c458 100644 --- a/app/static/app/js/components/Map.jsx +++ b/app/static/app/js/components/Map.jsx @@ -648,6 +648,7 @@ _('Example:'), ref={(ref) => { this.shareButton = ref; }} task={this.state.singleTask} linksTarget="map" + queryParams={{t: this.props.mapType}} /> : ""} ; return ( diff --git a/app/static/app/js/components/SharePopup.jsx b/app/static/app/js/components/SharePopup.jsx index b93d2902..812f38a7 100644 --- a/app/static/app/js/components/SharePopup.jsx +++ b/app/static/app/js/components/SharePopup.jsx @@ -15,7 +15,8 @@ class SharePopup extends React.Component{ task: PropTypes.object.isRequired, linksTarget: PropTypes.oneOf(['map', '3d']).isRequired, placement: PropTypes.string, - taskChanged: PropTypes.func + taskChanged: PropTypes.func, + queryParams: PropTypes.object }; static defaultProps = { placement: 'top', @@ -38,7 +39,11 @@ class SharePopup extends React.Component{ } getRelShareLink = () => { - return `/public/task/${this.props.task.id}/${this.props.linksTarget}/`; + let url = `/public/task/${this.props.task.id}/${this.props.linksTarget}/`; + if (this.props.queryParams){ + url += Utils.toSearchQuery(this.props.queryParams); + } + return url; } componentDidMount(){ @@ -86,8 +91,8 @@ class SharePopup extends React.Component{ } render(){ - const shareLink = Utils.absoluteUrl(this.state.relShareLink); - const iframeUrl = Utils.absoluteUrl(`public/task/${this.state.task.id}/iframe/${this.props.linksTarget}/`); + const shareLink = Utils.absoluteUrl(this.getRelShareLink()); + const iframeUrl = Utils.absoluteUrl(`public/task/${this.state.task.id}/iframe/${this.props.linksTarget}/${Utils.toSearchQuery(this.props.queryParams)}`); const iframeCode = ``; return (
{ e.stopPropagation(); }} className={"sharePopup " + this.props.placement}> diff --git a/app/views/public.py b/app/views/public.py index 37ec67aa..a5ecff02 100644 --- a/app/views/public.py +++ b/app/views/public.py @@ -29,7 +29,8 @@ def handle_map(request, template, task_pk=None, hide_title=False): 'map-items': json.dumps([task.get_map_items()]), 'title': task.name if not hide_title else '', 'public': 'true', - 'share-buttons': 'false' if settings.DESKTOP_MODE else 'true' + 'share-buttons': 'false' if settings.DESKTOP_MODE else 'true', + 'selected-map-type': request.GET.get('t', 'auto'), }.items() })