houdini/app/views/nonprofits/_overview_media.html.erb

32 lines
1.3 KiB
Text
Raw Normal View History

2020-06-12 20:03:43 +00:00
<%- # License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE -%>
<!-- partial start: nonprofits/_overview_media -->
<div class='overview-media'>
<% if @nonprofit.main_image.attached? %>
<div>
<div style='overflow: hidden; height: initial;'>
<%= image_tag rails_storage_proxy_url(@nonprofit.main_image_by_size(:nonprofit_carousel)) %>
</div>
</div>
<% elsif Format::Address.full_address(@nonprofit.address, @nonprofit.city, @nonprofit.state_code) %>
<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 = `key=${app.map_provider_options.key}&`
}
script.src = `https://maps.googleapis.com/maps/api/js?${key}v=3.exp&libraries=places`
document.body.appendChild(script)
</script>
<% 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>
<% end %>
</div>
<!-- partial end: nonprofits/_overview_media -->