Module: C80MapFloors::ApplicationHelper

Defined in:
app/helpers/c80_map_floors/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#render_mapObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/helpers/c80_map_floors/application_helper.rb', line 4

def render_map

  # map_settings = C80MapFloors::Setting.first


  # т.к. в json попадают строки вида
  # /home/scout/git/bitbucket/vorsa/public/uploads/map/map.jpg
  # извлечём эту строку, затем во вью обработаем её image_path

  p = Rails.root.join("public", "locations.json")
  locs = File.read(p)
  locs_hash = JSON.parse(locs)
  locs_hash["img"] = image_path(locs_hash["img"])

  render :partial => 'c80_map_floors/map_row_index',
         :locals => {
             locs_hash: locs_hash,
             mapwidth: locs_hash["mapwidth"],
             mapheight: locs_hash["mapheight"]
         }

end