MS a couple of small bug fixes when updateing user profile....starting to attept friend index/search page
This commit is contained in:
parent
ff41277088
commit
84cc598017
7 changed files with 47 additions and 18 deletions
|
|
@ -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])
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
11
app/helpers/people_helper.rb
Normal file
11
app/helpers/people_helper.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
module PeopleHelper
|
||||
|
||||
def search_or_index
|
||||
if params[:q]
|
||||
" results for #{q}"
|
||||
else
|
||||
" people on this pod"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue