Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Replace maps in edit schedule - Replace maps in tabs - Replace maps in competitions forms - Replace maps in persons profiles
- Loading branch information
Showing
26 changed files
with
1,625 additions
and
2,088 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
} | ||
|
||
#venues-edit-panel { | ||
.venue-map { | ||
.leaflet-container { | ||
height: 300px; | ||
} | ||
.venue-form-label { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
WcaOnRails/app/javascript/edit-schedule/EditVenue/VenueLocationInput.jsx.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React from 'react' | ||
<%# | ||
NOTE: Our headless browser PhantomJS doesn't support HTMLVideoElement. | ||
Leaflet has a built-in video plugin and its code do an "instanceOf(HTMLVideoElement)", | ||
which throws an error during tests. | ||
For this reason, we only import stuff from Leaflet if we are not in test environment. | ||
In test environment we just create a dummy VenueLocationInput. | ||
%> | ||
<% if Rails.env.test? %> | ||
export const VenueLocationInput = () => (<div/>); | ||
<% else %> | ||
// Import leaflet, and the fix for the icon url | ||
import 'leaflet-wca'; | ||
import { Map, TileLayer, Marker } from "react-leaflet" | ||
import { userTileProvider } from 'leaflet-wca/providers.js.erb'; | ||
import { toDegrees } from '../utils' | ||
import { Row, Col } from 'react-bootstrap' | ||
export class VenueLocationInput extends React.Component { | ||
|
||
invalidateSize = () => { | ||
this.mapElem.leafletElement.invalidateSize(false); | ||
} | ||
|
||
componentDidMount() { | ||
$(window).on('venues-panel-shown', this.invalidateSize); | ||
} | ||
|
||
componentWillUnmount() { | ||
$(window).off('venues-panel-shown', this.invalidateSize); | ||
} | ||
|
||
render() { | ||
let { lat, lng, actionHandler } = this.props; | ||
let provider = userTileProvider; | ||
let mapPosition = { lat: toDegrees(lat), lng: toDegrees(lng) }; | ||
return ( | ||
<Row> | ||
<Col xs={12}> | ||
<span className="venue-form-label control-label">Please pick the venue location below:</span> | ||
</Col> | ||
<Col xs={12} className="venue-map"> | ||
<Map center={mapPosition} | ||
zoom={16} | ||
scrollWheelZoom={false} | ||
ref={m => { this.mapElem = m; }} | ||
> | ||
<TileLayer url={provider.url} attribution={provider.attribution}/> | ||
<Marker | ||
position={mapPosition} | ||
draggable={true} | ||
onDragend={actionHandler} | ||
/> | ||
</Map> | ||
</Col> | ||
</Row> | ||
); | ||
} | ||
} | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.