innetra-easy_contacts 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/Rakefile +14 -0
  2. data/easy_contacts.gemspec +31 -0
  3. data/generators/easy_contacts/easy_contacts_generator.rb +160 -0
  4. data/generators/easy_contacts/templates/controllers/addresses_controller.rb +12 -0
  5. data/generators/easy_contacts/templates/controllers/cities_controller.rb +7 -0
  6. data/generators/easy_contacts/templates/controllers/companies_controller.rb +75 -0
  7. data/generators/easy_contacts/templates/controllers/contacts_controller.rb +10 -0
  8. data/generators/easy_contacts/templates/controllers/countries_controller.rb +7 -0
  9. data/generators/easy_contacts/templates/controllers/emails_controller.rb +12 -0
  10. data/generators/easy_contacts/templates/controllers/instant_messengers_controller.rb +12 -0
  11. data/generators/easy_contacts/templates/controllers/people_controller.rb +89 -0
  12. data/generators/easy_contacts/templates/controllers/phones_controller.rb +12 -0
  13. data/generators/easy_contacts/templates/controllers/provinces_controller.rb +7 -0
  14. data/generators/easy_contacts/templates/controllers/web_sites_controller.rb +12 -0
  15. data/generators/easy_contacts/templates/helpers/addresses_helper.rb +5 -0
  16. data/generators/easy_contacts/templates/helpers/emails_helper.rb +5 -0
  17. data/generators/easy_contacts/templates/helpers/form_helper.rb +5 -0
  18. data/generators/easy_contacts/templates/helpers/instant_messengers_helper.rb +6 -0
  19. data/generators/easy_contacts/templates/helpers/phones_helper.rb +5 -0
  20. data/generators/easy_contacts/templates/helpers/shadowbox_helper.rb +23 -0
  21. data/generators/easy_contacts/templates/helpers/web_sites_helper.rb +5 -0
  22. data/generators/easy_contacts/templates/locales/en.easy_contacts.yml +59 -0
  23. data/generators/easy_contacts/templates/locales/es-MX.easy_contacts.yml +92 -0
  24. data/generators/easy_contacts/templates/migrations/easy_contacts.rb +123 -0
  25. data/generators/easy_contacts/templates/models/address.rb +33 -0
  26. data/generators/easy_contacts/templates/models/address_type.rb +2 -0
  27. data/generators/easy_contacts/templates/models/city.rb +2 -0
  28. data/generators/easy_contacts/templates/models/company.rb +5 -0
  29. data/generators/easy_contacts/templates/models/contact.rb +121 -0
  30. data/generators/easy_contacts/templates/models/country.rb +2 -0
  31. data/generators/easy_contacts/templates/models/email.rb +14 -0
  32. data/generators/easy_contacts/templates/models/email_type.rb +2 -0
  33. data/generators/easy_contacts/templates/models/instant_messenger.rb +5 -0
  34. data/generators/easy_contacts/templates/models/instant_messenger_protocol.rb +2 -0
  35. data/generators/easy_contacts/templates/models/instant_messenger_type.rb +2 -0
  36. data/generators/easy_contacts/templates/models/person.rb +38 -0
  37. data/generators/easy_contacts/templates/models/phone.rb +4 -0
  38. data/generators/easy_contacts/templates/models/phone_type.rb +2 -0
  39. data/generators/easy_contacts/templates/models/province.rb +2 -0
  40. data/generators/easy_contacts/templates/models/web_site.rb +4 -0
  41. data/generators/easy_contacts/templates/models/web_site_type.rb +2 -0
  42. data/generators/easy_contacts/templates/stylesheets/companies.css +4 -0
  43. data/generators/easy_contacts/templates/stylesheets/default.css +46 -0
  44. data/generators/easy_contacts/templates/stylesheets/people.css +13 -0
  45. data/generators/easy_contacts/templates/views/addresses/_address.html.erb +65 -0
  46. data/generators/easy_contacts/templates/views/addresses/_addresses.html.erb +5 -0
  47. data/generators/easy_contacts/templates/views/addresses/destroy.js.rjs +1 -0
  48. data/generators/easy_contacts/templates/views/cities/index.js.erb +1 -0
  49. data/generators/easy_contacts/templates/views/companies/_company.html.erb +17 -0
  50. data/generators/easy_contacts/templates/views/companies/edit.html.erb +13 -0
  51. data/generators/easy_contacts/templates/views/companies/index.html.erb +21 -0
  52. data/generators/easy_contacts/templates/views/companies/index.js.erb +1 -0
  53. data/generators/easy_contacts/templates/views/companies/new.html.erb +13 -0
  54. data/generators/easy_contacts/templates/views/companies/show.html.erb +19 -0
  55. data/generators/easy_contacts/templates/views/contacts/_contact.html.erb +14 -0
  56. data/generators/easy_contacts/templates/views/contacts/_contact_info.html.erb +61 -0
  57. data/generators/easy_contacts/templates/views/contacts/index.html.erb +21 -0
  58. data/generators/easy_contacts/templates/views/countries/index.js.erb +1 -0
  59. data/generators/easy_contacts/templates/views/emails/_email.html.erb +20 -0
  60. data/generators/easy_contacts/templates/views/emails/_emails.html.erb +13 -0
  61. data/generators/easy_contacts/templates/views/emails/destroy.js.rjs +1 -0
  62. data/generators/easy_contacts/templates/views/instant_messengers/_instant_messenger.html.erb +21 -0
  63. data/generators/easy_contacts/templates/views/instant_messengers/_instant_messengers.html.erb +14 -0
  64. data/generators/easy_contacts/templates/views/instant_messengers/destroy.js.rjs +1 -0
  65. data/generators/easy_contacts/templates/views/people/_person.html.erb +44 -0
  66. data/generators/easy_contacts/templates/views/people/edit.html.erb +13 -0
  67. data/generators/easy_contacts/templates/views/people/index.html.erb +21 -0
  68. data/generators/easy_contacts/templates/views/people/new.html.erb +13 -0
  69. data/generators/easy_contacts/templates/views/people/show.html.erb +13 -0
  70. data/generators/easy_contacts/templates/views/phones/_phone.html.erb +17 -0
  71. data/generators/easy_contacts/templates/views/phones/_phones.html.erb +14 -0
  72. data/generators/easy_contacts/templates/views/phones/destroy.js.rjs +1 -0
  73. data/generators/easy_contacts/templates/views/provinces/index.js.erb +1 -0
  74. data/generators/easy_contacts/templates/views/web_sites/_web_site.html.erb +19 -0
  75. data/generators/easy_contacts/templates/views/web_sites/_web_sites.html.erb +14 -0
  76. data/generators/easy_contacts/templates/views/web_sites/destroy.js.rjs +1 -0
  77. data/tasks/init.rake +43 -0
  78. metadata +133 -0
@@ -0,0 +1,92 @@
1
+ "es-MX":
2
+ activerecord:
3
+
4
+ models:
5
+ contact: "Contacto"
6
+ person: "Contacto"
7
+ company: "Compañía"
8
+ phone: "Teléfono"
9
+ email: "Correo Electrónico"
10
+ address: "Domicilio"
11
+
12
+ attributes:
13
+ address:
14
+ address: "Domicilio"
15
+ city_name: "Ciudad"
16
+ province_name: "Estado"
17
+ country_name: "País"
18
+ person:
19
+ name: "Nombre"
20
+ last_name: "Apellidos"
21
+ full_name: "Nombre Completo"
22
+ company:
23
+ name: "Compañía"
24
+ phone:
25
+ number: "Teléfono"
26
+ email:
27
+ address: "Email"
28
+ web_site:
29
+ address: "Web"
30
+
31
+ actions:
32
+ edit: "Editar"
33
+ delete: "Eliminar"
34
+
35
+ forms:
36
+ save: "Guardar"
37
+ cancel: "Cancelar"
38
+ update: "Actualizar"
39
+ optional_fields: "Datos Opcionales"
40
+
41
+ addresses:
42
+ title: "Domicilio"
43
+ add_link: "Agregar"
44
+ companies:
45
+ flash:
46
+ create: "Compañía creada."
47
+ update: "Compañía actualizada."
48
+ index:
49
+ title: "Compañías"
50
+ new_company_link: "Registrar nueva compañía"
51
+ new:
52
+ title: "Registrar Nueva Compañía"
53
+ cancel: "Cancelar"
54
+ edit:
55
+ title: "Editar compañía \"{{name}}\""
56
+ show:
57
+ people_in_this_company: "Contactos"
58
+ contacts:
59
+ info:
60
+ title: "Contacto {{name}}"
61
+ index:
62
+ title: "Contactos"
63
+ new_person_link: "Registrar nuevo contacto"
64
+ new_company_link: "Registrar nueva companía"
65
+ add_link: "Agregar"
66
+ emails:
67
+ title: "Correo Electrónico"
68
+ add_link: "Agregar"
69
+ instant_messengers:
70
+ title: "Mensajero Instantaneo"
71
+ add_link: "Agregar"
72
+ people:
73
+ flash:
74
+ create: "Usuario creado."
75
+ update: "Usuario actualizado."
76
+ index:
77
+ title: "Contactos"
78
+ new_person_link: "Registrar nuevo contacto"
79
+ new:
80
+ title: "Registrar Nuevo Contacto"
81
+ cancel: "Cancelar"
82
+ edit:
83
+ title: "Editar contacto \"{{full_name}}\""
84
+ show:
85
+ title_description: "{{title}} en {{company}}"
86
+ contact_data: "Datos {{name}}"
87
+ phones:
88
+ title: "Teléfonos"
89
+ add_link: "Agregar"
90
+ web_sites:
91
+ title: "Internet"
92
+ add_link: "Agregar"
@@ -0,0 +1,123 @@
1
+ class CreateEasyContacts < ActiveRecord::Migration
2
+
3
+ def self.up
4
+
5
+ create_table :addresses do |t|
6
+ t.integer :owner_id
7
+ t.string :owner_type
8
+ t.integer :address_type_id
9
+ t.string :address
10
+ t.integer :city_id
11
+ t.integer :province_id
12
+ t.integer :country_id
13
+ t.string :zip
14
+
15
+ t.timestamps
16
+ end
17
+
18
+ create_table :contacts do |t|
19
+ t.string :type
20
+ t.integer :owner_id
21
+ t.string :owner_type
22
+ t.integer :company_id # Only for Person
23
+ t.string :name # Only for Company
24
+ t.string :last_name
25
+ t.string :title
26
+
27
+ t.timestamps
28
+ end
29
+
30
+ create_table :emails do |t|
31
+ t.integer :owner_id
32
+ t.string :owner_type
33
+ t.integer :email_type_id
34
+ t.string :address
35
+
36
+ t.timestamps
37
+ end
38
+
39
+ create_table :instant_messengers do |t|
40
+ t.integer :owner_id
41
+ t.string :owner_type
42
+ t.integer :instant_messenger_type_id
43
+ t.integer :instant_messenger_protocol_id
44
+ t.string :nick
45
+
46
+ t.timestamps
47
+ end
48
+
49
+ create_table :phones do |t|
50
+ t.integer :owner_id
51
+ t.string :owner_type
52
+ t.integer :phone_type_id
53
+ t.string :number
54
+
55
+ t.timestamps
56
+ end
57
+
58
+ create_table :web_sites do |t|
59
+ t.integer :owner_id
60
+ t.string :owner_type
61
+ t.integer :web_site_type_id
62
+ t.string :address
63
+
64
+ t.timestamps
65
+ end
66
+
67
+ create_table :address_types do |t|
68
+ t.string :description
69
+ end
70
+
71
+ create_table :cities do |t|
72
+ t.string :name
73
+ end
74
+
75
+ create_table :countries do |t|
76
+ t.string :name
77
+ end
78
+
79
+ create_table :email_types do |t|
80
+ t.string :description
81
+ end
82
+
83
+ create_table :instant_messenger_protocols do |t|
84
+ t.string :name
85
+ end
86
+
87
+ create_table :instant_messenger_types do |t|
88
+ t.string :description
89
+ end
90
+
91
+ create_table :phone_types do |t|
92
+ t.string :description
93
+ end
94
+
95
+ create_table :provinces do |t|
96
+ t.string :name
97
+ end
98
+
99
+ create_table :web_site_types do |t|
100
+ t.string :description
101
+ end
102
+
103
+ end
104
+
105
+ def self.down
106
+ drop_table :addresses
107
+ drop_table :contacts
108
+ drop_table :emails
109
+ drop_table :instant_messengers
110
+ drop_table :phones
111
+ drop_table :web_sites
112
+ drop_table :address_types
113
+ drop_table :cities
114
+ drop_table :countries
115
+ drop_table :email_types
116
+ drop_table :instant_messenger_protocols
117
+ drop_table :instant_messenger_types
118
+ drop_table :phone_types
119
+ drop_table :provinces
120
+ drop_table :web_site_types
121
+ end
122
+
123
+ end
@@ -0,0 +1,33 @@
1
+ class Address < ActiveRecord::Base
2
+
3
+ belongs_to :owner, :polymorphic => true
4
+ belongs_to :address_type
5
+ belongs_to :city
6
+ belongs_to :country
7
+ belongs_to :province
8
+
9
+ def city_name
10
+ city.name if city
11
+ end
12
+
13
+ def city_name=(name)
14
+ self.city = City.find_or_create_by_name(name) unless name.blank?
15
+ end
16
+
17
+ def province_name
18
+ province.name if province
19
+ end
20
+
21
+ def province_name=(name)
22
+ self.province = Province.find_or_create_by_name(name) unless name.blank?
23
+ end
24
+
25
+ def country_name
26
+ country.name if country
27
+ end
28
+
29
+ def country_name=(name)
30
+ self.country = Country.find_or_create_by_name(name) unless name.blank?
31
+ end
32
+
33
+ end
@@ -0,0 +1,2 @@
1
+ class AddressType < ActiveRecord::Base
2
+ end
@@ -0,0 +1,2 @@
1
+ class City < ActiveRecord::Base
2
+ end
@@ -0,0 +1,5 @@
1
+ class Company < Contact
2
+ has_many :people
3
+ validates_presence_of :name
4
+ validates_uniqueness_of :name, :case_sensitive => false
5
+ end
@@ -0,0 +1,121 @@
1
+ class Contact < ActiveRecord::Base
2
+
3
+ belongs_to :owner, :polymorphic => true
4
+
5
+ has_many :addresses, :as => :owner
6
+ has_many :emails, :as => :owner
7
+ has_many :instant_messengers, :as => :owner
8
+ has_many :phones, :as => :owner
9
+ has_many :web_sites, :as => :owner
10
+
11
+ after_update :save_attributes
12
+
13
+ def email_attributes=(email_attributes)
14
+ email_attributes.each do |attributes|
15
+
16
+ if attributes[:id].blank? && !attributes[:address].blank?
17
+ emails.build(attributes)
18
+ end
19
+
20
+ unless attributes[:id].blank?
21
+ email = emails.detect { |t| t.id == attributes[:id].to_i }
22
+ unless attributes[:address].blank?
23
+ email.attributes = attributes
24
+ else
25
+ email.delete
26
+ end
27
+ end
28
+
29
+ end
30
+ end
31
+
32
+ def phone_attributes=(phone_attributes)
33
+ phone_attributes.each do |attributes|
34
+ if attributes[:id].blank? && !attributes[:number].blank?
35
+ phones.build(attributes)
36
+ end
37
+
38
+ unless attributes[:id].blank?
39
+ phone = phones.detect { |t| t.id == attributes[:id].to_i }
40
+ unless attributes[:number].blank?
41
+ phone.attributes = attributes
42
+ else
43
+ phone.delete
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ def instant_messenger_attributes=(instant_messenger_attributes)
50
+ instant_messenger_attributes.each do |attributes|
51
+ if attributes[:id].blank? && !attributes[:nick].blank?
52
+ instant_messengers.build(attributes)
53
+ end
54
+ unless attributes[:id].blank?
55
+ instant_messenger = instant_messengers.detect { |t| t.id == attributes[:id].to_i }
56
+ unless attributes[:nick].blank?
57
+ instant_messenger.attributes = attributes
58
+ else
59
+ instant_messenger.delete
60
+ end
61
+ end
62
+ end
63
+ end
64
+
65
+ def web_site_attributes=(web_site_attributes)
66
+ web_site_attributes.each do |attributes|
67
+ if attributes[:id].blank? && !attributes[:address].blank?
68
+ web_sites.build(attributes)
69
+ end
70
+ unless attributes[:id].blank?
71
+ web_site = web_sites.detect { |t| t.id == attributes[:id].to_i }
72
+ unless attributes[:address].blank?
73
+ web_site.attributes = attributes
74
+ else
75
+ web_site.delete
76
+ end
77
+ end
78
+ end
79
+ end
80
+
81
+ def address_attributes=(address_attributes)
82
+ address_attributes.each do |attributes|
83
+ if attributes[:id].blank? && !attributes[:address].blank?
84
+ addresses.build(attributes)
85
+ end
86
+ unless attributes[:id].blank?
87
+ address = addresses.detect { |t| t.id == attributes[:id].to_i }
88
+ unless attributes[:address].blank?
89
+ address.attributes = attributes
90
+ else
91
+ address.delete
92
+ end
93
+ end
94
+ end
95
+ end
96
+
97
+ def save_attributes
98
+
99
+ phones.each do |t|
100
+ t.save(false)
101
+ end
102
+
103
+ emails.each do |t|
104
+ t.save(false)
105
+ end
106
+
107
+ instant_messengers.each do |t|
108
+ t.save(false)
109
+ end
110
+
111
+ web_sites.each do |t|
112
+ t.save(false)
113
+ end
114
+
115
+ addresses.each do |t|
116
+ t.save(false)
117
+ end
118
+
119
+ end
120
+
121
+ end
@@ -0,0 +1,2 @@
1
+ class Country < ActiveRecord::Base
2
+ end
@@ -0,0 +1,14 @@
1
+ class Email < ActiveRecord::Base
2
+
3
+ belongs_to :owner, :polymorphic => true
4
+ belongs_to :email_type
5
+
6
+ validates_presence_of :address
7
+ validates_format_of :address,
8
+ :with => /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/
9
+
10
+ def before_save
11
+ self.address.downcase!
12
+ end
13
+
14
+ end
@@ -0,0 +1,2 @@
1
+ class EmailType < ActiveRecord::Base
2
+ end
@@ -0,0 +1,5 @@
1
+ class InstantMessenger < ActiveRecord::Base
2
+ belongs_to :owner, :polymorphic => true
3
+ belongs_to :instant_messenger_protocol
4
+ belongs_to :instant_messenger_type
5
+ end
@@ -0,0 +1,2 @@
1
+ class InstantMessengerProtocol < ActiveRecord::Base
2
+ end
@@ -0,0 +1,2 @@
1
+ class InstantMessengerType < ActiveRecord::Base
2
+ end
@@ -0,0 +1,38 @@
1
+ class Person < Contact
2
+
3
+ belongs_to :company
4
+
5
+ validates_presence_of :name
6
+ validates_presence_of :last_name
7
+ validates_uniqueness_of :name, :scope => :last_name
8
+
9
+ def full_name
10
+ "#{self.name} #{self.last_name}"
11
+ end
12
+
13
+ def title_description
14
+ unless self.company_id.blank?
15
+ I18n.translate "people.show.title_description",
16
+ :title => self.title, :company => self.company.name
17
+ else
18
+ self.title
19
+ end
20
+ end
21
+
22
+ def company_attributes=(company_attributes)
23
+ if (self.new_record? || self.company_id.blank?) && !company_attributes[:name].blank?
24
+ if company = Company.find_by_name(company_attributes[:name])
25
+ self.company_id = company.id
26
+ else
27
+ company = Company.new(:name => company_attributes[:name])
28
+ company.save(false)
29
+ self.company_id = company.id
30
+ end
31
+ elsif company_attributes[:name].blank?
32
+ self.company_id = nil
33
+ elsif self.company.name != company_attributes[:name]
34
+ self.company.update_attributes(company_attributes)
35
+ end
36
+ end
37
+
38
+ end
@@ -0,0 +1,4 @@
1
+ class Phone < ActiveRecord::Base
2
+ belongs_to :owner, :polymorphic => true
3
+ belongs_to :phone_type
4
+ end
@@ -0,0 +1,2 @@
1
+ class PhoneType < ActiveRecord::Base
2
+ end
@@ -0,0 +1,2 @@
1
+ class Province < ActiveRecord::Base
2
+ end
@@ -0,0 +1,4 @@
1
+ class WebSite < ActiveRecord::Base
2
+ belongs_to :owner, :polymorphic => true
3
+ belongs_to :web_site_type
4
+ end
@@ -0,0 +1,2 @@
1
+ class WebSiteType < ActiveRecord::Base
2
+ end
@@ -0,0 +1,4 @@
1
+ #company_name {
2
+ font-size: 20px;
3
+ font-weight: bold;
4
+ }
@@ -0,0 +1,46 @@
1
+ div.auto_complete {
2
+ width: 350px;
3
+ background: #fff;
4
+ }
5
+
6
+ div.auto_complete ul {
7
+ border: 1px solid #888;
8
+ margin: 0;
9
+ padding: 0;
10
+ width: 100%;
11
+ list-style-type: none;
12
+ }
13
+
14
+ div.auto_complete ul li {
15
+ margin: 0;
16
+ padding: 3px;
17
+ }
18
+
19
+ div.auto_complete ul li.selected {
20
+ background-color: #ffb;
21
+ }
22
+
23
+ div.auto_complete ul strong.highlight {
24
+ color: #800;
25
+ margin:0;
26
+ padding:0;
27
+ }
28
+
29
+ #contact_details .label {
30
+ font-size: 10px;
31
+ font-weight: bold;
32
+ min-width: 60px;
33
+ }
34
+
35
+ .address table {
36
+ padding: 0;
37
+ margin: 0;
38
+
39
+ }
40
+
41
+ .address td {
42
+ padding: 0;
43
+ padding-right: 5px;
44
+ padding-bottom: 3px;
45
+ margin: 0;
46
+ }
@@ -0,0 +1,13 @@
1
+ #person_name,
2
+ #person_last_name {
3
+ font-size: 20px;
4
+ font-weight: bold;
5
+ }
6
+
7
+ .person {
8
+ padding: 10px 0;
9
+ }
10
+
11
+ .full_name {
12
+ font-size: 18px;
13
+ }
@@ -0,0 +1,65 @@
1
+ <%% content_tag_for(:li, address) do -%>
2
+ <%% fields_for "#{dom_class(owner)}[address_attributes][]", address do |form| -%>
3
+ <%% unless address.new_record? -%>
4
+ <%%= form.hidden_field :id, :index => nil %>
5
+ <%% end -%>
6
+ <table cellpadding="0" cellspacing="0" border="0" class="address">
7
+ <tr>
8
+ <td>
9
+ <%%= form.text_area :address, :index => nil, :size => "50x3" %><br />
10
+ <%%= form.label :city_name %><br />
11
+ <%%= form.text_field :city_name, :index => nil, :autocomplete => :off %>
12
+ <div id="<%%= dom_class(owner) -%>_address_attributes_city_name_auto_complete" class="auto_complete" style="display: none;"></div>
13
+ <script type="text/javascript">
14
+ //<![CDATA[
15
+ var address_city_name_auto_completer = new Ajax.Autocompleter('<%%= dom_class(owner) -%>_address_attributes__city_name',
16
+ '<%%= dom_class(owner) -%>_address_attributes_city_name_auto_complete',
17
+ '<%%= formatted_cities_url(:js) -%>',
18
+ {callback:function(element, value) { return 'search=' + element.value }, method:'get'})
19
+ //]]>
20
+ </script>
21
+ <br />
22
+ <table cellpadding="0" cellspacing="0" border="0">
23
+ <tr>
24
+ <td>
25
+ <%%= form.label :province_name %><br />
26
+ <%%= form.text_field :province_name, :index => nil, :autocomplete => :off %>
27
+ <div id="<%%= dom_class(owner) -%>_address_attributes_province_name_auto_complete" class="auto_complete" style="display: none;"></div>
28
+ <script type="text/javascript">
29
+ //<![CDATA[
30
+ var address_province_name_auto_completer = new Ajax.Autocompleter('<%%= dom_class(owner) -%>_address_attributes__province_name',
31
+ '<%%= dom_class(owner) -%>_address_attributes_province_name_auto_complete',
32
+ '<%%= formatted_provinces_url(:js) -%>',
33
+ {callback:function(element, value) { return 'search=' + element.value }, method:'get'})
34
+ //]]>
35
+ </script>
36
+ <br />
37
+ </td>
38
+ <td>
39
+ <%%= form.label :zip %><br />
40
+ <%%= form.text_field :zip, :size => "5", :index => nil %>
41
+ </td>
42
+ </tr>
43
+ </table>
44
+ <%%= form.label :country_name %><br />
45
+ <%%= form.text_field :country_name, :index => nil, :autocomplete => :off %>
46
+ <div id="<%%= dom_class(owner) -%>_address_attributes_country_name_auto_complete" class="auto_complete" style="display: none;"></div>
47
+ <script type="text/javascript">
48
+ //<![CDATA[
49
+ var address_country_name_auto_completer = new Ajax.Autocompleter('<%%= dom_class(owner) -%>_address_attributes__country_name',
50
+ '<%%= dom_class(owner) -%>_address_attributes_country_name_auto_complete',
51
+ '<%%= formatted_countries_url(:js) -%>',
52
+ {callback:function(element, value) { return 'search=' + element.value }, method:'get'})
53
+ //]]>
54
+ </script>
55
+ <br />
56
+ </td>
57
+ <td>
58
+ <%%= form.collection_select :address_type_id,
59
+ AddressType.all, :id, :description, {}, { :index => nil } %>
60
+ </td>
61
+ </tr>
62
+ </table>
63
+ <%% end -%>
64
+ <br />
65
+ <%% end -%>
@@ -0,0 +1,5 @@
1
+ <%% content_tag(:ul, :id => "addresses") do -%>
2
+ <%% for address in owner.addresses -%>
3
+ <%%= render :partial => address, :locals => { :owner => owner } %>
4
+ <%% end -%>
5
+ <%% end -%>
@@ -0,0 +1 @@
1
+ page["address_#{@address.id}"].remove
@@ -0,0 +1 @@
1
+ <%%= auto_complete_result @cities, :name %>
@@ -0,0 +1,17 @@
1
+ <%% form_for company do |form| %>
2
+ <%%= error_messages_for :company %>
3
+ <p>
4
+ <%%= form.label :name %>
5
+ <%%= required_field %><br />
6
+ <%%= form.text_field :name, :size => 60 %>
7
+ </p>
8
+ <hr />
9
+
10
+ <%%= render :partial => "contacts/contact", :object => company %>
11
+
12
+ <hr />
13
+ <p>
14
+ <%%= submit_tag t("forms.save") %>&nbsp;ó
15
+ <%%= link_to t("forms.cancel"), companies_url, :class => :red %>
16
+ </p>
17
+ <%% end %>
@@ -0,0 +1,13 @@
1
+ <%% content_for :header do -%>
2
+ <%%= stylesheet_link_tag "easy_contacts/default", :media => :all %>
3
+ <%%= stylesheet_link_tag "easy_contacts/companies", :media => :all %>
4
+ <%% end -%>
5
+
6
+ <h1>
7
+ <div class="title_actions">
8
+ <%%= link_to t("forms.cancel"), @company %>
9
+ </div>
10
+ <%%= t("companies.edit.title", :name => @company.name) %>
11
+ </h1>
12
+
13
+ <%%= render :partial => "/companies/company", :object => @company %>