diff --git a/vendor/built_in_modules/location/app/assets/javascripts/location.js b/vendor/built_in_modules/location/app/assets/javascripts/location.js index 685ac6df1..3edb22cb4 100644 --- a/vendor/built_in_modules/location/app/assets/javascripts/location.js +++ b/vendor/built_in_modules/location/app/assets/javascripts/location.js @@ -1,6 +1,6 @@ var Locations = function(ls){ - l = this; + this.name = "Locations"; this.locations = ls; this.markerCounts = 0; var map = null, @@ -11,7 +11,6 @@ var Locations = function(ls){ var initialize = function() { - google.maps.visualRefresh = true; var location = ( l.locations.length ? new google.maps.LatLng( l.locations[0].latitude, l.locations[0].longitude ) : default_location ), mapOptions = { @@ -119,10 +118,10 @@ var Locations = function(ls){ } return filtered; } - -google.maps.event.addDomListener(window, 'load', initialize); + initialize(); } + var InvalidObjectError = function(){ this.name = "InvalidObjectError"; this.message = "Object not valid"; diff --git a/vendor/built_in_modules/location/app/controllers/panel/location/front_end/locations_controller.rb b/vendor/built_in_modules/location/app/controllers/panel/location/front_end/locations_controller.rb new file mode 100644 index 000000000..4be3e2ecc --- /dev/null +++ b/vendor/built_in_modules/location/app/controllers/panel/location/front_end/locations_controller.rb @@ -0,0 +1,12 @@ +class Panel::Location::FrontEnd::LocationsController < OrbitWidgetController + def index + @categories = @module_app.categories.enabled + @locations = LocationInfo.all + + @location_infos = []; + @locations.each do |loc| + loc['color'] = Category.find(loc.category_id).custom_value + @location_infos << loc + end + end +end \ No newline at end of file diff --git a/vendor/built_in_modules/location/app/controllers/panel/location/widget/locations_controller.rb b/vendor/built_in_modules/location/app/controllers/panel/location/widget/locations_controller.rb new file mode 100644 index 000000000..f03e8087b --- /dev/null +++ b/vendor/built_in_modules/location/app/controllers/panel/location/widget/locations_controller.rb @@ -0,0 +1,17 @@ +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 \ No newline at end of file diff --git a/vendor/built_in_modules/location/app/views/panel/location/front_end/locations/index.html.erb b/vendor/built_in_modules/location/app/views/panel/location/front_end/locations/index.html.erb new file mode 100644 index 000000000..58fb23674 --- /dev/null +++ b/vendor/built_in_modules/location/app/views/panel/location/front_end/locations/index.html.erb @@ -0,0 +1,40 @@ +<%= javascript_include_tag "location" %> +