ropenlayer 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ropenlayer (0.3.4)
4
+ ropenlayer (0.3.5)
5
5
  activerecord (>= 3.0.3)
6
6
  json_pure (~> 1.5.1)
7
7
  rails (>= 3.0.3)
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.3.5 2011-05-12
2
+ * Improves
3
+ * Updated map_localizations view method to perfom callbacks on map movements.
4
+ * Added eventListeners options to Ropenlayer::Openlayer::Map
5
+
1
6
  === 0.3.4 2011-05-09
2
7
  * Improves
3
8
  * Added some test with rspec
@@ -5,14 +5,15 @@ module Ropenlayer
5
5
  self.object.ensure_mapper_model
6
6
  self.object.ensure_localizable_model
7
7
 
8
- klass_config = self.object.class.ropenlayer_mapper_config
9
- dom_id_map = "ropenlayer_#{ @template.params[:action] }_#{ @template.params[:controller] }"
8
+ return_tag = ''
9
+
10
10
 
11
+ dom_id_map = "ropenlayer_#{ @template.params[:action] }_#{ @template.params[:controller] }"
12
+ klass_config = self.object.class.ropenlayer_mapper_config.merge({:map_js_options => { :eventListeners => "{ 'moveend': #{ dom_id_map }EventHandler, 'zoomend': #{ dom_id_map }EventHandler }"}})
11
13
  map = self.object.build_ropenlayer_map(dom_id_map, klass_config)
12
14
 
13
15
  map_div_options.merge!(:id => dom_id_map)
14
16
 
15
- return_tag = ''
16
17
 
17
18
  [ :longitude , :latitude, :zoom ].each do |data|
18
19
  id_hidden_value = "#{ self.object.class.name.underscore }_#{ klass_config[data] }"
@@ -20,9 +21,8 @@ module Ropenlayer
20
21
  return_tag << hidden_field(klass_config[data], :id => id_hidden_value)
21
22
  end
22
23
 
23
-
24
- return_tag << "#{ @template.content_tag("div", '', map_div_options) } #{ @template.javascript_tag map.to_js }"
25
24
  return_tag << localization_helper(map)
25
+ return_tag << "#{ @template.content_tag("div", '', map_div_options) } #{ @template.javascript_tag map.to_js }"
26
26
  @template.raw return_tag
27
27
  end
28
28
 
@@ -61,7 +61,18 @@ module Ropenlayer
61
61
 
62
62
  private
63
63
  def localization_helper(ropenlayer_object)
64
- @template.link_to_function 'Store localization', "a = #{ ropenlayer_object.js_id }.getCenter(); long_dom = getElementById('#{ ropenlayer_object.form_localizations_fields[:longitude] }'); long_dom.value = a['lon']; lat_dom = getElementById('#{ ropenlayer_object.form_localizations_fields[:latitude] }'); lat_dom.value = a['lat']; b = #{ ropenlayer_object.js_id }.getZoom(); zoom_dom = getElementById('#{ ropenlayer_object.form_localizations_fields[:zoom] }'); zoom_dom.value = b; #{ ropenlayer_object.js_notification_area }.innerHTML = 'kk'"
64
+ @template.javascript_tag "function #{ ropenlayer_object.div_id }EventHandler(event) {
65
+ a = #{ ropenlayer_object.js_id }.getCenter();
66
+ b = #{ ropenlayer_object.js_id }.getZoom();
67
+
68
+ long_dom = document.getElementById('#{ ropenlayer_object.form_localizations_fields[:longitude] }');
69
+ lat_dom = document.getElementById('#{ ropenlayer_object.form_localizations_fields[:latitude] }');
70
+ zoom_dom = document.getElementById('#{ ropenlayer_object.form_localizations_fields[:zoom] }');
71
+
72
+ long_dom.value = a['lon'];
73
+ lat_dom.value = a['lat'];
74
+ zoom_dom.value = b;
75
+ }"
65
76
  end
66
77
 
67
78
 
@@ -120,14 +120,16 @@ module Ropenlayer
120
120
  map_js_options ||= {}
121
121
  propierties = {}
122
122
 
123
- propierties[:div] = "'#{ div_id }'"
124
- propierties[:controls] = "[]"
123
+ propierties[:div] = "'#{ div_id }'"
124
+ propierties[:controls] = "[]"
125
125
 
126
- propierties[:theme] = map_js_options[:theme] || "'/stylesheets/ropenlayer.css'"
127
- propierties[:projection] = map_js_options[:projection] || "#{ Ropenlayer::Openlayer::Js.new_method("OpenLayers.Projection", :args => ["'EPSG:900913'"]) }"
128
- propierties[:units] = map_js_options[:units] || "'m'"
129
- propierties[:maxResolution] = map_js_options[:units] || "156543.0339"
130
- propierties[:maxExtent] = map_js_options[:maxExtent] || "#{ Ropenlayer::Openlayer::Js.new_method("OpenLayers.Bounds", :args => ["-20037508", "-20037508", "20037508", "20037508.34"]) }"
126
+ propierties[:theme] = map_js_options[:theme] || "'/stylesheets/ropenlayer.css'"
127
+ propierties[:projection] = map_js_options[:projection] || "#{ Ropenlayer::Openlayer::Js.new_method("OpenLayers.Projection", :args => ["'EPSG:900913'"]) }"
128
+ propierties[:units] = map_js_options[:units] || "'m'"
129
+ propierties[:eventListeners] = map_js_options[:eventListeners] if map_js_options[:eventListeners]
130
+
131
+ propierties[:maxResolution] = map_js_options[:units] || "156543.0339"
132
+ propierties[:maxExtent] = map_js_options[:maxExtent] || "#{ Ropenlayer::Openlayer::Js.new_method("OpenLayers.Bounds", :args => ["-20037508", "-20037508", "20037508", "20037508.34"]) }"
131
133
  propierties
132
134
  end
133
135
 
@@ -1,3 +1,3 @@
1
1
  module Ropenlayer
2
- VERSION = "0.3.4" unless defined? Ropenlayer::VERSION
2
+ VERSION = "0.3.5" unless defined? Ropenlayer::VERSION
3
3
  end
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: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 4
10
- version: 0.3.4
9
+ - 5
10
+ version: 0.3.5
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-05-09 00:00:00 +02:00
18
+ date: 2011-05-12 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency