Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 4 additions & 1 deletion app/routes/public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Route from '@ember/routing/route';
import moment from 'moment';
import { set } from '@ember/object';
import { inject as service } from '@ember/service';
import ENV from 'open-event-frontend/config/environment';

export default Route.extend({
headData: service(),
Expand Down Expand Up @@ -65,7 +66,9 @@ export default Route.extend({
tickets : []
}),

attendees: []
attendees: [],

mapConfig: ENV.APP.mapConfig
};
},
afterModel(model) {
Expand Down
3 changes: 2 additions & 1 deletion app/styles/pages/public-event.scss
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
width: 100%;
}

.event-map > .g-map > .g-map-canvas {
.event-map > .g-map > .g-map-canvas,
.event-map > iframe.g-map {
height: 300px;
}
18 changes: 11 additions & 7 deletions app/templates/components/public/event-map.hbs
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
{{#if event.isMapShown}}
<div class="eight wide column event-map">
<h1>{{t 'Getting Here'}}</h1>
{{#g-map markersFitMode='live' lat=37.744 lng=-122.4367 address=event.locationName zoom=2 class='google-maps' as |context|}}
{{#g-map-address-marker context address=event.locationName as |markerContext|}}
{{#g-map-infowindow markerContext}}
{{event.locationName}}
{{/g-map-infowindow}}
{{/g-map-address-marker}}
{{/g-map}}
{{#if (eq mapConfig.display 'embed') }}
<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>
Copy link
Member

Choose a reason for hiding this comment

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

Is it temporary @iamareebjamal ,as we are not using any custom calls in the app? If yes, we should just add a comment untill mapbox is implemented, as it will break the coding conventions getting followed for handlebars in the repository.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, it is not temporary. If there is neither mapbox nor google API, this will be rendered. As both services are paid and this is free.

as we are not using any custom calls in the app?

What do you mean by custom calls? Google Maps API is a custom library and we are using it anyway

as it will break the coding conventions getting followed for handlebars in the repository

What coding conventions for handlebars, can you elaborate?

Copy link
Member

Choose a reason for hiding this comment

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

Nothing,I didnt saw the iframe tag thought it is js tweak.
It will be better to add some text between iframe tag, if iframe is not supported in any device?

Copy link
Member Author

@iamareebjamal iamareebjamal Jan 4, 2020

Choose a reason for hiding this comment

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

If iframe is not supported in that device, then the device probably does not even have a working browser. iframe is an HTML4 element which was launched in December 18, 1997 and probably older than you

Copy link
Member

Choose a reason for hiding this comment

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

😅 Its lgtm

{{else}}
{{#g-map markersFitMode='live' lat=37.744 lng=-122.4367 address=event.locationName zoom=2 class='google-maps' as |context|}}
{{#g-map-address-marker context address=event.locationName as |markerContext|}}
{{#g-map-infowindow markerContext}}
{{event.locationName}}
{{/g-map-infowindow}}
{{/g-map-address-marker}}
{{/g-map}}
{{/if}}
</div>
{{/if}}
<div class="{{if event.isMapShown 'eight' 'sixteen'}} wide column address">
Expand Down
2 changes: 1 addition & 1 deletion app/templates/public/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<div class="ui hidden divider"></div>
{{/if}}
<div class="location" id="getting-here">
{{public/event-map event=model.event}}
{{public/event-map event=model.event mapConfig=model.mapConfig}}
</div>
<div class="ui hidden divider"></div>
{{#if model.event.copyright}}
Expand Down
7 changes: 7 additions & 0 deletions config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ module.exports = function(environment) {
protocol : 'https'
};

ENV.APP.mapConfig = {};

// Use embed iframe map using address if MAP_DISPLAY is set or GOOGLE_API_KEY is not available or invalid
if (process.env.MAP_DISPLAY === 'embed' || !process.env.GOOGLE_API_KEY || !process.env.GOOGLE_API_KEY.startsWith('AIza')) {
ENV.APP.mapConfig.display = 'embed';
}

ENV.sentry.hostname = getSentryServer(ENV.sentry.dsn, false);
ENV.sentry.server = getSentryServer(ENV.sentry.dsn, true);
if (process.env.CSPPermissive) {
Expand Down