gmaps4rails 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,13 +3,15 @@ module Gmaps4rails
3
3
  unloadable
4
4
 
5
5
  def index
6
- @model = params["model"]
7
- @filter = params["filter"]
8
- @options = params["options"]
9
- if @model.constantize.is_gmappable? == true
10
- @objects = @model.constantize.gmaps4rails_filter(@filter, @options)
6
+ if request.xhr?
7
+ @model = params["model"]
8
+ @filter = params["filter"]
9
+ @options = params["options"]
10
+ if @model.constantize.is_gmappable? == true
11
+ @objects = @model.constantize.gmaps4rails_filter(@filter, @options)
12
+ end
11
13
  end
12
- end
14
+ end
13
15
 
14
16
  end
15
17
  end
@@ -1,39 +1,8 @@
1
1
  <% content_for :head do %>
2
- <style type="text/css">
3
-
4
- #map-container {
5
- padding: 6px;
6
- border-width: 1px;
7
- border-style: solid;
8
- border-color: #ccc #ccc #999 #ccc;
9
- -webkit-box-shadow: rgba(64, 64, 64, 0.5) 0 2px 5px;
10
- -moz-box-shadow: rgba(64, 64, 64, 0.5) 0 2px 5px;
11
- box-shadow: rgba(64, 64, 64, 0.1) 0 2px 5px;
12
- width: 800px;
13
- }
14
-
15
- #gmaps4rails_map {
16
- width: 800px;
17
- height: 400px;
18
- }
19
-
20
- #actions {
21
- list-style: none;
22
- padding: 0;
23
- }
24
-
25
- #inline-actions {
26
- padding-top: 10px;
27
- }
28
-
29
- .item {
30
- margin-left: 20px;
31
- }
32
- </style>
2
+ <%= stylesheet_link_tag 'gmaps4rails' %>
33
3
  <script src="http://www.google.com/jsapi"></script>
34
- <script type="text/javascript" src='http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclusterer/1.0/src/markerclusterer.js'>
35
- </script>
36
- <script type="text/javascript">
4
+ <script type="text/javascript" src='http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclusterer/1.0/src/markerclusterer.js'></script>
5
+ <script type="text/javascript" charset="utf-8">
37
6
  var styles = [{
38
7
  url: 'http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclusterer/1.0/images/people35.png',
39
8
  height: 35,
@@ -51,9 +20,9 @@ var gmaps4rails_model = '<%= model %>';
51
20
  var gmaps4rails_map_center_lat = <%= model.constantize.gmaps4rails_map_options["latitude"] %>;
52
21
  var gmaps4rails_map_center_long = <%= model.constantize.gmaps4rails_map_options["longitude"] %>;
53
22
  var gmaps4rails_map_zoom = <%= model.constantize.gmaps4rails_map_options["zoom"] %>;
54
- var gmaps4rails_base_url = '<%= url_for gmaps_path%>';
23
+ var gmaps4rails_base_url = '<%= url_for gmaps_path %>';
55
24
  </script>
56
- <script src="/javascripts/gmaps4rails.js" type="text/javascript"></script>
25
+ <%=javascript_include_tag 'gmaps4rails' %>
57
26
  <% end %>
58
27
  <div id="map-container">
59
28
  <div id="gmaps4rails_map"></div>
data/config/routes.rb CHANGED
@@ -5,8 +5,8 @@ Rails.application.routes.draw do
5
5
 
6
6
  #match mount_at => 'gmaps4rails/gmaps#index'
7
7
 
8
- resources :gmaps, :only => [ :index ],
9
- :controller => "gmaps4rails/gmaps"#,
8
+ resources :gmaps, :only => [ :index ], :controller => "gmaps4rails/gmaps"
9
+ #,
10
10
  # :path_prefix => mount_at
11
11
  #:name_prefix => "gmaps4rails_"
12
12
 
@@ -1,13 +1,15 @@
1
1
  module ApplicationHelper
2
+
2
3
  def gmaps4rails_filters_display(model)
3
4
  if model.constantize.respond_to?("gmaps4rails_filters")
4
5
  display = '<form name="gmaps4rails_form">'
5
- display += '<select name="gmaps4rails_list" onChange="gmaps4rails_resfreshmap()">'
6
- model.constantize.gmaps4rails_filters.each do |filter_hash|
7
- display += '<option value="' + filter_hash["filter"] + '+' + filter_hash["options"] +'">' + filter_hash["display"]
8
- end
9
- display += '</select></form>'
6
+ display += '<select name="gmaps4rails_list" onChange="gmaps4rails_resfreshmap()">'
7
+ model.constantize.gmaps4rails_filters.each do |filter_hash|
8
+ display += '<option value="' + filter_hash["filter"] + '+' + filter_hash["options"] +'">' + filter_hash["display"]
9
+ end
10
+ display += '</select></form>'
10
11
  end
11
12
  return display
12
13
  end
13
- end
14
+
15
+ end
data/lib/gmaps4rails.rb CHANGED
@@ -1,6 +1,30 @@
1
- module Gmaps4rails
2
- require 'engine' if defined?(Rails) && Rails::VERSION::MAJOR == 3
3
- require 'acts_as_gmappable/base'
1
+ if defined?(Rails) && Rails::VERSION::MAJOR == 3
2
+ module Gmaps4rails
3
+ # require 'rails/all'
4
+ require "rails"
5
+ require "action_controller"
6
+ # require 'action_controller'
7
+ require 'application_helper'
8
+ require 'acts_as_gmappable/base'
9
+
10
+ class Engine < Rails::Engine
11
+ # config.autoload_paths += %W(#{config.root}/lib)
12
+ #
13
+ # initializer "static assets" do |app|
14
+ # app.middleware.use ::ActionDispatch::Static, "#{root}/public%s"
15
+ # end
16
+ #
17
+ # def self.activate
18
+ # Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*.rb")) do |c|
19
+ # Rails.env.production? ? require(c) : load(c)
20
+ # end
21
+ # end
22
+ #
23
+ # config.to_prepare &method(:activate).to_proc
24
+ # initializer 'gmaps.helper' do |app|
25
+ # ActionView::Base.send :include, Gmaps4rails::GmapsHelper
26
+ # end
27
+ end
28
+ end
4
29
  end
5
30
 
6
-
@@ -0,0 +1,75 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/migration'
3
+
4
+ class Gmaps4railsGenerator < Rails::Generators::Base
5
+ include Rails::Generators::Migration
6
+
7
+ def self.source_root
8
+ File.join(File.dirname(__FILE__), 'templates')
9
+ end
10
+
11
+ def self.next_migration_number(dirname) #:nodoc:
12
+ if ActiveRecord::Base.timestamped_migrations
13
+ Time.now.utc.strftime("%Y%m%d%H%M%S")
14
+ else
15
+ "%.3d" % (current_migration_number(dirname) + 1)
16
+ end
17
+ end
18
+
19
+
20
+ # Every method that is declared below will be automatically executed when the generator is run
21
+
22
+ def create_migration_file
23
+ f = File.open File.join(File.dirname(__FILE__), 'templates', 'schema.rb')
24
+ schema = f.read; f.close
25
+
26
+ schema.gsub!(/ActiveRecord::Schema.*\n/, '')
27
+ schema.gsub!(/^end\n*$/, '')
28
+
29
+ f = File.open File.join(File.dirname(__FILE__), 'templates', 'migration.rb')
30
+ migration = f.read; f.close
31
+ migration.gsub!(/SCHEMA_AUTO_INSERTED_HERE/, schema)
32
+
33
+ tmp = File.open "tmp/~migration_ready.rb", "w"
34
+ tmp.write migration
35
+ tmp.close
36
+
37
+ migration_template '../../../tmp/~migration_ready.rb',
38
+ 'db/migrate/create_gmaps4rails_tables.rb'
39
+ remove_file 'tmp/~migration_ready.rb'
40
+ end
41
+
42
+ def copy_initializer_file
43
+ copy_file 'initializer.rb', 'config/initializers/gmaps4rails.rb'
44
+ end
45
+
46
+ def update_application_template
47
+ f = File.open "app/views/layouts/application.html.erb"
48
+ layout = f.read; f.close
49
+
50
+ if layout =~ /<%=[ ]+yield[ ]+%>/
51
+ print " \e[1m\e[34mquestion\e[0m Your layouts/application.html.erb layout currently has the line <%= yield %>. This gem needs to change this line to <%= content_for?(:content) ? yield(:content) : yield %> to support its nested layouts. This change should not affect any of your existing layouts or views. Is this okay? [y/n] "
52
+ begin
53
+ answer = gets.chomp
54
+ end while not answer =~ /[yn]/i
55
+
56
+ if answer =~ /y/i
57
+
58
+ layout.gsub!(/<%=[ ]+yield[ ]+%>/, '<%= content_for?(:content) ? yield(:content) : yield %>')
59
+
60
+ tmp = File.open "tmp/~application.html.erb", "w"
61
+ tmp.write layout; tmp.close
62
+
63
+ remove_file 'app/views/layouts/application.html.erb'
64
+ copy_file '../../../tmp/~application.html.erb',
65
+ 'app/views/layouts/application.html.erb'
66
+ remove_file 'tmp/~application.html.erb'
67
+ end
68
+ elsif layout =~ /<%=[ ]+content_for\?\(:content\) \? yield\(:content\) : yield[ ]+%>/
69
+ puts " \e[1m\e[33mskipping\e[0m layouts/application.html.erb modification is already done."
70
+ else
71
+ puts " \e[1m\e[31mconflict\e[0m The gem is confused by your layouts/application.html.erb. It does not contain the default line <%= yield %>, you may need to make manual changes to get this gem's nested layouts working. Visit ###### for details."
72
+ end
73
+ end
74
+
75
+ end
@@ -0,0 +1,8 @@
1
+ module Gmaps4rails
2
+ class Engine < Rails::Engine
3
+
4
+ config.mount_at = '/gmaps4rails'
5
+ config.widget_factory_name = 'Factory Name'
6
+
7
+ end
8
+ end
@@ -0,0 +1,9 @@
1
+ class CreateGmaps4railsTables < ActiveRecord::Migration
2
+ def self.up
3
+ SCHEMA_AUTO_INSERTED_HERE
4
+ end
5
+
6
+ def self.down
7
+ drop_table :gmaps4rails_widgets
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ ActiveRecord::Schema.define(:version => 0) do
2
+
3
+ create_table :gmaps4rails_widgets, :force => true do |t|
4
+ t.string :title
5
+ t.datetime :created_at
6
+ t.datetime :updated_at
7
+ end
8
+
9
+ add_index :gmaps4rails_widgets, [:title]
10
+
11
+ end
@@ -0,0 +1,8 @@
1
+ namespace :gmaps4rails do
2
+
3
+ desc "example gem rake task"
4
+ task :report => :environment do
5
+ puts "you just ran the example gem rake task"
6
+ end
7
+
8
+ end
@@ -0,0 +1,9 @@
1
+ namespace :gmaps4rails do
2
+ desc "Copies all migrations and assets (NOTE: This will be obsolete with Rails 3.1)"
3
+ task :install do
4
+ source = File.join(File.dirname(__FILE__), '..', '..', 'public')
5
+ destination = File.join(Rails.root, 'public')
6
+ puts "INFO: Mirroring assets from #{source} to #{destination}"
7
+ Spree::FileUtilz.mirror_files(source, destination)
8
+ end
9
+ end
@@ -0,0 +1,28 @@
1
+ #map-container {
2
+ padding: 6px;
3
+ border-width: 1px;
4
+ border-style: solid;
5
+ border-color: #ccc #ccc #999 #ccc;
6
+ -webkit-box-shadow: rgba(64, 64, 64, 0.5) 0 2px 5px;
7
+ -moz-box-shadow: rgba(64, 64, 64, 0.5) 0 2px 5px;
8
+ box-shadow: rgba(64, 64, 64, 0.1) 0 2px 5px;
9
+ width: 800px;
10
+ }
11
+
12
+ #gmaps4rails_map {
13
+ width: 800px;
14
+ height: 400px;
15
+ }
16
+
17
+ #actions {
18
+ list-style: none;
19
+ padding: 0;
20
+ }
21
+
22
+ #inline-actions {
23
+ padding-top: 10px;
24
+ }
25
+
26
+ .item {
27
+ margin-left: 20px;
28
+ }
@@ -0,0 +1,56 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+
3
+ require 'test/unit'
4
+ require 'rubygems'
5
+ require 'yaml'
6
+ require 'active_record'
7
+ require 'mysql'
8
+
9
+ require 'app/models/gmaps4rails/widget.rb'
10
+
11
+ def gmaps4rails_widget( fixture_name )
12
+ id = @@fixtures['gmaps4rails_widget'][ fixture_name.to_s ][ 'id' ]
13
+ gmaps4rails::Widget.find( id )
14
+ end
15
+
16
+ def load_schema
17
+ config = YAML::load( IO.read( File.dirname(__FILE__) + '/database.yml') )
18
+
19
+ # Manually initialize the database
20
+ conn = Mysql.real_connect( config['mysql']['host'], config['mysql']['username'], config['mysql']['password'] )
21
+ conn.query( "CREATE DATABASE IF NOT EXISTS #{config['mysql']['database']}" )
22
+
23
+ ActiveRecord::Base.establish_connection( config['mysql'] )
24
+ ActiveRecord::Base.connection()
25
+
26
+ load(File.dirname(__FILE__) + "/../" +
27
+ "lib/rails/generators/gmaps4rails/templates/schema.rb")
28
+
29
+ @@fixtures = {}
30
+
31
+ load_fixture( 'gmaps4rails_widget' )
32
+ end
33
+
34
+ def load_fixture( table )
35
+ @@fixtures[ table ] = {}
36
+ fixture = YAML::load( IO.read( File.dirname(__FILE__) + "/fixtures/#{table}.yml") )
37
+ @@fixtures[ table ] = fixture
38
+
39
+ klass = class_eval table.titleize.gsub(/ /, '::')
40
+
41
+ fixture.each do |record_name, record|
42
+ record.each do |column, value|
43
+ if ( match = column.match(/(.*)_id/) )
44
+ fixture_reference = "gmaps4rails_" + match[1].pluralize
45
+ if value.is_a? Symbol
46
+ r = class_eval "#{fixture_reference}( '#{value}' )"
47
+ record[ column ] = r.id
48
+ end
49
+ end
50
+ end
51
+
52
+ r = klass.create( record )
53
+ @@fixtures[ table ][ record_name ][ 'id' ] = r.id
54
+ end
55
+
56
+ end
@@ -0,0 +1,11 @@
1
+ require 'test_helper'
2
+
3
+ class WidgetTest < Test::Unit::TestCase
4
+ load_schema
5
+
6
+ def test_fixtures_are_working
7
+ assert_equal gmaps4rails_widget(:first).title, "This is the title"
8
+ end
9
+
10
+
11
+ 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: 5
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 13
10
- version: 0.0.13
9
+ - 14
10
+ version: 0.0.14
11
11
  platform: ruby
12
12
  authors:
13
13
  - Benjamin Roth
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-21 00:00:00 +01:00
18
+ date: 2010-11-24 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -42,20 +42,25 @@ extra_rdoc_files:
42
42
  - README.rdoc
43
43
  files:
44
44
  - app/controllers/gmaps4rails/gmaps_controller.rb
45
- - app/helpers/application_helper.rb
46
- - app/helpers/gmaps4rails/Gmaps_helper.rb
45
+ - app/helpers/gmaps4rails/gmaps_helper.rb
47
46
  - app/views/gmaps4rails/_gmaps4rails.html.erb
48
- - app/views/gmaps4rails/_map.html.erb
49
- - app/views/gmaps4rails/gmaps/index.json.erb
50
- - app/views/gmaps4rails/gmaps/index.xml.builder
47
+ - app/views/gmaps4rails/gmaps/index.js.erb
51
48
  - config/routes.rb
52
49
  - lib/acts_as_gmappable/base.rb
53
50
  - lib/application_helper.rb
54
- - lib/engine.rb
55
51
  - lib/gmaps4rails.rb
52
+ - lib/rails/generators/gmaps4rails/gmaps4rails_generator.rb
53
+ - lib/rails/generators/gmaps4rails/templates/initializer.rb
54
+ - lib/rails/generators/gmaps4rails/templates/migration.rb
55
+ - lib/rails/generators/gmaps4rails/templates/schema.rb
56
+ - lib/rails/railties/tasks.rake
57
+ - lib/tasks/install.rake
56
58
  - public/images/marker.png
57
59
  - public/javascripts/gmaps4rails.js
60
+ - public/stylesheets/gmaps4rails.css
58
61
  - README.rdoc
62
+ - test/test_helper.rb
63
+ - test/unit/gmaps4rails_widget_test.rb
59
64
  has_rdoc: true
60
65
  homepage: http://github.com/apneadiving/Gmaps4rails
61
66
  licenses: []
@@ -90,5 +95,6 @@ rubygems_version: 1.3.7
90
95
  signing_key:
91
96
  specification_version: 3
92
97
  summary: IN HEAVY DEV. Will enable easy display of items (taken from a model) on a Google Map. Uses Javascript API V3.
93
- test_files: []
94
-
98
+ test_files:
99
+ - test/test_helper.rb
100
+ - test/unit/gmaps4rails_widget_test.rb
@@ -1,2 +0,0 @@
1
- ## Look in lib/application_helper.rb
2
- ## I can't figure out how to get it included unless I put it that directory
@@ -1,63 +0,0 @@
1
- <% content_for(:head) do %>
2
- <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
3
- <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"> </script>
4
- <script type="text/javascript" src="/javascripts/gmaps4rails.js"> </script>
5
- <script type="text/javascript">
6
- var gmaps4rails_map;
7
- var gmaps4rails_Options;
8
- var gmaps4rails_ctaLayer;
9
- var gmaps4rails_model;
10
-
11
- jQuery(document).ready(function() {
12
- gmaps4rails_init("User");
13
- });
14
-
15
-
16
- function gmaps4rails_init(model) {
17
- gmaps4rails_model = model;
18
- var myLatLng = new google.maps.LatLng(0,0);
19
- gmaps4rails_Options = {
20
- zoom: 0,
21
- center: myLatLng,
22
- mapTypeId: google.maps.MapTypeId.ROADMAP
23
- }
24
- gmaps4rails_map = new google.maps.Map(document.getElementById("gmaps4rails_canvas"), gmaps4rails_Options);
25
- create_map();
26
- }
27
-
28
- function create_map(filter_value) {
29
- var date = new Date();
30
- //adding the date (which is a unique parameter, enables to bypass google map's cache on google server)
31
- var request = 'http://furious-robot-66.heroku.com/gmaps.xml?model=' + gmaps4rails_model + '&time=' + date.getTime();
32
- if (!(filter_value == null))
33
- {
34
- split_filter_value = filter_value.split('+');
35
- if (!(split_filter_value[0] == null))
36
- {
37
- request += '&filter=' + split_filter_value[0];
38
- }
39
- if (!(split_filter_value[1] == null))
40
- {
41
- request += '&options=' + split_filter_value[1];
42
- }
43
- }
44
- gmaps4rails_ctaLayer = new google.maps.KmlLayer(request);
45
- gmaps4rails_ctaLayer.setMap(gmaps4rails_map);
46
- }
47
-
48
- function gmaps4rails_raz(){
49
- gmaps4rails_map = new google.maps.Map(document.getElementById("gmaps4rails_canvas"), gmaps4rails_myOptions);
50
- }
51
-
52
- function gmaps4rails_resfreshmap()
53
- {
54
- gmaps4rails_raz();
55
- var index = document.gmaps4rails_form.gmaps4rails_list.selectedIndex;
56
- var filter_value = document.gmaps4rails_form.gmaps4rails_list.options[index].value;
57
- create_map(filter_value);
58
- }
59
- </script>
60
- <% end %>
61
-
62
- <div id="gmaps4rails_canvas" style="width:100%; height:100%"></div>
63
-
@@ -1,99 +0,0 @@
1
- xml.instruct! :xml, :version=>"1.0"
2
- xml.kml do
3
- xml.Document do
4
- #if @objects.first.respond_to?('gmaps4rails_marker')
5
- xml.Style('id' => 'normalPlacemark') do
6
- xml.IconStyle do
7
- xml.Icon "<href>" + @objects.first.gmaps4rails_marker + "</href>"
8
- end
9
- end
10
-
11
- xml.Style('id' => 'highlightPlacemark') do
12
- xml.IconStyle do
13
- xml.Icon "<href>" + @objects.first.gmaps4rails_marker_hover + "</href>"
14
- end
15
- end
16
-
17
- xml.Style('id' => 'customMap') do
18
- xml.Pair do
19
- xml.key 'normal'
20
- xml.StyleUrl '#normalPlacemark'
21
- end
22
- xml.Pair do
23
- xml.key 'highlight'
24
- xml.StyleUrl '#highlightPlacemark'
25
- end
26
- end
27
-
28
-
29
- # <Document>
30
- # <name>Highlighted Icon</name>
31
- # <description>Place your mouse over the icon to see it display the new icon</description>
32
- # <Style id="highlightPlacemark">
33
- # <IconStyle>
34
- # <Icon>
35
- # <href>http://maps.google.com/mapfiles/kml/paddle/red-stars.png</href>
36
- # </Icon>
37
- # </IconStyle>
38
- # </Style>
39
- # <Style id="normalPlacemark">
40
- # <IconStyle>
41
- # <Icon>
42
- # <href>http://maps.google.com/mapfiles/kml/paddle/wht-blank.png</href>
43
- # </Icon>
44
- # </IconStyle>
45
- # </Style>
46
- # <StyleMap id="exampleStyleMap">
47
- # <Pair>
48
- # <key>normal</key>
49
- # <styleUrl>#normalPlacemark</styleUrl>
50
- # </Pair>
51
- # <Pair>
52
- # <key>highlight</key>
53
- # <styleUrl>#highlightPlacemark</styleUrl>
54
- # </Pair>
55
- # </StyleMap>
56
- # <Placemark>
57
- # <name>Roll over this icon</name>
58
- # <styleUrl>#exampleStyleMap</styleUrl>
59
- # <Point>
60
- # <coordinates>-122.0856545755255,37.42243077405461,0</coordinates>
61
- # </Point>
62
- # </Placemark>
63
- # </Document>
64
-
65
- if @objects.first.respond_to?('gmaps4rails_info')
66
- @objects.each do |object|
67
-
68
- xml.Placemark do
69
- desc = object.gmaps4rails_info
70
- lat = object.gmaps4rails_latitude.nil? ? "" : object.gmaps4rails_latitude
71
- long = object.gmaps4rails_longitude.nil? ? "" : object.gmaps4rails_longitude
72
- xml.styleUrl "#customMap"
73
- xml.description '<![CDATA[' + desc + ']]>'
74
- xml.Point do
75
- str = long + "," + lat + ",0"
76
- xml.coordinates(str)
77
- end
78
- end #placemark
79
- end
80
- else
81
- @objects.each do |object|
82
- xml.Placemark do
83
- desc = object.gmaps4rails_picture.nil? ? "" : '<img width="40" heigth="40" src="' + object.gmaps4rails_picture + '">'
84
- xml.styleUrl "#customMap"
85
- desc += object.gmaps4rails_description.nil? ? "" : object.gmaps4rails_description
86
- lat = object.gmaps4rails_latitude.nil? ? "" : object.gmaps4rails_latitude
87
- long = object.gmaps4rails_longitude.nil? ? "" : object.gmaps4rails_longitude
88
-
89
- xml.description '<![CDATA[' + desc +']]>'
90
- xml.Point do
91
- str = long + "," + lat + ",0"
92
- xml.coordinates(str)
93
- end
94
- end #placemark
95
- end
96
- end
97
-
98
- end #Document
99
- end #kml
data/lib/engine.rb DELETED
@@ -1,43 +0,0 @@
1
- require 'rails'
2
- require 'action_controller'
3
- require 'application_helper'
4
- require 'acts_as_gmappable/base'
5
- #require 'gmaps4rails'
6
-
7
- # module Gmaps4rails
8
- # class Engine < Rails::Engine
9
- # # Config defaults
10
- # config.widget_factory_name = "gmaps4rails"
11
- # config.mount_at = '/'
12
- #
13
- # # Check the gem config
14
- # initializer "check config" do |app|
15
- # # make sure mount_at ends with trailing slash
16
- # config.mount_at += '/' unless config.mount_at.last == '/'
17
- # end
18
- #
19
- # initializer "static assets" do |app|
20
- # app.middleware.use ::ActionDispatch::Static, "#{root}/public"
21
- # end
22
- #
23
- # end
24
- # end
25
-
26
- module Gmaps4rails
27
- class Engine < Rails::Engine
28
-
29
- config.autoload_paths += %W(#{config.root}/lib)
30
-
31
- initializer "static assets" do |app|
32
- app.middleware.use ::ActionDispatch::Static, "#{root}/public"
33
- end
34
-
35
- def self.activate
36
- Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*.rb")) do |c|
37
- Rails.env.production? ? require(c) : load(c)
38
- end
39
- end
40
-
41
- config.to_prepare &method(:activate).to_proc
42
- end
43
- end