Skip to content

Commit cf53569

Browse files
feat: Fallback to embedded iframe map (#3760)
1 parent 255c4a7 commit cf53569

File tree

5 files changed

+25
-10
lines changed

5 files changed

+25
-10
lines changed

app/routes/public/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import Route from '@ember/routing/route';
22
import moment from 'moment';
33
import { set } from '@ember/object';
44
import { inject as service } from '@ember/service';
5+
import ENV from 'open-event-frontend/config/environment';
56

67
export default Route.extend({
78
headData: service(),
@@ -65,7 +66,9 @@ export default Route.extend({
6566
tickets : []
6667
}),
6768

68-
attendees: []
69+
attendees: [],
70+
71+
mapConfig: ENV.APP.mapConfig
6972
};
7073
},
7174
afterModel(model) {

app/styles/pages/public-event.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@
167167
width: 100%;
168168
}
169169

170-
.event-map > .g-map > .g-map-canvas {
170+
.event-map > .g-map > .g-map-canvas,
171+
.event-map > iframe.g-map {
171172
height: 300px;
172173
}

app/templates/components/public/event-map.hbs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
{{#if event.isMapShown}}
22
<div class="eight wide column event-map">
33
<h1>{{t 'Getting Here'}}</h1>
4-
{{#g-map markersFitMode='live' lat=37.744 lng=-122.4367 address=event.locationName zoom=2 class='google-maps' as |context|}}
5-
{{#g-map-address-marker context address=event.locationName as |markerContext|}}
6-
{{#g-map-infowindow markerContext}}
7-
{{event.locationName}}
8-
{{/g-map-infowindow}}
9-
{{/g-map-address-marker}}
10-
{{/g-map}}
4+
{{#if (eq mapConfig.display 'embed') }}
5+
<iframe class="g-map" src="https://maps.google.com/maps?q={{event.locationName}}&t=&z=15&ie=UTF8&iwloc=&output=embed" frameborder="0" scrolling="no"></iframe>
6+
{{else}}
7+
{{#g-map markersFitMode='live' lat=37.744 lng=-122.4367 address=event.locationName zoom=2 class='google-maps' as |context|}}
8+
{{#g-map-address-marker context address=event.locationName as |markerContext|}}
9+
{{#g-map-infowindow markerContext}}
10+
{{event.locationName}}
11+
{{/g-map-infowindow}}
12+
{{/g-map-address-marker}}
13+
{{/g-map}}
14+
{{/if}}
1115
</div>
1216
{{/if}}
1317
<div class="{{if event.isMapShown 'eight' 'sixteen'}} wide column address">

app/templates/public/index.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<div class="ui hidden divider"></div>
5959
{{/if}}
6060
<div class="location" id="getting-here">
61-
{{public/event-map event=model.event}}
61+
{{public/event-map event=model.event mapConfig=model.mapConfig}}
6262
</div>
6363
<div class="ui hidden divider"></div>
6464
{{#if model.event.copyright}}

config/environment.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ module.exports = function(environment) {
115115
protocol : 'https'
116116
};
117117

118+
ENV.APP.mapConfig = {};
119+
120+
// Use embed iframe map using address if MAP_DISPLAY is set or GOOGLE_API_KEY is not available or invalid
121+
if (process.env.MAP_DISPLAY === 'embed' || !process.env.GOOGLE_API_KEY || !process.env.GOOGLE_API_KEY.startsWith('AIza')) {
122+
ENV.APP.mapConfig.display = 'embed';
123+
}
124+
118125
ENV.sentry.hostname = getSentryServer(ENV.sentry.dsn, false);
119126
ENV.sentry.server = getSentryServer(ENV.sentry.dsn, true);
120127
if (process.env.CSPPermissive) {

0 commit comments

Comments
 (0)