osem-fcy/app/views/conference/_venue.html.haml
David Sedeño 7c0cd30dda Add venue_photos model and venue_photos admin controller in order to add more images to Venues and allow to delete it.
Show the additional photos in splash. Added fancybox gem for zoom when click on the additional photo.

fix #777
2016-02-13 17:39:30 +01:00

67 lines
2.8 KiB
Text

= content_for :splash_nav do
%li
%a.smoothscroll{ href: '#venue' } Venue
-if !@conference.venue.latitude.blank? and !@conference.venue.longitude.blank?
#map{style: "height: 500px;" }
- popup = "<h3>#{@conference.venue.name}</h3><br>#{@conference.venue.street}<br>#{@conference.venue.city}<br>#{@conference.venue.country_name}"
- content_for(:script_body) do
:javascript
// create a map in the "map" div, set the view to a given place and zoom
var map = L.map('map', {scrollWheelZoom: false}).setView([#{@conference.venue.latitude}, #{@conference.venue.longitude}], 11);
// add an OpenStreetMap tile layer
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>',
maxZoom: 18
}).addTo(map);
// add a marker in the given location, attach some popup content to it and open the popup
L.marker([#{@conference.venue.latitude}, #{@conference.venue.longitude}]).addTo(map)
.bindPopup("#{popup}")
.openPopup();
// Turn scrollwheel on when user clicks
map.on('focus', function(e) {
map.scrollWheelZoom.enable();
});
// Turn scrollwheel off once the map isn't in the viewport anymore
$('#map').waypoint({
handler: function(direction) {
map.scrollWheelZoom.disable();
//alert('map');
},
offset: '90%'
});
$('#map').waypoint({
handler: function(direction) {
map.scrollWheelZoom.disable();
//alert('map');
},
offset: '10%'
});
-else
.container
.row
.col-md-12
%h2.text-center
= "#{@conference.venue.city} / #{@conference.venue.country_name}"
.col-md-6
.thumbnail
=image_tag(@conference.venue.photo, class: 'img-responsive img-rounded') unless @conference.venue.photo.blank?
.caption
- unless @conference.venue.description.blank?
= markdown(@conference.venue.description)
.col-md-6
%address
%h1
= @conference.venue.name
= @conference.venue.street
%br
= "#{@conference.venue.postalcode}, #{@conference.venue.city}"
%br
= @conference.venue.country_name
- if @conference.venue.website
%br
=link_to @conference.venue.website, @conference.venue.website
- @conference.venue.venue_photos.in_groups_of(4, false).each do |photo_group|
.row
- photo_group.each do |photo|
.col-md-3
= link_to image_tag(photo.photo(:thumb), class: 'img-rounded'), photo.photo(:large), class: 'fancybox'