inline_forms 1.2.7 → 1.2.8

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.
@@ -83,7 +83,7 @@ gem 'cancan'
83
83
  gem 'inline_forms'
84
84
  gem 'mini_magick'
85
85
  gem 'jquery_datepicker'
86
-
86
+ gem 'rails3-jquery-autocomplete'
87
87
  "
88
88
  gemfile_development_group ="
89
89
 
@@ -7,5 +7,4 @@
7
7
  //= require_directory ./jquery.tools
8
8
  //= require validation_tooltips
9
9
  //= require jquery-ui
10
-
11
-
10
+ //= require autocomplete-rails
@@ -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)._presentation rescue nil
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
- text_field_with_auto_complete :geo_code_curacao, :street, :skip_style => true
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
- street = find_options[:conditions][1].gsub(/\\/, '\&\&').gsub(/'/, "''") # http://www.ruby-forum.com/topic/80357, active_record/connection_adapter/Quoting.rb
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
@@ -161,6 +161,3 @@ module Kernel
161
161
  caller[1] =~ /`([^']*)'/ and $1
162
162
  end
163
163
  end
164
-
165
-
166
-
@@ -1,3 +1,3 @@
1
1
  module InlineForms
2
- VERSION = "1.2.7"
2
+ VERSION = "1.2.8"
3
3
  end
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: 17
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 7
10
- version: 1.2.7
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-23 00:00:00 Z
18
+ date: 2012-01-30 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rspec-rails