has_vcards 0.5.1 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ = f.semantic_fields_for :vcard do |vcard|
2
+ = vcard.input :full_name, :input_html => {"data-autofocus" => true}
3
+ = vcard.semantic_fields_for :address do |address|
4
+ = address.inputs :street_address, :extended_address, :postal_code, :locality
@@ -0,0 +1,27 @@
1
+ require 'rails/generators/base'
2
+ require 'rails/generators/migration'
3
+
4
+ module HasVcards
5
+ class MigrationGenerator < Rails::Generators::Base
6
+ include Rails::Generators::Migration
7
+
8
+ def self.source_root
9
+ @source_root ||= File.join(File.dirname(__FILE__), 'templates')
10
+ end
11
+
12
+ # Implement the required interface for Rails::Generators::Migration.
13
+ # taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
14
+ def self.next_migration_number(dirname)
15
+ if ActiveRecord::Base.timestamped_migrations
16
+ Time.now.utc.strftime("%Y%m%d%H%M%S")
17
+ else
18
+ "%.3d" % (current_migration_number(dirname) + 1)
19
+ end
20
+ end
21
+
22
+ def create_migration_file
23
+ migration_template 'migration.rb', 'db/migrate/create_has_vcards.rb'
24
+ end
25
+
26
+ end
27
+ end
@@ -0,0 +1,50 @@
1
+ class CreateVcards < ActiveRecord::Migration
2
+ def self.up
3
+ create_table 'addresses', :force => true do |t|
4
+ t.string 'post_office_box', :limit => 50
5
+ t.string 'extended_address', :limit => 50
6
+ t.string 'street_address', :limit => 50
7
+ t.string 'locality', :limit => 50
8
+ t.string 'region', :limit => 50
9
+ t.string 'postal_code', :limit => 50
10
+ t.string 'country_name', :limit => 50
11
+ t.integer 'vcard_id'
12
+ t.string 'address_type'
13
+ end
14
+
15
+ add_index 'addresses', ['vcard_id'], :name => 'addresses_vcard_id_index'
16
+
17
+ create_table 'phone_numbers', :force => true do |t|
18
+ t.string 'number', :limit => 50
19
+ t.string 'phone_number_type', :limit => 50
20
+ t.integer 'vcard_id'
21
+ t.integer 'object_id'
22
+ t.string 'object_type'
23
+ end
24
+
25
+ add_index 'phone_numbers', ['object_id', 'object_type'], :name => 'index_phone_numbers_on_object_id_and_object_type'
26
+ add_index 'phone_numbers', ['phone_number_type'], :name => 'index_phone_numbers_on_phone_number_type'
27
+ add_index 'phone_numbers', ['vcard_id'], :name => 'phone_numbers_vcard_id_index'
28
+
29
+ create_table 'vcards', :force => true do |t|
30
+ t.string 'full_name', :limit => 50
31
+ t.string 'nickname', :limit => 50
32
+ t.string 'family_name', :limit => 50
33
+ t.string 'given_name', :limit => 50
34
+ t.string 'additional_name', :limit => 50
35
+ t.string 'honorific_prefix', :limit => 50
36
+ t.string 'honorific_suffix', :limit => 50
37
+ t.boolean 'active', :default => true
38
+ t.string 'type'
39
+ t.integer 'object_id'
40
+ t.string 'object_type'
41
+ end
42
+
43
+ add_index 'vcards', ['object_id', 'object_type'], :name => 'index_vcards_on_object_id_and_object_type'
44
+ end
45
+
46
+ def self.down
47
+ drop_table :vcards, :phone_numbers, :addresses
48
+ end
49
+ end
50
+
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 1
9
- version: 0.5.1
8
+ - 3
9
+ version: 0.5.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - "Simon H\xC3\xBCrlimann"
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-10 00:00:00 +01:00
17
+ date: 2010-11-12 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -57,6 +57,9 @@ files:
57
57
  - app/models/address.rb
58
58
  - app/models/phone_number.rb
59
59
  - app/models/vcard.rb
60
+ - app/views/vcards/_form.html.haml
61
+ - lib/generators/has_vcards/migration_generator.rb
62
+ - lib/generators/has_vcards/templates/migration.rb
60
63
  - lib/has_vcards.rb
61
64
  - lib/has_vcards/railtie.rb
62
65
  - test/vcards_test.rb