Skip to content

Commit

Permalink
Merge pull request #1485 from pierotofy/autoperc
Browse files Browse the repository at this point in the history
Ability to share particular map type
  • Loading branch information
pierotofy committed Apr 4, 2024
2 parents b1fdcbb + c2c65a2 commit 10a4485
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions app/static/app/js/components/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ _('Example:'),
ref={(ref) => { this.shareButton = ref; }}
task={this.state.singleTask}
linksTarget="map"
queryParams={{t: this.props.mapType}}
/>
: ""}
<SwitchModeButton
Expand Down
4 changes: 3 additions & 1 deletion app/static/app/js/components/ShareButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class ShareButton extends React.Component {
static propTypes = {
task: PropTypes.object.isRequired,
linksTarget: PropTypes.oneOf(['map', '3d']).isRequired,
popupPlacement: PropTypes.string
popupPlacement: PropTypes.string,
queryParams: PropTypes.string
}

constructor(props){
Expand Down Expand Up @@ -45,6 +46,7 @@ class ShareButton extends React.Component {
taskChanged={this.handleTaskChanged}
placement={this.props.popupPlacement}
linksTarget={this.props.linksTarget}
queryParams={this.props.queryParams}
/>;

return (
Expand Down
13 changes: 9 additions & 4 deletions app/static/app/js/components/SharePopup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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(){
Expand Down Expand Up @@ -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 = `<iframe scrolling="no" title="WebODM" width="61.8033%" height="360" frameBorder="0" src="${iframeUrl}"></iframe>`;

return (<div onMouseDown={e => { e.stopPropagation(); }} className={"sharePopup " + this.props.placement}>
Expand Down
3 changes: 2 additions & 1 deletion app/views/public.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})

Expand Down

0 comments on commit 10a4485

Please sign in to comment.