Files
ch420/app/views/greendays/index.html.slim
T

69 lines
2.2 KiB
Plaintext
Raw Normal View History

2017-11-12 13:27:10 +01:00
2017-11-16 17:38:48 +01:00
h1.sr-only = title '#Greensaturday'
2017-11-12 16:35:43 +01:00
= render 'description'
2017-11-12 13:27:10 +01:00
#map
2017-11-12 14:05:45 +01:00
= link_to 'Neuen Shop erfassen', new_greenday_path if admin?
2017-11-12 13:27:10 +01:00
2017-11-12 14:05:45 +01:00
.row.fix
2017-11-12 13:27:10 +01:00
- @greendays.each do |greenday|
.col-xs-12.col-sm-6.col-lg-4
.well
h2 = greenday.title
2017-11-12 14:05:45 +01:00
- if greenday.logo.url(:original) != '/logos/original/missing.png'
2017-11-12 13:27:10 +01:00
= image_tag greenday.logo.url(:original), alt: '', class: 'img-responsive'
address = simple_format(greenday.address)
- if greenday.homepage
2017-11-18 19:48:23 +01:00
= link_to("Website", greenday.homepage, target: "_blank")
2017-11-12 13:27:10 +01:00
p = markdown(greenday.description).html_safe
- if admin?
= link_to 'Bearbeiten', edit_greenday_path(greenday)
|  
= link_to 'Löschen', greenday, data: { confirm: 'Are you sure?' }, method: :delete
javascript:
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 8, center: {lat: 47.242, lng: 8.133},
});
var greendays_url = "#{greendays_url(format: :json)}"
var infowindow = new google.maps.InfoWindow({
content: '',
maxWidth: 200
});
$.getJSON(greendays_url, function(json) {
$.each(json, function(key, data) {
var marker = new google.maps.Marker({
position: {lat: data.coordinates[1], lng: data.coordinates[0] },
map: map,
title: data.title
});
marker.addListener('click', function() {
infowindow.open(map, marker);
var content = '<b>' + data.title + '</b>'
if(data.logo) {
content += '<img src="' + data.logo + ' alt="" width="100%"/>'
}
content += '<address>' + data.address.replace(/\n/g,"<br>")
if(data.homepage) {
2017-11-18 19:48:23 +01:00
content += '<br/><a href="' + data.homepage + '" target="_blank">Website</a>'
2017-11-12 13:27:10 +01:00
}
content += '</address>'
if(data.description) {
content += '<p>' + data.description + '</p>'
}
infowindow.setContent(content);
});
});
});
}
script async="" defer="" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBbwMtGKDqf4i8x9-OVP1-H_QVAKp92h2M&callback=initMap&libraries=visualization"