gmaps4rails 0.11.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -41,7 +41,7 @@ To make Rails serve the assets (javascripts, stylesheets and marker images) you
41
41
 
42
42
  * //= require gmaps4rails/openlayers.js
43
43
 
44
- You even don't need the `yield :head` if you include `require gmaps4rails` in you CSS manifest.
44
+ You even don't need the `yield :head` if you include `require gmaps4rails` in your CSS manifest.
45
45
 
46
46
  - if you are using Rails 3.0:
47
47
  if you have Rails configured to serve static assets ('config.serve_static_assets = true'; note that it is disabled by default in production environment), they'll be served directly from gem's public/ directory.
@@ -83,7 +83,7 @@ Done!
83
83
 
84
84
  == Options
85
85
 
86
- * Markers with Info window, Custom Picture
86
+ * Markers with Info window, Custom Picture, RichMarkers (make your own markers with custom html)
87
87
 
88
88
  * Automatic sidebar with list of markers
89
89
 
@@ -17,6 +17,7 @@ if enable_css == true %>
17
17
  <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&amp;libraries=geometry<%= g_libraries(options['map_options'].try(:[], 'libraries')) %>"></script>
18
18
  <script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/tags/infobox/1.1.5/src/infobox.js"></script>
19
19
  <script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclusterer/1.0/src/markerclusterer_compiled.js"></script>
20
+ <script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/richmarker/src/richmarker-compiled.js"></script>
20
21
  <% end %>
21
22
 
22
23
  <% if Rails::VERSION::MINOR < 1 %>
data/lib/gmaps4rails.rb CHANGED
@@ -6,7 +6,7 @@ if defined?(Rails) && Rails::VERSION::MAJOR == 3
6
6
  require 'gmaps4rails/extensions/array'
7
7
  require 'gmaps4rails/extensions/hash'
8
8
  require 'gmaps4rails/helper/gmaps4rails_helper'
9
-
9
+
10
10
  class Engine < Rails::Engine
11
11
  initializer "gmaps4rails view helpers" do |app|
12
12
  ActionView::Base.send :include, Gmaps4railsHelper
@@ -337,6 +337,7 @@ var Gmaps4Rails = {
337
337
  "shadow_width": this.exists(this.markers[i].shadow_width) ? this.markers[i].shadow_width : null,
338
338
  "shadow_height": this.exists(this.markers[i].shadow_height) ? this.markers[i].shadow_height : null,
339
339
  "marker_draggable": this.exists(this.markers[i].draggable) ? this.markers[i].draggable : this.markers_conf.draggable,
340
+ "rich_marker": this.exists(this.markers[i].rich_marker) ? this.markers[i].rich_marker : null,
340
341
  "Lat": Lat,
341
342
  "Lng": Lng,
342
343
  "index": i
@@ -98,9 +98,19 @@ Gmaps4Rails.createMarker = function(args){
98
98
  var markerLatLng = Gmaps4Rails.createLatLng(args.Lat, args.Lng);
99
99
 
100
100
  // Marker sizes are expressed as a Size of X,Y
101
- if (args.marker_picture === "" ) {
101
+ if (args.marker_picture === "" && args.rich_marker === null) {
102
102
  return new google.maps.Marker({position: markerLatLng, map: Gmaps4Rails.map, title: args.marker_title, draggable: args.marker_draggable});
103
- } else {
103
+ }
104
+ else if (args.rich_marker !== null){
105
+ return new RichMarker({position: markerLatLng,
106
+ map: Gmaps4Rails.map,
107
+ draggable: args.marker_draggable,
108
+ content: args.rich_marker,
109
+ flat: args.marker_anchor === null ? false : args.marker_anchor[1],
110
+ anchor: args.marker_anchor === null ? 0 : args.marker_anchor[0]
111
+ });
112
+ }
113
+ else {
104
114
  // calculate MarkerImage anchor location
105
115
  var imageAnchorPosition = this.createImageAnchorPosition(args.marker_anchor);
106
116
  var shadowAnchorPosition = this.createImageAnchorPosition(args.shadow_anchor);
@@ -108,7 +118,6 @@ Gmaps4Rails.createMarker = function(args){
108
118
  //create or retrieve existing MarkerImages
109
119
  var markerImage = this.createOrRetrieveImage(args.marker_picture, args.marker_width, args.marker_height, imageAnchorPosition);
110
120
  var shadowImage = this.createOrRetrieveImage(args.shadow_picture, args.shadow_width, args.shadow_height, shadowAnchorPosition);
111
-
112
121
  return new google.maps.Marker({position: markerLatLng, map: this.map, icon: markerImage, title: args.marker_title, draggable: args.marker_draggable, shadow: shadowImage});
113
122
  }
114
123
  };
@@ -1,4 +1,7 @@
1
1
  class UsersController < ApplicationController
2
+
3
+ respond_to :html, :json, :gmaps4rails
4
+
2
5
  def index
3
6
  @users = User.all
4
7
  @json = User.all.to_gmaps4rails do |user|
@@ -13,6 +16,11 @@ class UsersController < ApplicationController
13
16
  def new
14
17
  @user = User.new
15
18
  end
19
+
20
+ def renderer
21
+ @users = User.all
22
+ respond_with @users
23
+ end
16
24
 
17
25
  def create
18
26
  @user = User.new(params[:user])
@@ -1,23 +1,26 @@
1
1
  class User < ActiveRecord::Base
2
2
 
3
3
  acts_as_gmappable
4
-
4
+
5
5
  def gmaps4rails_address
6
6
  sec_address
7
7
  end
8
+
9
+
8
10
 
9
11
 
10
- # def gmaps4rails_marker_picture
11
- # {
12
- # "picture" => "http://www.blankdots.com/img/github-32x32.png",
13
- # "width" => "32",
14
- # "height" => "32",
15
- # "shadow_picture" => "https://secure.gravatar.com/avatar/808bec1c640143bd7091888d9edfb2f2.png",
16
- # "shadow_height" => 40,
17
- # "shadow_width" => 50,
18
- # "shadow_anchor" => [10, -30]
19
- # }
20
- # end
12
+ # def gmaps4rails_marker_picture
13
+ # {
14
+ # "width" => "32",
15
+ # "height" => "32",
16
+ # "marker_anchor" => [2, -30],
17
+ # "rich_marker" => "<div class='my-marker'>It works!<img height='30' width='30' src='http://farm4.static.flickr.com/3212/3012579547_097e27ced9_m.jpg'/></div>",
18
+ # "shadow_picture" => "https://secure.gravatar.com/avatar/808bec1c640143bd7091888d9edfb2f2.png",
19
+ # "shadow_height" => 40,
20
+ # "shadow_width" => 50,
21
+ # "shadow_anchor" => [10, -30]
22
+ # }
23
+ # end
21
24
 
22
25
  #
23
26
  # def gmaps4rails_title
@@ -1,7 +1,6 @@
1
1
  require File.expand_path('../boot', __FILE__)
2
2
 
3
3
  require 'rails/all'
4
-
5
4
  # If you have a Gemfile, require the gems listed there, including any gems
6
5
  # you've limited to :test, :development, or :production.
7
6
  Bundler.require(:default, Rails.env) if defined?(Bundler)
@@ -35,8 +34,8 @@ module Dummy
35
34
 
36
35
  # Configure the default encoding used in templates for Ruby 1.9.
37
36
  config.encoding = "utf-8"
38
-
39
37
  # Configure sensitive parameters which will be filtered from the log file.
40
38
  config.filter_parameters += [:password]
39
+
41
40
  end
42
41
  end
@@ -1,7 +1,7 @@
1
1
  Dummy::Application.routes.draw do
2
2
  match "users/test_list" => "users#test_list", :as => "test_list"
3
3
  match "users/ajax_map" => "users#ajax_map", :as => "ajax_map"
4
-
4
+ match "users/renderer" => "users#renderer", :as => "renderer"
5
5
  resources :users
6
6
  root :to => "users#index"
7
7
  end
@@ -19,5 +19,4 @@ describe "list creation", :js => true do
19
19
  page.should have_content("User2")
20
20
  end
21
21
 
22
- end
23
-
22
+ end
@@ -40,4 +40,4 @@ module Dummy31
40
40
  # Enable the asset pipeline
41
41
  config.assets.enabled = true
42
42
  end
43
- end
43
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gmaps4rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
5
- prerelease: false
4
+ hash: 49
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 11
9
- - 0
10
- version: 0.11.0
9
+ - 1
10
+ version: 0.11.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Benjamin Roth
@@ -16,8 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-08-12 00:00:00 +02:00
20
- default_executable:
19
+ date: 2011-08-25 00:00:00 Z
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency
23
22
  name: crack
@@ -119,7 +118,6 @@ files:
119
118
  - test/dummy31/db/migrate/20110809134019_create_users.rb
120
119
  - test/dummy31/db/schema.rb
121
120
  - test/dummy31/db/seeds.rb
122
- has_rdoc: true
123
121
  homepage: http://github.com/apneadiving/Google-Maps-for-Rails
124
122
  licenses: []
125
123
 
@@ -149,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
147
  requirements: []
150
148
 
151
149
  rubyforge_project:
152
- rubygems_version: 1.3.7
150
+ rubygems_version: 1.8.9
153
151
  signing_key:
154
152
  specification_version: 3
155
153
  summary: Enables easy display of items (taken from a Rails 3 model) on a Google Maps (JS API V3), OpenLayers, Mapquest and Bing. Geocoding + Directions included.