has_vcards 0.18.0 → 0.19.0
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.
- data/app/input/zip_locality_input.rb +14 -0
- data/app/models/address.rb +9 -0
- data/app/models/vcard/directory_lookup.rb +0 -1
- data/app/models/vcard.rb +2 -2
- data/lib/has_vcards/version.rb +1 -1
- metadata +5 -4
@@ -0,0 +1,14 @@
|
|
1
|
+
class ZipLocalityInput < SimpleForm::Inputs::StringInput
|
2
|
+
def zip_codes
|
3
|
+
SwissMatch.zip_codes.map{|zip| zip.to_s}.inspect
|
4
|
+
end
|
5
|
+
|
6
|
+
def input
|
7
|
+
input_html_options[:type] = 'text'
|
8
|
+
input_html_options[:autocomplete] = 'off'
|
9
|
+
input_html_options['data-provide'] = 'typeahead'
|
10
|
+
input_html_options['data-source'] = zip_codes
|
11
|
+
|
12
|
+
super
|
13
|
+
end
|
14
|
+
end
|
data/app/models/address.rb
CHANGED
@@ -23,4 +23,13 @@ class Address < ActiveRecord::Base
|
|
23
23
|
:locality => locality
|
24
24
|
)
|
25
25
|
end
|
26
|
+
|
27
|
+
# Composed attributes
|
28
|
+
def zip_locality
|
29
|
+
"#{postal_code} #{locality}"
|
30
|
+
end
|
31
|
+
|
32
|
+
def zip_locality=(value)
|
33
|
+
self.postal_code, self.locality = value.split(' ', 2)
|
34
|
+
end
|
26
35
|
end
|
data/app/models/vcard.rb
CHANGED
@@ -13,8 +13,8 @@ end
|
|
13
13
|
class Vcard < ActiveRecord::Base
|
14
14
|
has_one :address, :autosave => true, :validate => true
|
15
15
|
accepts_nested_attributes_for :address
|
16
|
-
delegate :post_office_box, :extended_address, :street_address, :locality, :region, :postal_code, :country_name, :to => :address
|
17
|
-
delegate :post_office_box=, :extended_address=, :street_address=, :locality=, :region=, :postal_code=, :country_name=, :to => :address
|
16
|
+
delegate :post_office_box, :extended_address, :street_address, :locality, :region, :postal_code, :country_name, :zip_locality, :to => :address
|
17
|
+
delegate :post_office_box=, :extended_address=, :street_address=, :locality=, :region=, :postal_code=, :country_name=, :zip_locality=, :to => :address
|
18
18
|
include HasAddress
|
19
19
|
|
20
20
|
has_many :addresses, :autosave => true, :validate => true
|
data/lib/has_vcards/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_vcards
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 83
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 19
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.19.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Simon H\xC3\xBCrlimann (CyT)"
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-09-
|
18
|
+
date: 2012-09-20 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- app/controllers/phone_numbers_controller.rb
|
62
62
|
- app/controllers/vcards_controller.rb
|
63
63
|
- app/helpers/has_vcards_helper.rb
|
64
|
+
- app/input/zip_locality_input.rb
|
64
65
|
- app/models/address.rb
|
65
66
|
- app/models/phone_number.rb
|
66
67
|
- app/models/vcard.rb
|