ropenlayer 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock ADDED
@@ -0,0 +1,99 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ropenlayer (0.3.1)
5
+ json_pure (~> 1.2.3)
6
+ rails (~> 3.0.3)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ abstract (1.0.0)
12
+ actionmailer (3.0.3)
13
+ actionpack (= 3.0.3)
14
+ mail (~> 2.2.9)
15
+ actionpack (3.0.3)
16
+ activemodel (= 3.0.3)
17
+ activesupport (= 3.0.3)
18
+ builder (~> 2.1.2)
19
+ erubis (~> 2.6.6)
20
+ i18n (~> 0.4)
21
+ rack (~> 1.2.1)
22
+ rack-mount (~> 0.6.13)
23
+ rack-test (~> 0.5.6)
24
+ tzinfo (~> 0.3.23)
25
+ activemodel (3.0.3)
26
+ activesupport (= 3.0.3)
27
+ builder (~> 2.1.2)
28
+ i18n (~> 0.4)
29
+ activerecord (3.0.3)
30
+ activemodel (= 3.0.3)
31
+ activesupport (= 3.0.3)
32
+ arel (~> 2.0.2)
33
+ tzinfo (~> 0.3.23)
34
+ activeresource (3.0.3)
35
+ activemodel (= 3.0.3)
36
+ activesupport (= 3.0.3)
37
+ activesupport (3.0.3)
38
+ arel (2.0.6)
39
+ builder (2.1.2)
40
+ columnize (0.3.1)
41
+ diff-lcs (1.1.2)
42
+ erubis (2.6.6)
43
+ abstract (>= 1.0.0)
44
+ i18n (0.5.0)
45
+ json_pure (1.2.3)
46
+ linecache (0.43)
47
+ mail (2.2.15)
48
+ activesupport (>= 2.3.6)
49
+ i18n (>= 0.4.0)
50
+ mime-types (~> 1.16)
51
+ treetop (~> 1.4.8)
52
+ mime-types (1.16)
53
+ polyglot (0.3.1)
54
+ rack (1.2.1)
55
+ rack-mount (0.6.13)
56
+ rack (>= 1.0.0)
57
+ rack-test (0.5.7)
58
+ rack (>= 1.0)
59
+ rails (3.0.3)
60
+ actionmailer (= 3.0.3)
61
+ actionpack (= 3.0.3)
62
+ activerecord (= 3.0.3)
63
+ activeresource (= 3.0.3)
64
+ activesupport (= 3.0.3)
65
+ bundler (~> 1.0)
66
+ railties (= 3.0.3)
67
+ railties (3.0.3)
68
+ actionpack (= 3.0.3)
69
+ activesupport (= 3.0.3)
70
+ rake (>= 0.8.7)
71
+ thor (~> 0.14.4)
72
+ rake (0.8.7)
73
+ rspec (2.3.0)
74
+ rspec-core (~> 2.3.0)
75
+ rspec-expectations (~> 2.3.0)
76
+ rspec-mocks (~> 2.3.0)
77
+ rspec-core (2.3.1)
78
+ rspec-expectations (2.3.0)
79
+ diff-lcs (~> 1.1.2)
80
+ rspec-mocks (2.3.0)
81
+ ruby-debug (0.10.3)
82
+ columnize (>= 0.1)
83
+ ruby-debug-base (~> 0.10.3.0)
84
+ ruby-debug-base (0.10.3)
85
+ linecache (>= 0.3)
86
+ thor (0.14.6)
87
+ treetop (1.4.9)
88
+ polyglot (>= 0.3.1)
89
+ tzinfo (0.3.23)
90
+
91
+ PLATFORMS
92
+ ruby
93
+
94
+ DEPENDENCIES
95
+ json_pure (~> 1.2.3)
96
+ rails (~> 3.0.3)
97
+ ropenlayer!
98
+ rspec (~> 2.3.0)
99
+ ruby-debug (~> 0.10.3)
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ === 0.3.1
2
+ * Bug fixes
3
+ * Ropenlayer::JsHelper::Prototype doesnt escape onclick propierties propierly :)
4
+ * enhancement
5
+ * default_layer can be used now in instance space (though Proc, symbol method, or watever). Instance maps can have now independent base layer
6
+
1
7
  === 0.3.0 2011-02-27
2
8
 
3
9
  * Major release.
@@ -123,10 +123,10 @@ module Ropenlayer
123
123
  # Set default localization if avalaible
124
124
  # Longitude and latitude are parsed by default as float if Proc or Symbol are not defined. Zoom, by default, as integer
125
125
  def set_map_localization(config)
126
- defult_localization_values = { :longitude => :to_f, :latitude => :to_f, :zoom => :to_i }
126
+ defult_localization_values = { :longitude => :to_f, :latitude => :to_f, :zoom => :to_i, :default_layer => :to_sym }
127
127
 
128
- defult_localization_values.each do |axis, default_method|
129
- eval_value = config.delete(axis)
128
+ defult_localization_values.each do |name, default_method|
129
+ eval_value = config.delete(name)
130
130
  value = 0
131
131
  case eval_value
132
132
  when Symbol
@@ -136,7 +136,7 @@ module Ropenlayer
136
136
  else
137
137
  value = eval_value.send(default_method)
138
138
  end
139
- config[axis] = value unless value.to_i.zero?
139
+ config[name] = value unless value.to_i.zero?
140
140
  end
141
141
  config
142
142
  end
@@ -5,8 +5,12 @@ module Ropenlayer
5
5
  def self.create_xhtml_element(element_type, attributes = {})
6
6
  inner_html = attributes.delete(:inner_html)
7
7
 
8
+ attributes.each do |name, value|
9
+ attributes[name] = %( "#{ value }" ) if name.to_s.match(/^on/)
10
+ end
11
+
8
12
  return_js = Ropenlayer::Openlayer::Js.new_method("Element", :args => [ "'#{ element_type }'" ], :propierties => attributes)
9
- return_js.body << ".update(#{ inner_html })" if inner_html
13
+ return_js.body << ".update('#{ inner_html.gsub("'",'') }')" if inner_html
10
14
  return_js.to_s
11
15
  end
12
16
 
@@ -5,15 +5,12 @@ module Ropenlayer
5
5
 
6
6
  set_table_name :ropenlayer_nodes
7
7
 
8
- GEOMETRY_TYPES = %w( POINT LINESTRING POLYGON )
8
+ GEOMETRY_TYPES = %w( POINT LINESTRING POLYGON ) unless defined?(GEOMETRY_TYPES)
9
9
 
10
10
  belongs_to :map, :polymorphic => true
11
11
 
12
12
  has_many :localizations, :class_name => 'Ropenlayer::Localization'
13
13
 
14
- has_one :icon, :class_name => 'Ropenlayer::Icon'
15
- has_one :category, :class_name => 'Ropenlayer::Category'
16
-
17
14
 
18
15
  def geometry_string
19
16
  "#{ geometry }(#{ localizations.map{|l| "#{ l.longitude } #{ l.latitude }"}.join(',')})"
@@ -87,6 +87,7 @@ module Ropenlayer
87
87
  @js_propierties = map_js_propierties(options[:map_js_options])
88
88
 
89
89
  @layer_names = @options[:layers] || self.class.default_layers
90
+
90
91
  if options[:default_layer]
91
92
  def_layer = @layer_names.delete(options[:default_layer])
92
93
  @layer_names = @layer_names.push(def_layer).reverse if def_layer
data/lib/ropenlayer.rb CHANGED
@@ -2,12 +2,15 @@ $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) ||
2
2
 
3
3
  # Rubygems and Rails Stuff
4
4
  require 'rubygems'
5
+
6
+ # Require them
5
7
  require 'rails'
6
8
  require 'active_record'
7
9
 
10
+
8
11
  module Ropenlayer
9
12
 
10
- VERSION = '0.3.0'
13
+ VERSION = '0.3.1'
11
14
 
12
15
  autoload :Node, 'ropenlayer/node'
13
16
  autoload :Localization, 'ropenlayer/localization'
@@ -43,14 +46,19 @@ module Ropenlayer
43
46
  end
44
47
  end
45
48
 
46
-
49
+ # js_helper provides access to js framework constructor. Define your own at Rails.root + "config/initializers/ropenlayer.rb"
50
+ # By default Jquery is used
47
51
  mattr_accessor :js_helper
48
52
  @@js_helper = Ropenlayer::JsHelper::Jquery
49
53
 
54
+ # Configure ropenlayer module variables though config/initializers/ropenlayer.rb
50
55
  def self.setup
51
56
  yield self
52
57
  end
53
58
 
59
+ # Extend ActiveRecord with ActsAs behavior.
60
+ # Extend also FormBuilder
61
+ # FIXME support Formstatic
54
62
  class Railtie < Rails::Railtie
55
63
  initializer 'ropenlayer.initialize' do
56
64
  ActiveRecord::Base.extend Ropenlayer::ActsAs
data/ropenlayer.gemspec CHANGED
@@ -4,7 +4,7 @@ Gem::Specification.new do |s|
4
4
 
5
5
  # define gem
6
6
  s.name = "ropenlayer"
7
- s.version = Ropenlayer::VERSION
7
+ s.version = '0.3.1'
8
8
  s.summary = "Ropenlayer is a wrapper constructor for openlayer javascript library written in ruby. It aims to provide an easy way to build maps and display it on webs."
9
9
  s.description = "Ropenlayer is a wrapper constructor for openlayer javascript library written in ruby. It aims to provide an easy way to build maps and display it on webs."
10
10
  s.authors = ['Gnoxys' ]
@@ -15,6 +15,7 @@ Gem::Specification.new do |s|
15
15
  # dependencies
16
16
  s.add_runtime_dependency('json_pure', '~> 1.2.3')
17
17
  s.add_runtime_dependency('rails', '~> 3.0.3')
18
+ s.add_runtime_dependency('activerecord', '~> 3.0.3')
18
19
  s.add_development_dependency('rspec', '~> 2.3.0')
19
20
  if RUBY_VERSION < '1.9'
20
21
  s.add_development_dependency('ruby-debug', '~> 0.10.3')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ropenlayer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 0
10
- version: 0.3.0
9
+ - 1
10
+ version: 0.3.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gnoxys
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-07 00:00:00 +01:00
18
+ date: 2011-03-08 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -51,9 +51,25 @@ dependencies:
51
51
  type: :runtime
52
52
  version_requirements: *id002
53
53
  - !ruby/object:Gem::Dependency
54
- name: rspec
54
+ name: activerecord
55
55
  prerelease: false
56
56
  requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ hash: 1
62
+ segments:
63
+ - 3
64
+ - 0
65
+ - 3
66
+ version: 3.0.3
67
+ type: :runtime
68
+ version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
57
73
  none: false
58
74
  requirements:
59
75
  - - ~>
@@ -65,11 +81,11 @@ dependencies:
65
81
  - 0
66
82
  version: 2.3.0
67
83
  type: :development
68
- version_requirements: *id003
84
+ version_requirements: *id004
69
85
  - !ruby/object:Gem::Dependency
70
86
  name: ruby-debug
71
87
  prerelease: false
72
- requirement: &id004 !ruby/object:Gem::Requirement
88
+ requirement: &id005 !ruby/object:Gem::Requirement
73
89
  none: false
74
90
  requirements:
75
91
  - - ~>
@@ -81,7 +97,7 @@ dependencies:
81
97
  - 3
82
98
  version: 0.10.3
83
99
  type: :development
84
- version_requirements: *id004
100
+ version_requirements: *id005
85
101
  description: Ropenlayer is a wrapper constructor for openlayer javascript library written in ruby. It aims to provide an easy way to build maps and display it on webs.
86
102
  email:
87
103
  - development@gnoxys.net
@@ -94,6 +110,7 @@ extra_rdoc_files: []
94
110
  files:
95
111
  - .gitignore
96
112
  - Gemfile
113
+ - Gemfile.lock
97
114
  - History.txt
98
115
  - Manifest.txt
99
116
  - PostInstall.txt
@@ -153,9 +170,7 @@ files:
153
170
  - lib/ropenlayer/acts_as.rb
154
171
  - lib/ropenlayer/acts_as/mapper.rb
155
172
  - lib/ropenlayer/acts_as/nodeable.rb
156
- - lib/ropenlayer/category.rb
157
173
  - lib/ropenlayer/form_builder.rb
158
- - lib/ropenlayer/icon.rb
159
174
  - lib/ropenlayer/js_helper/jquery.rb
160
175
  - lib/ropenlayer/js_helper/prototype.rb
161
176
  - lib/ropenlayer/localization.rb
@@ -1,14 +0,0 @@
1
- module Ropenlayer
2
- class Category < ActiveRecord::Base
3
-
4
- set_table_name :ropenlayer_categories
5
-
6
- belongs_to :mapper, :polymorphic => true
7
-
8
- #before_save :ensure_format, Proc.new {|category| category.color.match(/^\#/) ? '' : category.color = "##{ category.color }"
9
-
10
- end
11
-
12
-
13
-
14
- end
@@ -1,12 +0,0 @@
1
- module Ropenlayer
2
- class Icon < ActiveRecord::Base
3
-
4
- set_table_name :ropenlayer_icons
5
-
6
- belongs_to :mapper, :polymorphic => true
7
-
8
- #has_attached_file :logo, :styles => { :'48' => "48x48", :'64' => "64x64", :'128' => "128x128", :'256' => "256x256" }
9
-
10
- end
11
-
12
- end