sort contacts by last name on contacts page
This commit is contained in:
parent
a2609f7dac
commit
85da6d340f
3 changed files with 21 additions and 8 deletions
|
|
@ -12,10 +12,12 @@ class ContactsController < ApplicationController
|
|||
@my_contacts_count = current_user.contacts.receiving.count
|
||||
|
||||
unless params[:set] == "all"
|
||||
@contacts = current_user.contacts.receiving.includes(:aspects, :person => :profile).order('contacts.id DESC').paginate(:page => params[:page], :per_page => 25)
|
||||
@contacts = current_user.contacts.receiving.includes(:aspects, :person => :profile).order('profiles.last_name ASC').paginate(:page => params[:page], :per_page => 25)
|
||||
else
|
||||
@contacts = current_user.contacts.includes(:aspects, :person => :profile).order('contacts.id DESC').paginate(:page => params[:page], :per_page => 25)
|
||||
@contacts = current_user.contacts.includes(:aspects, :person => :profile).order('profiles.last_name ASC').paginate(:page => params[:page], :per_page => 25)
|
||||
end
|
||||
|
||||
@contacts_grouped = @contacts.group_by{|contact| contact.person.profile.last_name[0,1]}
|
||||
end
|
||||
|
||||
def sharing
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@
|
|||
%ul#aspect_sub_nav
|
||||
- for aspect in all_aspects
|
||||
%li
|
||||
= aspect
|
||||
= link_to aspect, contacts_path(:a_id => aspect)
|
||||
%li
|
||||
Add new aspect
|
||||
= link_to "Add new aspect", "#", :class => "add_new_aspect_link"
|
||||
|
||||
%li{:class => ("active" if params["set"] == "all")}
|
||||
|
||||
|
|
@ -35,7 +35,11 @@
|
|||
|
||||
.span-15
|
||||
#people_stream.stream
|
||||
- for contact in @contacts
|
||||
= render :partial => 'people/person', :locals => {:contact => contact, :person => contact.person}
|
||||
- @contacts_grouped.each do |letter, contacts|
|
||||
.right.letter
|
||||
%h1
|
||||
= letter
|
||||
- for contact in contacts
|
||||
= render :partial => 'people/person', :locals => {:contact => contact, :person => contact.person}
|
||||
|
||||
= will_paginate @contacts
|
||||
|
|
|
|||
|
|
@ -2978,7 +2978,7 @@ ul#left_nav
|
|||
:decoration none
|
||||
|
||||
li.active
|
||||
a
|
||||
> a
|
||||
:color #333
|
||||
:font
|
||||
:weight 700
|
||||
|
|
@ -3003,8 +3003,15 @@ ul#left_nav
|
|||
|
||||
ul#aspect_sub_nav
|
||||
:padding 0
|
||||
:left 20px
|
||||
:left 15px
|
||||
:margin 0
|
||||
:display none
|
||||
|
||||
#people_stream
|
||||
:position relative
|
||||
|
||||
.letter
|
||||
:right -80px
|
||||
h1
|
||||
:color #eee
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue