diff --git a/Gemfile.lock b/Gemfile.lock
index 5c6398084..40d5ff407 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -55,15 +55,6 @@ GIT
carrierwave (0.5.0)
activesupport (~> 3.0)
-GIT
- remote: git://github.com/rsofaer/redfinger.git
- revision: 07721f46d02b9d3aa04880788fecb0b4c1b284d7
- specs:
- redfinger (0.0.6)
- hashie
- nokogiri (>= 1.4.0)
- rest-client (>= 1.5.0)
-
GIT
remote: git://github.com/rsofaer/sprinkle.git
revision: 7c744ed158dda1f99a015e6a29d086e80bd8c635
@@ -409,7 +400,6 @@ DEPENDENCIES
omniauth
pubsubhubbub
rails (>= 3.0.0)
- redfinger!
roxml!
rspec (>= 2.0.0)
rspec-rails (>= 2.0.0)
diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb
index b82dcce18..ea56ed81b 100644
--- a/app/controllers/people_controller.rb
+++ b/app/controllers/people_controller.rb
@@ -55,10 +55,6 @@ class PeopleController < ApplicationController
params[:person][:profile][:birthday] ||= Date.parse("#{birthday[:year]}-#{birthday[:month]}-#{birthday[:day]}")
end
- search_flag = params[:person][:searchable]
- search_flag.to_s.match(/(true)/) ? search_flag = true : search_flag = false
- params[:person][:searchable] = search_flag
-
# upload and set new profile photo
if params[:person][:profile][:image].present?
raw_image = params[:person][:profile].delete(:image)
diff --git a/app/controllers/publics_controller.rb b/app/controllers/publics_controller.rb
index ae00cc7df..a5dd347e5 100644
--- a/app/controllers/publics_controller.rb
+++ b/app/controllers/publics_controller.rb
@@ -11,7 +11,7 @@ class PublicsController < ApplicationController
def hcard
@person = Person.find_by_id params[:id]
unless @person.nil? || @person.owner.nil?
- render 'hcard'
+ render 'publics/hcard'
else
render :nothing => true, :status => 404
end
diff --git a/app/models/person.rb b/app/models/person.rb
index 890b2a527..0fe6474aa 100644
--- a/app/models/person.rb
+++ b/app/models/person.rb
@@ -122,7 +122,10 @@ class Person
#hcard_profile = HCard.find profile.hcard.first[:href]
Rails.logger.info("hcard: #{ hcard.inspect}")
new_person.url = hcard[:url]
- new_person.profile = Profile.new(:first_name => hcard[:given_name], :last_name => hcard[:family_name], :image_url => hcard[:photo])
+ new_person.profile = Profile.new( :first_name => hcard[:given_name],
+ :last_name => hcard[:family_name],
+ :image_url => hcard[:photo],
+ :searchable => hcard[:searchable])
new_person.save! ? new_person : nil
end
diff --git a/app/views/publics/hcard.erb b/app/views/publics/hcard.erb
deleted file mode 100644
index c02d909b5..000000000
--- a/app/views/publics/hcard.erb
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
<%=@person.real_name%>
-
-
-
User profile
-
- - Nickname
- -
- <%= @person.real_name%>
-
-
-
- - First name
- -
- <%= @person.profile.first_name %>
-
-
-
- - Family name
- -
- <%= @person.profile.last_name %>
-
-
-
- - Full name
- -
- <%= @person.real_name %>
-
-
-
- - URL
- -
- <%= @person.url%>
-
-
-
- - Photo
- -
-
-
-
-
-
-
diff --git a/app/views/publics/hcard.haml b/app/views/publics/hcard.haml
new file mode 100644
index 000000000..869286964
--- /dev/null
+++ b/app/views/publics/hcard.haml
@@ -0,0 +1,40 @@
+#content
+ %h1= @person.real_name
+ #content_inner
+ #i.entity_profile.vcard.author
+ %h2 User profile
+
+ %dl.entity_nickname
+ %dt Nickname
+ %dd
+ %a.nickname.url.uid{:href=>@person.url, :rel=>'me'}= @person.real_name
+
+ %dl.entity_given_name
+ %dt First name
+ %dd
+ %span.given_name= @person.profile.first_name
+
+ %dl.entity_family_name
+ %dt Family name
+ %dd
+ %span.family_name= @person.profile.last_name
+
+ %dl.entity_fn
+ %dt Full name
+ %dd
+ %span.fn= @person.real_name
+
+ %dl.entity_url
+ %dt URL
+ %dd
+ %a#pod_location.url{:href=>@person.url, :rel=>'me'}= @person.url
+
+ %dl.entity_photo
+ %dt Photo
+ %dd
+ %img.photo.avatar{:src=>image_or_default(@person), :width=>'100px', :height=>'100px'}
+
+ %dl.entity_searchable
+ %dt Searchable
+ %dd
+ %span.searchable= @person.profile.searchable
diff --git a/lib/hcard.rb b/lib/hcard.rb
index d02e2b4ec..09acb7c8f 100644
--- a/lib/hcard.rb
+++ b/lib/hcard.rb
@@ -5,10 +5,11 @@
module HCard
def self.parse doc
{
- :given_name => doc.css(".given_name").text,
+ :given_name => doc.css(".given_name").text,
:family_name => doc.css(".family_name").text,
- :url => doc.css("#pod_location").text,
- :photo => doc.css(".photo[src]").attribute('src').text
+ :url => doc.css("#pod_location").text,
+ :photo => doc.css(".photo[src]").attribute('src').text,
+ :searchable => doc.css(".searchable").text
}
end
diff --git a/spec/fixtures/hcard_response b/spec/fixtures/hcard_response
index c3bfb2840..d229660d2 100644
--- a/spec/fixtures/hcard_response
+++ b/spec/fixtures/hcard_response
@@ -43,6 +43,12 @@
Note
Diaspora is awesome! vi is better than emacs!
+
+ - Searchable
+ -
+ false
+
+
diff --git a/spec/lib/hcard_spec.rb b/spec/lib/hcard_spec.rb
index 7228a1893..fbd4bb42c 100644
--- a/spec/lib/hcard_spec.rb
+++ b/spec/lib/hcard_spec.rb
@@ -12,6 +12,7 @@ describe HCard do
hcard[:family_name].include?("Hamiltom").should be true
hcard[:given_name].include?("Alex").should be true
hcard[:photo].include?("tom.jpg").should be true
- hcard[:url].should == "http://tom.joindiaspora.com/"
+ hcard[:url].should == "http://tom.joindiaspora.com/"
+ hcard[:searchable].should == "false"
end
end