inline_forms 1.2.7 → 1.2.8
Sign up to get free protection for your applications and to get access to all the features.
data/bin/inline_forms
CHANGED
@@ -2,11 +2,11 @@ InlineForms::SPECIAL_COLUMN_TYPES[:geo_code_curacao]=:string
|
|
2
2
|
|
3
3
|
# geo_code_curacao
|
4
4
|
def geo_code_curacao_show(object, attribute)
|
5
|
-
attribute_value = object.send(attribute).
|
5
|
+
attribute_value = object.send(attribute).presentation rescue nil
|
6
6
|
link_to_inline_edit object, attribute, attribute_value
|
7
7
|
end
|
8
8
|
def geo_code_curacao_edit(object, attribute)
|
9
|
-
|
9
|
+
autocomplete_field_tag :geo_code_curacao, 'straatje', autocomplete_geo_code_curacao_street_clients_path
|
10
10
|
end
|
11
11
|
def geo_code_curacao_update(object, attribute)
|
12
12
|
# extract the geocode
|
@@ -5,14 +5,17 @@ class GeoCodeCuracao
|
|
5
5
|
set_table_name "Zones"
|
6
6
|
alias_attribute :name, :NAME
|
7
7
|
end
|
8
|
+
|
8
9
|
class Neighbourhood < ActiveRecord::Base
|
9
10
|
set_table_name "Buurten"
|
10
11
|
alias_attribute :name, :NAME
|
11
12
|
end
|
13
|
+
|
12
14
|
class Street < ActiveRecord::Base
|
13
15
|
set_table_name "Straatcode"
|
14
16
|
alias_attribute :name, :NAME
|
15
17
|
end
|
18
|
+
|
16
19
|
def initialize(geo_code_curacao)
|
17
20
|
return nil if geo_code_curacao.nil?
|
18
21
|
decoded = geo_code_curacao.to_s.scan(/\d\d/)
|
@@ -24,17 +27,21 @@ class GeoCodeCuracao
|
|
24
27
|
self.neighbourhood = Neighbourhood.find_by_ZONECODE_and_NBRHCODE(zone_code,neighbourhood_code) if self.street
|
25
28
|
self.zone = Zone.find_by_ZONECODE(zone_code) if self.street
|
26
29
|
end
|
30
|
+
|
27
31
|
def valid?
|
28
32
|
not self.street.nil?
|
29
33
|
end
|
34
|
+
|
30
35
|
def presentation
|
31
36
|
"#{street.name}, #{zone.name}"
|
32
37
|
end
|
38
|
+
|
33
39
|
def self.find(*args)
|
34
40
|
find_options = args.extract_options!
|
35
41
|
if args.first.to_s == "all"
|
36
42
|
# ActiveRecord::Base.sanitize_sql_for_conditions can not be called from here. Why?
|
37
|
-
|
43
|
+
# http://www.ruby-forum.com/topic/80357, active_record/connection_adapter/Quoting.rb
|
44
|
+
street = find_options[:conditions][1].gsub(/\\/, '\&\&').gsub(/'/, "''")
|
38
45
|
sql = "select CONCAT( CONCAT_WS( ', ', S.NAME, B.NAME, Z.NAME), ' (', LPAD( S.ZONECODE, 2, '0' ), LPAD( S.NBRHCODE, 2, '0' ), LPAD( S.STREETCODE, 2, '0' ), ')' ) AS street
|
39
46
|
FROM Straatcode S, Buurten B, Zones Z
|
40
47
|
WHERE
|
@@ -48,4 +55,5 @@ class GeoCodeCuracao
|
|
48
55
|
ids = ActiveRecord::Base.connection.execute(sql)
|
49
56
|
end
|
50
57
|
end
|
58
|
+
|
51
59
|
end
|
data/lib/inline_forms.rb
CHANGED
data/lib/inline_forms/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inline_forms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 1.2.
|
9
|
+
- 8
|
10
|
+
version: 1.2.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ace Suares
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-01-
|
18
|
+
date: 2012-01-30 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rspec-rails
|