Skip to content

Instantly share code, notes, and snippets.

@AM-R
Created May 24, 2018 09:43
Show Gist options
  • Save AM-R/6f80903713c995e728d1c3f7749712f8 to your computer and use it in GitHub Desktop.
Save AM-R/6f80903713c995e728d1c3f7749712f8 to your computer and use it in GitHub Desktop.
def rhost(www = nil)
if request.host != "www#{env_dev}.a.a"
rhost = request.host.gsub(/^w+(|\d+)\./, "").gsub(/\.a\.a/, "")
@rhost = request.host.gsub(/^w+(|\d+)\./, "").gsub(/\.a\.a/, "")
elsif www == 1 and request.host == "www#{env_dev}.a.a"
rhost = 'www'
@rhost = 'www'
elsif www == 2
rhost = 'test'
@rhost = 'test'
else
rhost = nil
@rhost = 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