DG MS cleaned up some of the request stuff
This commit is contained in:
parent
275e0baa0c
commit
b49f198c4f
6 changed files with 23 additions and 25 deletions
|
|
@ -2,7 +2,7 @@ class ApplicationController < ActionController::Base
|
|||
protect_from_forgery :except => :receive
|
||||
layout 'application'
|
||||
|
||||
before_filter :set_people
|
||||
before_filter :set_friends, :count_requests
|
||||
|
||||
layout :layout_by_resource
|
||||
|
||||
|
|
@ -14,8 +14,12 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
end
|
||||
|
||||
def set_people
|
||||
@people = Person.friends.all
|
||||
def set_friends
|
||||
@friends = Person.friends.all
|
||||
end
|
||||
|
||||
def count_requests
|
||||
@request_count = Request.for_user(current_user).size
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@ class RequestsController < ApplicationController
|
|||
before_filter :authenticate_user!
|
||||
include RequestsHelper
|
||||
def index
|
||||
@local_requests = Request.from_user( User.first )
|
||||
@remote_requests = Request.for_user( User.first )
|
||||
|
||||
@remote_requests = Request.for_user( current_user )
|
||||
@request = Request.new
|
||||
end
|
||||
|
||||
|
|
@ -12,7 +10,7 @@ class RequestsController < ApplicationController
|
|||
@request = Request.where(:id => params[:id]).first
|
||||
@request.destroy
|
||||
flash[:notice] = "Successfully destroyed person request."
|
||||
redirect_to person_requests_url
|
||||
redirect_to requests_url
|
||||
end
|
||||
|
||||
def new
|
||||
|
|
@ -23,7 +21,7 @@ class RequestsController < ApplicationController
|
|||
@request = current_user.send_friend_request_to(params[:request][:destination_url])
|
||||
|
||||
if @request
|
||||
flash[:notice] = "Successfully created person request."
|
||||
flash[:notice] = "a friend request was sent to #{@request.destination_url}"
|
||||
redirect_to requests_url
|
||||
else
|
||||
render :action => 'new'
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
- if user_signed_in?
|
||||
=User.first.real_name
|
||||
|
|
||||
= link_to "requests", requests_path
|
||||
= link_to "requests (#{@request_count})", requests_path
|
||||
|
|
||||
= link_to "logout", destroy_user_session_path
|
||||
- else
|
||||
|
|
@ -54,4 +54,5 @@
|
|||
%span.description
|
||||
= my_latest_message
|
||||
= yield
|
||||
.span-20
|
||||
= render "posts/debug"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
%h3 your people
|
||||
%ul#friend_stream.nav
|
||||
- for person in @people
|
||||
%li= link_to person.real_name, person_path(person)
|
||||
- for friend in @friends
|
||||
%li= link_to friend.real_name, person_path(friend)
|
||||
= link_to "add a new person", new_request_path
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
%li.message{:id => request.id, :class => "mine"}
|
||||
= "to : #{request.destination_url}"
|
||||
= request.person.class
|
||||
%li.message{:id => request.id}
|
||||
|
||||
= "from #{request.person.real_name}"
|
||||
= "#{request.destination_url}"
|
||||
|
||||
.destroy_link
|
||||
= link_to 'Ignore', request_path(request), :confirm => 'Are you sure?', :method => :delete, :remote => true
|
||||
= link_to 'Ignore', request_path(request), :confirm => 'Are you sure?', :method => :delete
|
||||
|
|
|
|||
|
|
@ -1,15 +1,9 @@
|
|||
%h1 requests
|
||||
= render "requests/new_request", :request => @request
|
||||
|
||||
%h3= "currently #{@request_count} requests"
|
||||
|
||||
%ul#stream
|
||||
%li
|
||||
%h3 incoming
|
||||
- for request in @remote_requests
|
||||
= render "request", :request => request
|
||||
= request.destination_url + " " + User.first.url
|
||||
|
||||
%li
|
||||
%h3 outgoing
|
||||
- for request in @local_requests
|
||||
- for request in @remote_requests
|
||||
= render "request", :request => request
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue