has_vcards 0.16.0 → 0.17.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.
@@ -0,0 +1,9 @@
1
+ class VcardsController < ApplicationController
2
+ # User inherited resources logic
3
+ inherit_resources
4
+ respond_to :html, :js
5
+
6
+ def directory_lookup
7
+ @vcard = Vcard.find(params[:id])
8
+ end
9
+ end
@@ -1,6 +1,4 @@
1
- - vcard = vcard if defined?(vcard)
2
- - vcard ||= object.try(:vcard) if defined?(object)
3
- - vcard ||= @vcard
4
- - vcard ||= resource.try(:vcard) if defined?(resource)
5
-
6
- = full_address(vcard)
1
+ %tr
2
+ %td= [address.first_name, address.family_name].join(" ")
3
+ %td= address.street
4
+ %td= [address.zip_code, address.city].join(" ")
@@ -0,0 +1,21 @@
1
+ #directory_lookup.modal.hide
2
+ = modal_header 'tel.search.ch'
3
+
4
+ .modal-body
5
+ %table.table
6
+ %tr{:style => 'border-top: none'}
7
+ %th{:style => 'border-top: none'}= [vcard.given_name, vcard.family_name].join(" ")
8
+ %th{:style => 'border-top: none'}= vcard.street_address
9
+ %th{:style => 'border-top: none'}= [vcard.postal_code, vcard.locality].join(" ")
10
+
11
+ - @seen_matches = []
12
+ %tr
13
+ %th{:colspan => 4}= t('directory_lookup.title')
14
+
15
+ = render 'directory_matches', :vcard => vcard, :match_type => :great
16
+ = render 'directory_matches', :vcard => vcard, :match_type => :family_name
17
+ = render 'directory_matches', :vcard => vcard, :match_type => :address
18
+ = render 'directory_matches', :vcard => vcard, :match_type => :locality
19
+
20
+ .modal-footer
21
+ = link_to 'Abbrechen', '#', :class => 'btn', 'data-dismiss' => 'modal'
@@ -0,0 +1,4 @@
1
+ - matches = vcard.send("#{match_type}_matches") - @seen_matches
2
+ - if matches.present?
3
+ - @seen_matches += matches
4
+ = render :partial => 'address', :collection => matches
@@ -0,0 +1,4 @@
1
+ $('#directory_lookup').remove();
2
+
3
+ $('body').append('<%=j render "directory_lookup", :vcard => @vcard %>');
4
+ $('#directory_lookup').modal({show: true});
data/config/routes.rb CHANGED
@@ -6,5 +6,10 @@ Rails.application.routes.draw do
6
6
  # Vcards
7
7
  resources :vcards do
8
8
  resources :phone_numbers
9
+
10
+ # DirectoryLookup
11
+ member do
12
+ get :directory_lookup
13
+ end
9
14
  end
10
15
  end
@@ -1,3 +1,3 @@
1
1
  module HasVcards
2
- VERSION = '0.16.0'
2
+ VERSION = '0.17.0'
3
3
  end
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: 95
4
+ hash: 91
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 16
8
+ - 17
9
9
  - 0
10
- version: 0.16.0
10
+ version: 0.17.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-07-19 00:00:00 +02:00
18
+ date: 2012-07-24 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -58,6 +58,7 @@ extra_rdoc_files:
58
58
  - README.markdown
59
59
  files:
60
60
  - app/controllers/phone_numbers_controller.rb
61
+ - app/controllers/vcards_controller.rb
61
62
  - app/helpers/has_vcards_helper.rb
62
63
  - app/models/address.rb
63
64
  - app/models/phone_number.rb
@@ -68,8 +69,11 @@ files:
68
69
  - app/views/phone_numbers/_nested_form.html.haml
69
70
  - app/views/phone_numbers/_phone_number.html.haml
70
71
  - app/views/vcards/_address.html.haml
72
+ - app/views/vcards/_directory_lookup.html.haml
73
+ - app/views/vcards/_directory_matches.html.haml
71
74
  - app/views/vcards/_form.html.haml
72
75
  - app/views/vcards/_show.html.haml
76
+ - app/views/vcards/directory_lookup.js.erb
73
77
  - config/application.rb
74
78
  - config/boot.rb
75
79
  - config/locales/de.yml