diff --git a/app/controllers/requests_controller.rb b/app/controllers/requests_controller.rb index ae274c142..b6b3dc822 100644 --- a/app/controllers/requests_controller.rb +++ b/app/controllers/requests_controller.rb @@ -31,6 +31,7 @@ class RequestsController < ApplicationController end def create + puts params.inspect rel_hash = relationship_flow(params[:request][:destination_url]) Rails.logger.debug("Sending request: #{rel_hash}") @request = current_user.send_request(rel_hash, params[:request][:group]) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 5d407e724..10db48c04 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,5 +1,13 @@ class UsersController < ApplicationController before_filter :authenticate_user!, :except => [:new, :create] + def index + unless params[:q] + @people = Person.all + render :index + else + @people = Person.search(params[:q]) + end + end def show @user= User.first(:id => params[:id]) @@ -16,12 +24,13 @@ class UsersController < ApplicationController @user = User.where(:id => params[:id]).first if @user.update_profile(params[:user]) - flash[:notice] = "Successfully updated user." - redirect_to @user + flash[:notice] = "Successfully updated your profile" + redirect_to @user.person else render :action => 'edit' end end + end diff --git a/app/helpers/people_helper.rb b/app/helpers/people_helper.rb new file mode 100644 index 000000000..60c971f47 --- /dev/null +++ b/app/helpers/people_helper.rb @@ -0,0 +1,11 @@ +module PeopleHelper + + def search_or_index + if params[:q] + " results for #{q}" + else + " people on this pod" + end + + end +end \ No newline at end of file diff --git a/app/helpers/requests_helper.rb b/app/helpers/requests_helper.rb index 37a5485c4..c0320c0b8 100644 --- a/app/helpers/requests_helper.rb +++ b/app/helpers/requests_helper.rb @@ -29,6 +29,7 @@ module RequestsHelper action = :none url = nil local_person = Person.by_webfinger identifier + puts local_person.inspect if local_person action = (local_person == current_user.person ? :none : :friend) url = local_person.receive_url diff --git a/app/views/people/index.html.haml b/app/views/people/index.html.haml index cfc12dcc9..8b7b488ec 100644 --- a/app/views/people/index.html.haml +++ b/app/views/people/index.html.haml @@ -1,10 +1,10 @@ -%h1.big_text - .back - = link_to '⇧ home', root_path - Friends - .button.right - = link_to 'Add Friend', requests_path - +/ %h1.big_text +/ .back +/ = link_to '⇧ home', root_path +/ Friends +/ .button.right +/ = link_to 'Add Friend', requests_path += @people.count.to_s + search_or_index %table %tr %th real name diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml index 6f210359c..6975a8054 100644 --- a/app/views/users/index.html.haml +++ b/app/views/users/index.html.haml @@ -1,12 +1,19 @@ -- title "Users" - += @people.count.to_s + search_or_index %table %tr - %th Real Name + %th real name %th email - %th Password - - for user in @users + %th url + - for person in @people %tr - %td= user.real_name - %td= user.email - %td= user.encrypted_password + %td= person.real_name + %td= person.email + %td= person.url + %td + %select{ :class => "group_selector", :style=>"display:inline;"} + %option Add to group + %option + - for group in current_user.groups + %option{:value => group.id}= group.name + + %td= link_to "add as friend", requests_path(:request => {:destination_url => person.email}), :class => "submit", :method => "post" \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 84260a456..3e58008fe 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,6 @@ Diaspora::Application.routes.draw do resources :people - resources :users, :only => [:edit, :show, :update] + resources :users #, :only => [:edit, :show, :update] resources :status_messages resources :comments resources :requests