Merge fbd628c7e5 into e68738c154
This commit is contained in:
commit
37f9434aad
5 changed files with 48 additions and 4 deletions
5
Gemfile
5
Gemfile
|
|
@ -84,6 +84,11 @@ gem 'jquery-ui-rails', '~> 4.2.1'
|
||||||
# for languages validation
|
# for languages validation
|
||||||
gem 'iso-639'
|
gem 'iso-639'
|
||||||
|
|
||||||
|
# geocoder
|
||||||
|
# gem 'geocoder'
|
||||||
|
##execute gem install geocoder serverside and uncomment the above line
|
||||||
|
|
||||||
|
|
||||||
# frontend javascripts
|
# frontend javascripts
|
||||||
source 'https://rails-assets.org' do
|
source 'https://rails-assets.org' do
|
||||||
# for placeholder images
|
# for placeholder images
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,11 @@ class Venue < ActiveRecord::Base
|
||||||
|
|
||||||
before_save :send_mail_notification
|
before_save :send_mail_notification
|
||||||
|
|
||||||
def address
|
geocoded_by :full_address
|
||||||
"#{street}, #{city}, #{country_name}"
|
after_validation :geocode
|
||||||
|
|
||||||
|
def full_address
|
||||||
|
"#{street}, #{city}, #{country}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def country_name
|
def country_name
|
||||||
|
|
@ -35,7 +38,7 @@ class Venue < ActiveRecord::Base
|
||||||
def notify_on_venue_changed?
|
def notify_on_venue_changed?
|
||||||
return false unless conference.try(:email_settings).try(:send_on_venue_updated)
|
return false unless conference.try(:email_settings).try(:send_on_venue_updated)
|
||||||
# do not notify unless the address changed
|
# do not notify unless the address changed
|
||||||
return false unless name_changed? || street_changed? || city_changed? || country_changed?
|
return false unless self.name_changed? || self.street_changed? || self.city_changed? || self.country_changed?
|
||||||
# do not notify unless the mail content is set up
|
# do not notify unless the mail content is set up
|
||||||
(!conference.email_settings.venue_updated_subject.blank? && !conference.email_settings.venue_updated_body.blank?)
|
(!conference.email_settings.venue_updated_subject.blank? && !conference.email_settings.venue_updated_body.blank?)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
= semantic_form_for(@venue, url: admin_conference_venue_path(@conference.short_title)) do |f|
|
= semantic_form_for(@venue, url: admin_conference_venue_path(@conference.short_title)) do |f|
|
||||||
= f.inputs :name, :website
|
= f.inputs :name, :website
|
||||||
= f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown-editable' } }, hint: markdown_hint
|
= f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown-editable' } }, hint: markdown_hint
|
||||||
= f.inputs :street, :postalcode, :city, :country, :latitude, :longitude
|
= f.inputs :street, :postalcode, :city, :country
|
||||||
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
|
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
|
||||||
|
|
||||||
#commercials-content.tab-pane
|
#commercials-content.tab-pane
|
||||||
|
|
|
||||||
34
app/views/admin/venues/_venue_map.html.haml
Normal file
34
app/views/admin/venues/_venue_map.html.haml
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
#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('//{s}.tile.openstreetmap.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%'
|
||||||
|
});
|
||||||
|
|
@ -41,3 +41,5 @@
|
||||||
.col-md-12.text-right
|
.col-md-12.text-right
|
||||||
= link_to(new_admin_conference_venue_path(@conference.short_title), class: 'btn btn-primary') do
|
= link_to(new_admin_conference_venue_path(@conference.short_title), class: 'btn btn-primary') do
|
||||||
Create Venue
|
Create Venue
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue