diff --git a/app/models/venue.rb b/app/models/venue.rb index 76d7de5e..ebccda8d 100644 --- a/app/models/venue.rb +++ b/app/models/venue.rb @@ -13,8 +13,11 @@ class Venue < ActiveRecord::Base before_save :send_mail_notification - def address - "#{street}, #{city}, #{country_name}" + geocoded_by :full_address + after_validation :geocode + + def full_address + "#{street}, #{city}, #{country}" end def country_name @@ -35,7 +38,7 @@ class Venue < ActiveRecord::Base def notify_on_venue_changed? return false unless conference.try(:email_settings).try(:send_on_venue_updated) # 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 (!conference.email_settings.venue_updated_subject.blank? && !conference.email_settings.venue_updated_body.blank?) end diff --git a/app/views/admin/venues/_form.html.haml b/app/views/admin/venues/_form.html.haml index 7dd08a2c..8e021e3e 100644 --- a/app/views/admin/venues/_form.html.haml +++ b/app/views/admin/venues/_form.html.haml @@ -15,7 +15,7 @@ = semantic_form_for(@venue, url: admin_conference_venue_path(@conference.short_title)) do |f| = f.inputs :name, :website = 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' } #commercials-content.tab-pane diff --git a/app/views/admin/venues/_venue_map.html.haml b/app/views/admin/venues/_venue_map.html.haml new file mode 100644 index 00000000..b58b3053 --- /dev/null +++ b/app/views/admin/venues/_venue_map.html.haml @@ -0,0 +1,34 @@ +#map{style: "height: 500px;" } +- popup = "