From 44b77c58a3709ca003367f440e9ba3580ffafe71 Mon Sep 17 00:00:00 2001
From: danielgrippi <danielgrippi@gmail.com>
Date: Mon, 27 Jun 2011 16:26:54 -0700
Subject: [PATCH] just have a remove from aspect icon when viewing an aspect in
 contacts index

---
 .../aspect_memberships_controller.rb          |  7 +++++
 app/controllers/contacts_controller.rb        |  3 ++-
 app/views/contacts/index.html.haml            | 26 +++++++++++--------
 public/stylesheets/sass/application.sass      |  7 +++++
 4 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/app/controllers/aspect_memberships_controller.rb b/app/controllers/aspect_memberships_controller.rb
index 72631232b2..df33c15fd6 100644
--- a/app/controllers/aspect_memberships_controller.rb
+++ b/app/controllers/aspect_memberships_controller.rb
@@ -20,6 +20,13 @@ class AspectMembershipsController < ApplicationController
 
         flash.now[:notice] = I18n.t 'aspect_memberships.destroy.success'
 
+        respond_to do |format|
+          format.all {}
+          format.html{
+            redirect_to :back
+          }
+        end
+
       else
         flash.now[:error] = I18n.t 'aspect_memberships.destroy.failure'
         errors = membership ? membership.errors.full_messages : t('aspect_memberships.destroy.no_membership')
diff --git a/app/controllers/contacts_controller.rb b/app/controllers/contacts_controller.rb
index 74ad899f8d..16252cc6aa 100644
--- a/app/controllers/contacts_controller.rb
+++ b/app/controllers/contacts_controller.rb
@@ -12,7 +12,8 @@ class ContactsController < ApplicationController
     @my_contacts_count = current_user.contacts.receiving.count
 
     if params["a_id"]
-      @contacts = current_user.aspects.find(params["a_id"]).contacts.includes(:aspects, :person => :profile).order('profiles.last_name ASC').paginate(:page => params[:page], :per_page => 25)
+      @aspect_ = current_user.aspects.find(params["a_id"])
+      @contacts = @aspect_.contacts.includes(:aspects, :person => :profile).order('profiles.last_name ASC').paginate(:page => params[:page], :per_page => 25)
     elsif params[:set] != "all"
       @contacts = current_user.contacts.receiving.includes(:aspects, :person => :profile).order('profiles.last_name ASC').paginate(:page => params[:page], :per_page => 25)
     else
diff --git a/app/views/contacts/index.html.haml b/app/views/contacts/index.html.haml
index 3a0b8430db..91f018dbeb 100644
--- a/app/views/contacts/index.html.haml
+++ b/app/views/contacts/index.html.haml
@@ -5,14 +5,6 @@
 
 :javascript
   $(document).ready(function(){
-    $("#people_stream").infinitescroll({
-      navSelector  : ".pagination",
-      nextSelector : ".next_page",
-      itemSelector : ".stream_element",
-      loadingText: "",
-      loadingImg: '/images/ajax-loader.gif',
-      bufferPx: 400
-    });
   });
 
 - content_for :page_title do
@@ -53,9 +45,21 @@
 
         .stream_element{:id => contact.person.id}
           .right
-            = render :partial => 'people/relationship_action',
-                     :locals => { :person => contact.person, :contact => contact,
-                                  :current_user => current_user }
+            - if @aspect_
+              = link_to(image_tag('/images/icons/monotone_close_exit_delete.png', :height => 20, :width => 20),
+                  {:controller => "aspect_memberships",
+                    :action => 'destroy',
+                    :id => 42,
+                    :aspect_id => @aspect_.id,
+                    :person_id => contact.person.id},
+                  :title => "Remove #{contact.person.first_name} from \"#{@aspect_.name}\"",
+                  :method => 'delete')
+
+            - else 
+              = render :partial => 'people/relationship_action',
+                       :locals => { :person => contact.person, :contact => contact,
+                                    :current_user => current_user }
+
           = person_image_link(contact.person)
           .content
             %span.from
diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass
index 9a4b607f21..c31cb4c2f9 100644
--- a/public/stylesheets/sass/application.sass
+++ b/public/stylesheets/sass/application.sass
@@ -3031,6 +3031,13 @@ ul#left_nav
     :min-height 30px
     .right
       :top 16px
+
+      a
+        @include opacity(0.3)
+
+        &:hover
+          @include opacity(1)
+
     .from
       :position relative
       a
-- 
GitLab