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" %> +
+ Categories : + <% @categories.each do |category| %> + <%= category.title %> + <% end %> +
+Clear Filter +
+ + diff --git a/vendor/built_in_modules/location/app/views/panel/location/widget/locations/location_widget.html.erb b/vendor/built_in_modules/location/app/views/panel/location/widget/locations/location_widget.html.erb new file mode 100644 index 000000000..8b8cada20 --- /dev/null +++ b/vendor/built_in_modules/location/app/views/panel/location/widget/locations/location_widget.html.erb @@ -0,0 +1,3 @@ + + <%= image_tag @url, :width=>"300", :height=>"300" %> + \ No newline at end of file diff --git a/vendor/built_in_modules/location/config/routes.rb b/vendor/built_in_modules/location/config/routes.rb index 26ce72c90..e4df6eaae 100644 --- a/vendor/built_in_modules/location/config/routes.rb +++ b/vendor/built_in_modules/location/config/routes.rb @@ -9,6 +9,12 @@ Rails.application.routes.draw do resources :locations end + namespace :front_end do + resources :locations + end + namespace :widget do + match "location_widget" => "locations#location_widget" + end end end end diff --git a/vendor/built_in_modules/location/init.rb b/vendor/built_in_modules/location/init.rb index 5fd2ed6f3..3e71da77d 100644 --- a/vendor/built_in_modules/location/init.rb +++ b/vendor/built_in_modules/location/init.rb @@ -4,15 +4,17 @@ module Location base_url File.expand_path File.dirname(__FILE__) # personal_plugin :enable => true,:path=>"panel/location/plugin/profile",:i18n=>'admin.location' - # version "0.1" - # organization "Rulingcom" - # author "RD dep" - # intro "I am intro" - # update_info 'some update_info' + version "0.1" + organization "Rulingcom" + author "RD dep" + intro "I am intro" + update_info 'some update_info' - # front_end do - # app_page 'bulletins' - # end + front_end do + app_page 'locations' do + frontend_i18n 'location.location' + end + end # category ["BulletinCategory"] @@ -33,6 +35,12 @@ module Location categorizable authorizable + + widgets do + customize_widget "location_widget" do + widget_i18n "location.location" + end + end side_bar do head_label_i18n 'location.location',:icon_class=>"icons-location"