Sha256: 64410515625970bfeed3493612f1ee14f3d508eb91c8d6f90c914b4d28ec6b67

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

module C80Map
  module ApplicationHelper

    def render_map(page_tag)
      if page_tag == 'map' # todo: tag страницы, на котором должна рендериться карта, перенести в базу в настройки


        # map_settings = C80Map::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/map_row_index',
               :locals => {
                    locs_hash: locs_hash,
                    mapwidth:locs_hash["mapwidth"],
                    mapheight:locs_hash["mapheight"]
               }

      else
        render :partial => 'c80_map/map_row'
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
c80_map-0.1.0.24 app/helpers/c80_map/application_helper.rb