fixing conflicts in merge

This commit is contained in:
Steven Fuchs 2012-03-07 20:57:26 -05:00
parent 8344422aef
commit 7048fa6d50
6 changed files with 36 additions and 16 deletions

View file

@ -46,15 +46,16 @@ class PeopleController < ApplicationController
def refresh_search def refresh_search
@aspect = :search @aspect = :search
@people = Person.where(:diaspora_handle => search_query.downcase) @people = Person.where(:diaspora_handle => search_query.downcase)
@people = @people.paginate(:page => params[:page], :per_page => 15)
@hashes = hashes_for_people(@people, @aspects)
@answer_html = "" @answer_html = ""
unless @people.empty?
@people = @people.paginate(:page => params[:page], :per_page => 15)
@hashes = hashes_for_people(@people, @aspects)
self.formats = self.formats + [:html] self.formats = self.formats + [:html]
@hashes.each do |hash| @hashes.each do |hash|
@answer_html += render_to_string :partial => 'people/person', :locals => hash @answer_html += render_to_string :partial => 'people/person', :locals => hash
end
end end
render :json => { :search_count => @people.count, :search_html => @answer_html }.to_json render :json => { :search_count => @people.count, :search_html => @answer_html }.to_json
end end

View file

@ -18,13 +18,14 @@
.span-15.append-1 .span-15.append-1
#people_stream.stream #people_stream.stream
- if @hashes.empty? - if @hashes.empty?
%p#not_found{:class => @background_query.nil? ? "" : "hidden" } - if @background_query.present?
=t('.no_one_found') %p
%p#searching{:class => @background_query.nil? ? "hidden" : "" } =t('.searching')
=t('.searching')
- if ! @background_query.nil?
:javascript :javascript
$(document).ready(function() { setTimeout("runDelayedSearch('#{@background_query}')", 10000); }); $(document).ready(function() { setTimeout("runDelayedSearch('#{@background_query}')", 10000); });
- else
%p
=t('.no_one_found')
- else - else
- for hash in @hashes - for hash in @hashes
= render :partial => 'people/person', :locals => hash = render :partial => 'people/person', :locals => hash

View file

@ -29,8 +29,8 @@ en:
my_stream: "Stream" my_stream: "Stream"
videos: videos:
watch: "Watch this video on <%= provider %>" watch: "Watch this video on <%= provider %>"
unknown: "Unknown video type" unknown: "Unknown video type"
search_for: "Search for <%= name %>" search_for: "Search for <%= name %>"
publisher: publisher:
at_least_one_aspect: "You must publish to at least one aspect" at_least_one_aspect: "You must publish to at least one aspect"
@ -73,6 +73,8 @@ en:
looking_good: "OMG, you look awesome!" looking_good: "OMG, you look awesome!"
tags: tags:
wasnt_that_interesting: "OK, I suppose #<%= tagName %> wasn't all that interesting..." wasnt_that_interesting: "OK, I suppose #<%= tagName %> wasn't all that interesting..."
people:
not_found: "and no one was found..."
stream: stream:
hide: "Hide" hide: "Hide"

View file

@ -20,7 +20,6 @@ function handleSearchRefresh(data) {
if ( data.search_count > 0 ) { if ( data.search_count > 0 ) {
$("#people_stream.stream").html( data.search_html ); $("#people_stream.stream").html( data.search_html );
} else { } else {
$("p#not_found").removeClass( 'hidden' ); $("#people_stream.stream").html( "<p>" + Diaspora.I18n.t("people.not_found") + "</p>" );
$("p#searching").addClass( 'hidden' );
} }
} }

View file

@ -0,0 +1,18 @@
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require 'spec_helper'
describe PeopleController do
describe '#index' do
before do
sign_in :user, bob
end
it "generates a jasmine fixture", :fixture => true do
get :index
save_fixture(html_for("body"), "empty_people_search")
end
end
end

View file

@ -373,7 +373,6 @@ describe PeopleController do
end end
it 'returns with a found name' do it 'returns with a found name' do
get :refresh_search, :q => @korth.diaspora_handle get :refresh_search, :q => @korth.diaspora_handle
puts JSON.parse( response.body ).inspect
JSON.parse( response.body )["search_count"].should == 1 JSON.parse( response.body )["search_count"].should == 1
end end
end end