orbit-location/app/controllers/panel/location/widget/locations_controller.rb

17 lines
833 B
Ruby

class Panel::Location::Widget::LocationsController < OrbitWidgetController
def location_widget
@categories = params[:category_id]
locations = LocationInfo.where(:category_id.in => @categories)
@url = "http://maps.googleapis.com/maps/api/staticmap?zoom=16&size=400x400&maptype=roadmap%20&sensor=false&"
markers = ""
locations.each do |loc|
color = Category.find(loc.category_id).custom_value
color.gsub!("#","")
markers = markers + "markers=color:0x#{color}|#{loc.latitude},#{loc.longitude}&"
end
@url = @url + markers.chop
# http://maps.googleapis.com/maps/api/staticmap?zoom=13&size=600x300&maptype=roadmap%20&markers=color:0xCF2C9B|40.702147,-74.015794&markers=color:CF2C9B|label:G|40.711614,-74.012318%20&markers=color:red|color:red|label:C|40.718217,-73.998284&sensor=false
end
end