Merge pull request #65 from houdiniproject/fix_for_64
Add support for Google Maps API keys since they're required now. Clos…
This commit is contained in:
commit
dd422b003f
5 changed files with 23 additions and 3 deletions
|
@ -19,6 +19,7 @@ var app = {
|
||||||
, autocomplete: <%= @nonprofit ? @nonprofit.autocomplete_supporter_address : 'undefined'%>
|
, autocomplete: <%= @nonprofit ? @nonprofit.autocomplete_supporter_address : 'undefined'%>
|
||||||
, facebook_app_id: "<%= ENV['FACEBOOK_APP_ID'] %>"
|
, facebook_app_id: "<%= ENV['FACEBOOK_APP_ID'] %>"
|
||||||
, map_provider: "<%= Settings.maps&.provider %>"
|
, map_provider: "<%= Settings.maps&.provider %>"
|
||||||
|
, map_provider_options: <%= Settings.maps&.options ? raw(Settings.maps.options.to_json) : {} %>
|
||||||
, editor: "<%= Settings.page_editor.editor%>"
|
, editor: "<%= Settings.page_editor.editor%>"
|
||||||
<% if Settings&.page_editor&.editor == 'froala' and Settings&.page_editor&.editor_options&.froala_key %>, froala_key: "<%= Settings.page_editor.editor_options.froala_key %>"<% end %>
|
<% if Settings&.page_editor&.editor == 'froala' and Settings&.page_editor&.editor_options&.froala_key %>, froala_key: "<%= Settings.page_editor.editor_options.froala_key %>"<% end %>
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,7 +10,17 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% elsif Format::Address.full_address(@nonprofit.address, @nonprofit.city, @nonprofit.state_code) %>
|
<% elsif Format::Address.full_address(@nonprofit.address, @nonprofit.city, @nonprofit.state_code) %>
|
||||||
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places"></script>
|
<script>
|
||||||
|
var script = document.createElement('script')
|
||||||
|
script.type = 'text/javascript'
|
||||||
|
script.id = 'google_maps'
|
||||||
|
let key = ""
|
||||||
|
if (app.map_provider_options && app.map_provider_options.key) {
|
||||||
|
key = `api_key=${app.map_provider_options.key}&`
|
||||||
|
}
|
||||||
|
script.src = `https://maps.googleapis.com/maps/api/js?${key}v=3.exp&sensor=false&libraries=places`
|
||||||
|
document.body.appendChild(script)
|
||||||
|
</script>
|
||||||
<% npo_full_address = Format::Address.full_address(@nonprofit.address, @nonprofit.city, @nonprofit.state_code, @nonprofit.zip_code) %>
|
<% npo_full_address = Format::Address.full_address(@nonprofit.address, @nonprofit.city, @nonprofit.state_code, @nonprofit.zip_code) %>
|
||||||
|
|
||||||
<div class='overview-map' id='js-map' data-address='<%= npo_full_address %>'>
|
<div class='overview-map' id='js-map' data-address='<%= npo_full_address %>'>
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
<td>
|
<td>
|
||||||
<p><%= @event.address %></p>
|
<p><%= @event.address %></p>
|
||||||
<p><%= @event.city %>, <%= @event.state_code %> <%= @event.zip_code %></p>
|
<p><%= @event.city %>, <%= @event.state_code %> <%= @event.zip_code %></p>
|
||||||
<p><a href='http://maps.google.com/?q=<%= Format::Address.full_address(@event.address, @event.city, @event.state_code) %>'>Map link</a></p>
|
<p><a href='https://maps.google.com/?q=<%= Format::Address.full_address(@event.address, @event.city, @event.state_code) %>'>Map link</a></p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% if !@event.directions.blank? %>
|
<% if !@event.directions.blank? %>
|
||||||
|
|
|
@ -19,7 +19,11 @@ cc_map.init = function(endpoint, options_obj, query) {
|
||||||
var script = document.createElement('script')
|
var script = document.createElement('script')
|
||||||
script.type = 'text/javascript'
|
script.type = 'text/javascript'
|
||||||
script.id = 'google_maps'
|
script.id = 'google_maps'
|
||||||
script.src = 'https://maps.googleapis.com/maps/api/js?sensor=false&callback=draw_map'
|
let key = ""
|
||||||
|
if (app.map_provider_options && app.map_provider_options.key) {
|
||||||
|
key = `api_key=${app.map_provider_options.key}&`
|
||||||
|
}
|
||||||
|
script.src = `https://maps.googleapis.com/maps/api/js?${key}sensor=false&callback=draw_map`
|
||||||
document.body.appendChild(script)
|
document.body.appendChild(script)
|
||||||
set_extra_options(options_obj)
|
set_extra_options(options_obj)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -120,6 +120,11 @@ Config.schema do
|
||||||
# the map provider to use. Currently that's just Google Maps or nothing
|
# the map provider to use. Currently that's just Google Maps or nothing
|
||||||
# Default is nil
|
# Default is nil
|
||||||
optional(:provider).value(included_in?:['google', nil])
|
optional(:provider).value(included_in?:['google', nil])
|
||||||
|
|
||||||
|
optional(:options).schema do
|
||||||
|
#key for your google maps instance
|
||||||
|
optional(:key).filled(:str?)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
required(:page_editor).schema do
|
required(:page_editor).schema do
|
||||||
|
|
Loading…
Reference in a new issue