From 14759b2c80f835c4f65bed739a6024f0ee4cb161 Mon Sep 17 00:00:00 2001
From: Raphael Sofaer <raphael@joindiaspora.com>
Date: Tue, 12 Jul 2011 16:20:54 -0700
Subject: [PATCH] Use person_link in notifications_helper, move hovercard css
 out to a file

---
 app/helpers/notifications_helper.rb        |  4 +-
 config/assets.yml                          |  1 +
 public/stylesheets/sass/application.sass   | 74 +---------------------
 public/stylesheets/sass/hovercard.sass     | 74 ++++++++++++++++++++++
 spec/controllers/people_controller_spec.rb |  1 +
 5 files changed, 80 insertions(+), 74 deletions(-)
 create mode 100644 public/stylesheets/sass/hovercard.sass

diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb
index 66c69d898f..869fa6fc86 100644
--- a/app/helpers/notifications_helper.rb
+++ b/app/helpers/notifications_helper.rb
@@ -56,7 +56,9 @@ module NotificationsHelper
     actors =people || note.actors
     number_of_actors = actors.count
     sentence_translations = {:two_words_connector => " #{t('notifications.index.and')} ", :last_word_connector => ", #{t('notifications.index.and')} " }
-    actor_links = actors.collect{ |person| link_to("#{h(person.name.titlecase.strip)}", person_path(person), :class => ('hovercardable' if defined?(user_signed_in?) && user_signed_in? && current_user.person != person))}
+    actor_links = actors.collect{ |person|
+      person_link(person, :class => 'hovercardable', :what => 'thefuck' )
+    }
 
     if number_of_actors < 4
       message = actor_links.to_sentence(sentence_translations)
diff --git a/config/assets.yml b/config/assets.yml
index 969d1b2993..67240f263c 100644
--- a/config/assets.yml
+++ b/config/assets.yml
@@ -87,6 +87,7 @@ stylesheets:
     - public/stylesheets/lightbox.css
     - public/stylesheets/autocomplete.css
     - public/stylesheets/tags.css
+    - public/stylesheets/hovercard.css
     - public/stylesheets/vendor/facebox.css
     - public/stylesheets/vendor/fileuploader.css
     - public/stylesheets/vendor/tipsy.css
diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass
index 5435bf321c..048cfff99e 100644
--- a/public/stylesheets/sass/application.sass
+++ b/public/stylesheets/sass/application.sass
@@ -3078,7 +3078,7 @@ ul.left_nav
     :padding 10px 
     :min-height 30px
 
-    img
+    > img
       :height 30px
       :width 30px
       :float left
@@ -3119,75 +3119,3 @@ ul.left_nav
   :margin
     :top 30px
 
-#hovercard
-  @include border-radius(2px)
-  @include box-shadow(0,0,5px,#666)
-
-  :position relative
-
-  .avatar
-    :position relative
-    :height 70px
-    :width 70px
-    :margin
-      :right 10px
-      :left 0
-    :top 0 !important
-
-  :background
-    :color $background
-
-  :height 70px
-
-  :padding 5px
-    :bottom 25px
-
-  :border 1px solid #999
-  :width 220px
-
-  h4
-    :margin
-      :bottom 10px
-  a
-    :color $blue
-    :font
-      :weight bold !important
-
-  .hovercard_footer
-    :position absolute
-    :bottom 0
-    :left 0
-    :background
-      :color #eee
-    :width 100%
-
-    :min-height 19px
-
-    :font
-      :size smaller
-
-    :border
-      :top 1px solid #ccc
-
-    .footer_container
-      :padding 1px 5px
-
-      .hashtags
-        :overflow hidden
-        :white-space nowrap
-        :text-overflow ellipsis
-
-      a
-        :color #999
-        :margin
-          :right 4px
-        :font
-          :weight normal
-
-#hovercard_container
-  :padding 10px
-    :top 5px
-  :position absolute
-  :display none
-  :z-index 10
-
diff --git a/public/stylesheets/sass/hovercard.sass b/public/stylesheets/sass/hovercard.sass
new file mode 100644
index 0000000000..34293614ec
--- /dev/null
+++ b/public/stylesheets/sass/hovercard.sass
@@ -0,0 +1,74 @@
+@import 'mixins'
+
+#hovercard
+  @include border-radius(2px)
+  @include box-shadow(0,0,5px,#666)
+
+  :position relative
+
+  .avatar
+    :position relative
+    :height 70px 
+    :width 70px 
+    :margin
+      :right 10px
+      :left 0
+    :top 0 !important
+
+  :background
+    :color $background
+
+  :height 70px
+
+  :padding 5px
+    :bottom 25px
+
+  :border 1px solid #999
+  :width 220px
+
+  h4
+    :margin
+      :bottom 10px
+  a
+    :color $blue
+    :font
+      :weight bold !important
+
+  .hovercard_footer
+    :position absolute
+    :bottom 0
+    :left 0
+    :background
+      :color #eee
+    :width 100%
+
+    :min-height 19px
+
+    :font
+      :size smaller
+
+    :border
+      :top 1px solid #ccc
+
+    .footer_container
+      :padding 1px 5px
+
+      .hashtags
+        :overflow hidden
+        :white-space nowrap
+        :text-overflow ellipsis
+
+      a
+        :color #999
+        :margin
+          :right 4px
+        :font
+          :weight normal
+
+#hovercard_container
+  :padding 10px
+    :top 5px
+  :position absolute
+  :display none
+  :z-index 10
+
diff --git a/spec/controllers/people_controller_spec.rb b/spec/controllers/people_controller_spec.rb
index fa7e4d4ef5..eadac9b600 100644
--- a/spec/controllers/people_controller_spec.rb
+++ b/spec/controllers/people_controller_spec.rb
@@ -296,6 +296,7 @@ describe PeopleController do
       contacts = contact.contacts
       get :contacts, :person_id => bob.person.id
       assigns(:contacts_of_contact).should == contacts
+      response.should be_success
     end
   end
 
-- 
GitLab