Skip to content

Instantly share code, notes, and snippets.

@tbuehlmann
Forked from AM-R/application_helper.rb
Last active May 24, 2018 09:52
Show Gist options
  • Save tbuehlmann/f3e86cbe52537f6c1e2db1024f51617d to your computer and use it in GitHub Desktop.
Save tbuehlmann/f3e86cbe52537f6c1e2db1024f51617d to your computer and use it in GitHub Desktop.
def rhost(www = nil)
if request.host != "www#{env_dev}.a.a"
request.host.gsub(/^w+(|\d+)\./, "").gsub(/\.a\.a/, "")
elsif www == 1 && request.host == "www#{env_dev}.a.a"
'www'
elsif www == 2
'test'
else
nil
end
end
$(document).on 'turbolinks:load', ->
$(".company.contacts").ready ->
init = ->
myMap = []
alert('<%= rhost %>')
#alert(window.location.href)
for x in [1..<%= I18n.translate("office.maps").size %>]
if x == 1
<% i = 1 %>
lat = '<%= I18n.translate("office.branches.n_#{i}.pos.lat") %>'
lon = '<%= I18n.translate("office.branches.n_#{i}.pos.lon") %>'
else if x == 2
<% i = 2 %>
lat = '<%= I18n.translate("office.branches.n_#{i}.pos.lat") %>'
lon = '<%= I18n.translate("office.branches.n_#{i}.pos.lon") %>'
else if x == 3
<% i = 3 %>
lat = '<%= I18n.translate("office.branches.n_#{i}.pos.lat") %>'
lon = '<%= I18n.translate("office.branches.n_#{i}.pos.lon") %>'
else
<% i = 4 %>
lat = '<%= I18n.translate("office.branches.n_#{i}.pos.lat") %>'
lon = '<%= I18n.translate("office.branches.n_#{i}.pos.lon") %>'
myMap[x] = new (ymaps.Map)('ada_map_'+x,
center: [
lat
lon
]
zoom: 16
controls: [
'zoomControl',
'trafficControl',
'typeSelector',
'rulerControl'
]
behaviors: [
])
myMap = []
for y in [1..<%= I18n.translate("office.maps").size %>]
ymaps.geoXml.load('//maps.yandex.ru/export/usermaps/apzSHv3t12Ao6m6pQg0HqVw-huQ5xQWV/').then ((res) ->
myMap[y].geoObjects.add res.geoObjects
return
)
ymaps.ready init
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment