app/controllers/entities/contacts_controller.rb
def redraw
    current_user.pref[:contacts_per_page] = per_page_param if per_page_param

    # Sorting and naming only: set the same option for Leads if the hasn't been set yet.
    if params[:sort_by]
      current_user.pref[:contacts_sort_by] = Contact.sort_by_map[params[:sort_by]]
      current_user.pref[:leads_sort_by] ||= Lead.sort_by_map[params[:sort_by]] if Lead.sort_by_fields.include?(params[:sort_by])
    end
    if params[:naming]
      current_user.pref[:contacts_naming] = params[:naming]
      current_user.pref[:leads_naming] ||= params[:naming]
    end

    @contacts = get_contacts(page: 1, per_page: per_page_param) # Start on the first page.
    set_options # Refresh options

    respond_with(@contacts) do |format|
      format.js { render :index }
    end
  end
# GET /contacts/redraw                                                   AJAX
#----------------------------------------------------------------------------
GET /contacts/redraw                                                   AJAX
GET / contacts / redraw AJAX
def redraw
    current_user.pref[:contacts_per_page] = per_page_param if per_page_param
    if params[:sort_by]
      current_user.pref[:contacts_sort_by] = Contact.sort_by_map[params[:sort_by]]
      current_user.pref[:leads_sort_by] ||= Lead.sort_by_map[params[:sort_by]] if Lead.sort_by_fields.include?(params[:sort_by])
    end
    if params[:naming]
      current_user.pref[:contacts_naming] = params[:naming]
      current_user.pref[:leads_naming] ||= params[:naming]
    end
    @contacts = get_contacts(page: 1, per_page: per_page_param) 
    set_options 
    respond_with(@contacts) do |format|
      format.js { render :index }
    end
  end
def redraw current_user . pref [ :contacts_per_page ] = per_page_param if per_page_param if params [ :sort_by ] current_user . pref [ :contacts_sort_by ] = Contact . sort_by_map [ params [ :sort_by ] ] current_user . pref [ :leads_sort_by ] ||= Lead . sort_by_map [ params [ :sort_by ] ] if Lead . sort_by_fields . include? ( params [ :sort_by ] ) end if params [ :naming ] current_user . pref [ :contacts_naming ] = params [ :naming ] current_user . pref [ :leads_naming ] ||= params [ :naming ] end @contacts = get_contacts ( page : 1 , per_page : per_page_param ) set_options respond_with ( @contacts ) do | format | format . js { render :index } end end
GET /contacts/redraw                                                   AJAX
GET / contacts / redraw AJAX
# Sorting and naming only: set the same option for Leads if the hasn't been set yet. # Start on the first page. # Refresh options