From 9d98afb94fcbf0db4243923e8ff7605b85cafaec Mon Sep 17 00:00:00 2001 From: danielvincent Date: Tue, 23 Nov 2010 09:44:58 -0800 Subject: [PATCH 1/4] took out fade on photos#index, because it only displayed all photos half the time. --- app/views/photos/_index.html.haml | 9 --------- public/javascripts/view.js | 4 ---- public/stylesheets/sass/application.sass | 1 - 3 files changed, 14 deletions(-) diff --git a/app/views/photos/_index.html.haml b/app/views/photos/_index.html.haml index 3660266fa..abb59d855 100644 --- a/app/views/photos/_index.html.haml +++ b/app/views/photos/_index.html.haml @@ -2,15 +2,6 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. - -=content_for(:head) do - :javascript - $(document).ready(function(){ - $(".image_thumb img").load( function() { - $(this).fadeIn("slow"); - }); - }); - .span-15.last #thumbnails - for photo in photos diff --git a/public/javascripts/view.js b/public/javascripts/view.js index f6a7af982..653d1a1e1 100644 --- a/public/javascripts/view.js +++ b/public/javascripts/view.js @@ -27,10 +27,6 @@ $(document).ready(function(){ $("input[type='submit']").addClass("button"); - $(".image_cycle img").load( function() { - $(this).fadeIn("slow"); - }); - $("#q").focus( function() { $(this).addClass('active'); diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 058395e4c..cada73ff0 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -1009,7 +1009,6 @@ h1.big_text :min-height 100px img - :display none :height 100px :width 100px From ebaf2c081e3930f08bdf5b50a0821b337cae70c3 Mon Sep 17 00:00:00 2001 From: zhitomirskiyi Date: Tue, 23 Nov 2010 10:02:01 -0800 Subject: [PATCH 2/4] returning nothing on empty query and limit the returning of the query to 90 --- app/models/person.rb | 8 ++++---- spec/models/person_spec.rb | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/models/person.rb b/app/models/person.rb index 62cc5759b..f0da52941 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -50,7 +50,7 @@ class Person attr_accessible :profile def self.search(query) - return Person.searchable.all if query.to_s.empty? + return [] if query.to_s.empty? query_tokens = query.to_s.strip.split(" ") full_query_text = Regexp.escape(query.to_s.strip) @@ -58,9 +58,9 @@ class Person query_tokens.each do |token| q = Regexp.escape(token.to_s.strip) - p = Person.searchable.all('profile.first_name' => /^#{q}/i) \ - | Person.searchable.all('profile.last_name' => /^#{q}/i) \ - | Person.searchable.all('diaspora_handle' => /^#{q}/i) \ + p = Person.searchable.all('profile.first_name' => /^#{q}/i, 'limit' => 30) \ + | Person.searchable.all('profile.last_name' => /^#{q}/i, 'limit' => 30) \ + | Person.searchable.all('diaspora_handle' => /^#{q}/i, 'limit' => 30) \ | p end diff --git a/spec/models/person_spec.rb b/spec/models/person_spec.rb index d7aa61fb9..061c78ace 100644 --- a/spec/models/person_spec.rb +++ b/spec/models/person_spec.rb @@ -164,6 +164,11 @@ describe Person do @connected_person_four.save end + it 'should return nothing on an emprty query' do + people = Person.search("") + people.empty?.should be true + end + it 'should yield search results on partial names' do people = Person.search("Eu") people.include?(@connected_person_two).should == true From 5e8606169d90a93827534acd03d66229986a665b Mon Sep 17 00:00:00 2001 From: danielvincent Date: Tue, 23 Nov 2010 10:55:31 -0800 Subject: [PATCH 3/4] rolling back twitter gem to 0.9.12 release. --- Gemfile | 3 ++- Gemfile.lock | 18 +++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Gemfile b/Gemfile index 5a7b85388..9820f47e9 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,8 @@ gem 'devise_invitable','0.3.5' #Authentication gem 'omniauth' -gem 'twitter' +gem 'twitter', '0.9.12' + #Mongo gem 'mongo_mapper', :branch => 'rails3', :git => 'git://github.com/jnunemaker/mongomapper.git' gem 'bson_ext', '1.1' diff --git a/Gemfile.lock b/Gemfile.lock index d255fbdbe..369cc6a3b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -176,8 +176,6 @@ GEM addressable (~> 2.2.2) multipart-post (~> 1.0.1) rack (>= 1.1.0, < 2) - faraday_middleware (0.3.0) - faraday (~> 0.5.3) fastercsv (1.5.3) fastthread (1.0.7) ffi (0.6.3) @@ -190,6 +188,8 @@ GEM hashie (0.4.0) highline (1.6.1) http_connection (1.4.0) + httparty (0.6.1) + crack (= 0.1.8) i18n (0.4.2) jammit (0.5.4) closure-compiler (>= 0.1.0) @@ -224,7 +224,6 @@ GEM fastthread (>= 1.0.1) gem_plugin (>= 0.2.3) multi_json (0.0.5) - multi_xml (0.2.0) multipart-post (1.0.1) net-ldap (0.1.1) nokogiri (1.4.3.1) @@ -328,7 +327,6 @@ GEM ffi (~> 0.6.3) json_pure rubyzip - simple_oauth (0.1.2) subexec (0.0.4) systemu (1.2.0) term-ansicolor (1.0.5) @@ -339,13 +337,11 @@ GEM thor (0.14.6) treetop (1.4.9) polyglot (>= 0.3.1) - twitter (1.0.0) - faraday (~> 0.5.3) - faraday_middleware (~> 0.3.0) + twitter (0.9.12) hashie (~> 0.4.0) - multi_json (~> 0.0.5) - multi_xml (~> 0.2.0) - simple_oauth (~> 0.1.2) + httparty (~> 0.6.1) + multi_json (~> 0.0.4) + oauth (~> 0.4.3) tzinfo (0.3.23) uuidtools (2.1.1) warden (0.10.7) @@ -400,6 +396,6 @@ DEPENDENCIES rspec-rails (>= 2.0.0) ruby-debug thin - twitter + twitter (= 0.9.12) webmock will_paginate (= 3.0.pre2) From 3f737116d6576f80fb29409de03b249160d8f0f0 Mon Sep 17 00:00:00 2001 From: zhitomirskiyi Date: Tue, 23 Nov 2010 11:02:17 -0800 Subject: [PATCH 4/4] since there is only one person with that name in the db, it returns a redirect --- spec/controllers/people_controller_spec.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/spec/controllers/people_controller_spec.rb b/spec/controllers/people_controller_spec.rb index d73963caf..d3b5a909f 100644 --- a/spec/controllers/people_controller_spec.rb +++ b/spec/controllers/people_controller_spec.rb @@ -28,18 +28,16 @@ describe PeopleController do it 'shows a contact' do user2 = make_user connect_users(user, aspect, user2, user2.aspects.create(:name => 'Neuroscience')) - get :index + get :index, :q => user2.person.profile.first_name.to_s assigns[:people].should include user2.person - response.should be_success end it 'shows a non-contact' do user2 = make_user user2.person.profile.searchable = true user2.save - get :index + get :index, :q => user2.person.profile.first_name.to_s assigns[:people].should include user2.person - response.should be_success end it "redirects to person page if there is exactly one match" do