Fix for geolocation
This commit is contained in:
parent
c56ecc0c7f
commit
87ff896c42
@ -2156,7 +2156,7 @@ body {
|
||||
}
|
||||
|
||||
button, .button {
|
||||
margin: 0 0.25em;
|
||||
margin: 0 0.25em 0.5em;
|
||||
}
|
||||
|
||||
.message {
|
||||
|
@ -558,7 +558,7 @@ class ConferencesController < ApplicationController
|
||||
@errors[:name] = :empty
|
||||
end
|
||||
|
||||
if params[:location].present? && params[:location].gsub(/[\s\W]/, '').present? && (l = Geocoder.search(params[:location])).present?
|
||||
if params[:location].present? && params[:location].gsub(/[\s\W]/, '').present? && (l = Geocoder.search(params[:location], params: { language: 'en' })).present?
|
||||
corrected = view_context.location(l.first)
|
||||
|
||||
if corrected.present?
|
||||
|
@ -443,13 +443,13 @@ module ApplicationHelper
|
||||
end
|
||||
|
||||
def get_remote_location
|
||||
Geocoder.search(session['remote_ip'] || (session['remote_ip'] = open("http://checkip.dyndns.org").first.gsub(/^.*\s([\d\.]+).*$/s, '\1').gsub(/[^\.\d]/, ''))).first
|
||||
Geocoder.search(session['remote_ip'] || (session['remote_ip'] = open("http://checkip.dyndns.org").first.gsub(/^.*\s([\d\.]+).*$/s, '\1').gsub(/[^\.\d]/, '')), params: { language: 'en' }).first
|
||||
end
|
||||
|
||||
def lookup_ip_location
|
||||
begin
|
||||
if is_test? && ApplicationController::get_location.present?
|
||||
Geocoder.search(ApplicationController::get_location).first
|
||||
Geocoder.search(ApplicationController::get_location, params: { language: 'en' }).first
|
||||
elsif request.remote_ip == '127.0.0.1' || request.remote_ip == '::1'
|
||||
get_remote_location
|
||||
else
|
||||
@ -546,7 +546,7 @@ module ApplicationHelper
|
||||
$panoramios ||= Hash.new
|
||||
$panoramios[location] ||= 0
|
||||
$panoramios[location] += 1
|
||||
result = Geocoder.search(location).first
|
||||
result = Geocoder.search(location, params: { language: 'en' }).first
|
||||
if result
|
||||
points = Geocoder::Calculations.bounding_box([result.latitude, result.longitude], 5, { :unit => :km })
|
||||
options = {:set => :public, :size => :original, :from => 0, :to => 20, :mapfilter => false, :miny => points[0], :minx => points[1], :maxy => points[2], :maxx => points[3]}
|
||||
|
@ -149,6 +149,7 @@ class UserMailer < ActionMailer::Base
|
||||
|
||||
def contact(from, subject, message, email_list)
|
||||
@message = message
|
||||
@subject = subject
|
||||
@from = from.is_a?(Integer) ? User.find(from) : from
|
||||
|
||||
mail to: email_list.join(', '), subject: @subject, reply_to: from.is_a?(User) ? from.named_email : from
|
||||
@ -156,6 +157,7 @@ class UserMailer < ActionMailer::Base
|
||||
|
||||
def contact_details(from, subject, message, request, params)
|
||||
@message = message
|
||||
@subject = subject
|
||||
@from = from.is_a?(Integer) ? User.find(from) : from
|
||||
@request = request
|
||||
@params = params
|
||||
|
Loading…
x
Reference in New Issue
Block a user