mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Beautify venues#show
This commit is contained in:
parent
f83e76102f
commit
33e1c6eae1
4 changed files with 46 additions and 40 deletions
|
|
@ -23,6 +23,10 @@ class Venue < ActiveRecord::Base
|
||||||
name.name if name
|
name.name if name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def location?
|
||||||
|
!(latitude.blank? || longitude.blank?)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def send_mail_notification
|
def send_mail_notification
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,11 @@
|
||||||
= @venue.country_name
|
= @venue.country_name
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
= link_to(edit_admin_conference_venue_path(@conference.short_title), class: 'btn btn-primary', disabled: !(can? :update, @venue) ) do
|
%p.text-right
|
||||||
Edit Venue
|
= link_to(edit_admin_conference_venue_path(@conference.short_title), class: 'btn btn-primary', disabled: !(can? :update, @venue) ) do
|
||||||
= link_to(admin_conference_venue_path(@conference.short_title), method: 'delete', class: 'btn btn-danger', disabled: !(can? :destroy, @venue)) do
|
Edit Venue
|
||||||
Delete Venue
|
= link_to(admin_conference_venue_path(@conference.short_title), method: 'delete', class: 'btn btn-danger', disabled: !(can? :destroy, @venue)) do
|
||||||
|
Delete Venue
|
||||||
-else
|
-else
|
||||||
.row
|
.row
|
||||||
.col-md-12.text-right
|
.col-md-12.text-right
|
||||||
|
|
|
||||||
|
|
@ -1,42 +1,8 @@
|
||||||
= content_for :splash_nav do
|
= content_for :splash_nav do
|
||||||
%li
|
%li
|
||||||
%a.smoothscroll{ href: '#venue' } Venue
|
%a.smoothscroll{ href: '#venue' } Venue
|
||||||
-if !@conference.venue.latitude.blank? and !@conference.venue.longitude.blank?
|
-if @conference.venue.location?
|
||||||
#map{style: "height: 500px;" }
|
= render 'conference/venue_map'
|
||||||
- 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
|
|
||||||
L.Icon.Default.imagePath = '/assets/leaflet/';
|
|
||||||
// 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 © <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
|
-else
|
||||||
.container
|
.container
|
||||||
.row
|
.row
|
||||||
|
|
|
||||||
35
app/views/conference/_venue_map.html.haml
Normal file
35
app/views/conference/_venue_map.html.haml
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
#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
|
||||||
|
L.Icon.Default.imagePath = '/assets/leaflet/';
|
||||||
|
// 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 © <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%'
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue