From 756278f49833424e44fa9089e728edfce09840e0 Mon Sep 17 00:00:00 2001 From: maxwell Date: Thu, 19 Aug 2010 12:37:34 -0700 Subject: [PATCH 1/3] MS added friend search, and allow for autodiscover --- app/controllers/users_controller.rb | 4 +++- app/helpers/people_helper.rb | 4 ++-- app/views/layouts/application.html.haml | 1 + app/views/users/index.html.haml | 16 +++++++++++++--- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 73e92d385..3596c26ed 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,9 +1,11 @@ class UsersController < ApplicationController before_filter :authenticate_user!, :except => [:new, :create] + def index - + puts "awesome" @groups_array = current_user.groups.collect{|x| [x.to_s, x.id]} + puts params.inspect unless params[:q] @people = Person.all render :index diff --git a/app/helpers/people_helper.rb b/app/helpers/people_helper.rb index 60c971f47..fd9ff371c 100644 --- a/app/helpers/people_helper.rb +++ b/app/helpers/people_helper.rb @@ -2,10 +2,10 @@ module PeopleHelper def search_or_index if params[:q] - " results for #{q}" + " results for #{params[:q]}" else " people on this pod" end end -end \ No newline at end of file +end diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 006872e5b..da2b73eb8 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -38,6 +38,7 @@ %li.name= link_to current_user.real_name, current_user.person %li= link_to "requests (#{@request_count})", requests_path, :class => new_request(@request_count) %li= link_to "settings", edit_user_path(current_user) + %li= link_to "search", users_path %li= link_to "logout", destroy_user_session_path - else = link_to "login", new_user_session_path diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml index 3f0d01435..9eee6b7d1 100644 --- a/app/views/users/index.html.haml +++ b/app/views/users/index.html.haml @@ -1,17 +1,26 @@ -= (@people.count-1).to_s + search_or_index +%p + =form_tag '/users', :method => "get" do + = text_field_tag :q + = submit_tag "search" + = link_to "reset", users_path + += (@people.count).to_s + search_or_index %table %tr %th real name %th email %th url - - for person in @people - - unless person.id == current_user.person.id + - for person in @people %tr %td= person.real_name %td= person.email %td= person.url -if current_user.friends.include? person + + - elsif person.id == current_user.person.id + %td + %td thats you! -elsif current_user.pending_requests.find_by_person_id(person.id) %td %td ^-you have a friend request from this person @@ -19,6 +28,7 @@ %td %td friend request pending -else + %td %td = form_for Request.new do |f| = f.select(:group_id, @groups_array) From 35f685638024294cf779ee21f493894de34e0f60 Mon Sep 17 00:00:00 2001 From: maxwell Date: Thu, 19 Aug 2010 12:40:50 -0700 Subject: [PATCH 2/3] MS search and index works --- app/controllers/users_controller.rb | 2 -- app/views/users/index.html.haml | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 3596c26ed..c7e2979b1 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2,10 +2,8 @@ class UsersController < ApplicationController before_filter :authenticate_user!, :except => [:new, :create] def index - puts "awesome" @groups_array = current_user.groups.collect{|x| [x.to_s, x.id]} - puts params.inspect unless params[:q] @people = Person.all render :index diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml index 9eee6b7d1..3f14d8ce3 100644 --- a/app/views/users/index.html.haml +++ b/app/views/users/index.html.haml @@ -33,4 +33,4 @@ = form_for Request.new do |f| = f.select(:group_id, @groups_array) = f.hidden_field :destination_url, :value => person.email - = f.submit + = f.submit "add friend" From 36b2445a1135d1f442d0e9e6147fbfe34264fb7e Mon Sep 17 00:00:00 2001 From: danielvincent Date: Thu, 19 Aug 2010 13:41:48 -0700 Subject: [PATCH 3/3] added title to search page --- app/views/users/edit.html.haml | 12 ++++++------ app/views/users/index.html.haml | 6 ++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/views/users/edit.html.haml b/app/views/users/edit.html.haml index 670739246..e4c884d83 100644 --- a/app/views/users/edit.html.haml +++ b/app/views/users/edit.html.haml @@ -1,11 +1,11 @@ +%h1.big_text + .back + = link_to "⇧ home", root_path + + Editing your profile + = form_for @user do |f| - %h1.big_text - .back - = link_to "⇧ home", root_path - - Editing your profile - = f.error_messages diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml index 3f14d8ce3..bbd50ddd0 100644 --- a/app/views/users/index.html.haml +++ b/app/views/users/index.html.haml @@ -1,3 +1,9 @@ +%h1.big_text + .back + = link_to "⇧ home", root_path + + Search + %p =form_tag '/users', :method => "get" do = text_field_tag :q