has_vcards 0.19.0 → 0.20.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.
@@ -1,6 +1,11 @@
1
+ # encoding: utf-8
2
+
1
3
  class Address < ActiveRecord::Base
4
+ # Access restrictions
5
+ attr_accessible :extended_address, :street_address, :post_office_box, :postal_code, :locality, :zip_locality
6
+
2
7
  belongs_to :vcard
3
-
8
+
4
9
  # Validations
5
10
  include I18nHelpers
6
11
 
@@ -0,0 +1,6 @@
1
+ # encoding: utf-8
2
+
3
+ class HonorificPrefix < ActiveRecord::Base
4
+ # Access restrictions
5
+ attr_accessible :sex, :position, :name
6
+ end
@@ -1,4 +1,7 @@
1
1
  class PhoneNumber < ActiveRecord::Base
2
+ # Access restrictions
3
+ attr_accessible :phone_number_type, :number
4
+
2
5
  # Vcard association
3
6
  belongs_to :vcard, :inverse_of => :contacts
4
7
  belongs_to :object, :polymorphic => true
@@ -11,10 +11,15 @@ module HasAddress
11
11
  end
12
12
 
13
13
  class Vcard < ActiveRecord::Base
14
+ # Access restrictions
15
+ attr_accessible :full_name, :honorific_prefix, :family_name, :given_name
16
+
14
17
  has_one :address, :autosave => true, :validate => true
15
18
  accepts_nested_attributes_for :address
19
+ attr_accessible :address_attributes
16
20
  delegate :post_office_box, :extended_address, :street_address, :locality, :region, :postal_code, :country_name, :zip_locality, :to => :address
17
21
  delegate :post_office_box=, :extended_address=, :street_address=, :locality=, :region=, :postal_code=, :country_name=, :zip_locality=, :to => :address
22
+ attr_accessible :post_office_box, :extended_address, :street_address, :locality, :region, :postal_code, :country_name, :zip_locality
18
23
  include HasAddress
19
24
 
20
25
  has_many :addresses, :autosave => true, :validate => true
@@ -46,7 +51,9 @@ class Vcard < ActiveRecord::Base
46
51
  end
47
52
 
48
53
  def abbreviated_name
49
- "#{given_name[0..0]}. #{family_name}"
54
+ return read_attribute(:full_name) if read_attribute(:full_name)
55
+
56
+ [given_name.try(:first).try(:upcase), family_name].compact.join(". ")
50
57
  end
51
58
 
52
59
  # Advanced finders
@@ -93,7 +100,7 @@ class Vcard < ActiveRecord::Base
93
100
  end
94
101
  end
95
102
  accepts_nested_attributes_for :contacts, :reject_if => proc {|attributes| attributes['number'].blank? }, :allow_destroy => true
96
-
103
+ attr_accessible :contacts_attributes
97
104
  # Salutation
98
105
  def salutation
99
106
  case honorific_prefix
@@ -0,0 +1,15 @@
1
+ .row-fluid
2
+ .span6
3
+ %h3= t('form.person.address')
4
+ = render 'vcards/form', :f => f
5
+
6
+ .span6
7
+ %h3= t_model(PhoneNumber)
8
+ .nested-form.list.contacts
9
+ = f.fields_for :vcard do |vcard|
10
+ - vcard.object.contacts.build_defaults
11
+ - vcard.fields_for :contacts do |contact|
12
+ = render 'phone_numbers/form', :item => contact
13
+ = link_to [:new_phone_number, resource.persisted? ? resource : controller_name], :remote => true, :class => 'btn' do
14
+ %i.icon-plus
15
+ =t_action(:more)
@@ -1,5 +1,7 @@
1
- #phone_number_form
2
- = form_for [@vcard, @phone_number], :remote => true do |phone_number|
3
- = phone_number.select :phone_number_type, ['Tel. privat', 'Tel. geschäft', 'Handy', 'Fax', 'E-Mail']
4
- = phone_number.text_field :number, :size => 12, :autocomplete => 'off'
5
- = phone_number.submit "Speichern"
1
+ .nested-form-item
2
+ .control-group.string.optional
3
+ %label.select.optional.control-label= item.select :phone_number_type, ['Tel. geschäft', 'Tel. privat', 'Handy', 'Fax', 'E-Mail', 'Webseite']
4
+ .controls
5
+ = item.text_field :number, :autocomplete => 'off', :class => 'string optional'
6
+ = link_to content_tag(:i, '', :class => 'icon-trash delete-nested-form-item'), '#'
7
+ = item.hidden_field :_destroy
@@ -14,6 +14,7 @@ de:
14
14
  honorific_prefix: Anrede
15
15
  honorific_suffix: Namenszusatz
16
16
  address_type: Art
17
+ address: Adresse
17
18
 
18
19
  activerecord:
19
20
  models:
@@ -0,0 +1,9 @@
1
+ class CreateHonorificPrefixesTable < ActiveRecord::Migration
2
+ def up
3
+ change_table "honorific_prefixes" do |t|
4
+ t.integer "sex"
5
+ t.string "name"
6
+ t.integer "position"
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module HasVcards
2
- VERSION = '0.19.0'
2
+ VERSION = '0.20.0'
3
3
  end
metadata CHANGED
@@ -1,72 +1,58 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: has_vcards
3
- version: !ruby/object:Gem::Version
4
- hash: 83
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 19
9
- - 0
10
- version: 0.19.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.20.0
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
13
- - "Simon H\xC3\xBCrlimann (CyT)"
7
+ authors:
8
+ - Simon Hürlimann (CyT)
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-09-20 00:00:00 +02:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2012-12-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: rails
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &80833440 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
18
+ requirements:
27
19
  - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 7
30
- segments:
31
- - 3
32
- - 0
33
- version: "3.0"
20
+ - !ruby/object:Gem::Version
21
+ version: '3.0'
34
22
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: inherited_resources
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *80833440
25
+ - !ruby/object:Gem::Dependency
26
+ name: inherited_resources
27
+ requirement: &80833160 !ruby/object:Gem::Requirement
40
28
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 3
45
- segments:
46
- - 0
47
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
48
33
  type: :runtime
49
- version_requirements: *id002
34
+ prerelease: false
35
+ version_requirements: *80833160
50
36
  description: vCard like contact and address models and helpers for Rails.
51
37
  email: simon.huerlimann@cyt.ch
52
38
  executables: []
53
-
54
39
  extensions: []
55
-
56
- extra_rdoc_files:
40
+ extra_rdoc_files:
57
41
  - MIT-LICENSE
58
42
  - README.markdown
59
- files:
43
+ files:
60
44
  - app/controllers/directory_lookup_controller.rb
61
45
  - app/controllers/phone_numbers_controller.rb
62
46
  - app/controllers/vcards_controller.rb
63
47
  - app/helpers/has_vcards_helper.rb
64
48
  - app/input/zip_locality_input.rb
65
49
  - app/models/address.rb
50
+ - app/models/honorific_prefix.rb
66
51
  - app/models/phone_number.rb
67
52
  - app/models/vcard.rb
68
53
  - app/models/vcard/directory_address.rb
69
54
  - app/models/vcard/directory_lookup.rb
55
+ - app/views/people/_address_form.html.haml
70
56
  - app/views/phone_numbers/_form.html.haml
71
57
  - app/views/phone_numbers/_list.html.haml
72
58
  - app/views/phone_numbers/_nested_form.html.haml
@@ -85,44 +71,36 @@ files:
85
71
  - db/migrate/000_create_vcard_tables.rb
86
72
  - db/migrate/20120119091225_add_index_to_vcards.rb
87
73
  - db/migrate/20120813065226_add_time_stamps_to_has_vcards_tables.rb
74
+ - db/migrate/20121113120000_create_honorific_prefixes_table.rb
88
75
  - lib/has_vcards.rb
89
76
  - lib/has_vcards/railtie.rb
90
77
  - lib/has_vcards/version.rb
91
78
  - MIT-LICENSE
92
79
  - README.markdown
93
- has_rdoc: true
94
80
  homepage: https://github.com/huerlisi/has_vcards
95
- licenses:
81
+ licenses:
96
82
  - MIT
97
83
  post_install_message:
98
84
  rdoc_options: []
99
-
100
- require_paths:
85
+ require_paths:
101
86
  - lib
102
- required_ruby_version: !ruby/object:Gem::Requirement
87
+ required_ruby_version: !ruby/object:Gem::Requirement
103
88
  none: false
104
- requirements:
105
- - - ">="
106
- - !ruby/object:Gem::Version
107
- hash: 3
108
- segments:
109
- - 0
110
- version: "0"
111
- required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ! '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
94
  none: false
113
- requirements:
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- hash: 3
117
- segments:
118
- - 0
119
- version: "0"
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
120
99
  requirements: []
121
-
122
100
  rubyforge_project:
123
- rubygems_version: 1.3.7
101
+ rubygems_version: 1.8.11
124
102
  signing_key:
125
103
  specification_version: 3
126
104
  summary: vCard plugin for Rails
127
105
  test_files: []
128
-
106
+ has_rdoc: