Skip to content

Commit

Permalink
copy in manage page by clicking 'add a new friend' for now
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgrippi committed Oct 28, 2010
1 parent 6626b00 commit a0d83e2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions app/controllers/aspects_controller.rb
Expand Up @@ -47,7 +47,6 @@ def destroy

def show
@aspect = current_user.aspect_by_id params[:id]
@friends_not_in_aspect = current_user.friends_not_in_aspect(@aspect)
unless @aspect
render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404
else
Expand Down Expand Up @@ -90,7 +89,11 @@ def add_to_aspect
flash[:error] = I18n.t 'aspects.add_to_aspect.failure'
end

redirect_to aspect_path(params[:aspect_id])
if params[:manage]
redirect_to aspects_manage_path
else
redirect_to aspect_path(params[:aspect_id])
end
end

def remove_from_aspect
Expand Down
2 changes: 1 addition & 1 deletion app/views/aspects/manage.html.haml
Expand Up @@ -67,6 +67,6 @@

.fancybox_content
%div{:id => "add_request_pane_#{aspect.id}"}
= render "requests/new_request", :aspect => aspect
= render "requests/new_request", :aspect => aspect, :manage => true


5 changes: 3 additions & 2 deletions app/views/requests/_new_request.haml
Expand Up @@ -8,8 +8,7 @@
=t('.add_a_new_friend_to')
%i= aspect.name

- if @friends_not_in_aspect
= render('shared/add_friend_dropdown', :aspect => aspect, :friends => @friends_not_in_aspect)
= render 'shared/add_friend_dropdown', :aspect => aspect, :friends => current_user.friends_not_in_aspect(aspect), :manage => defined?(manage)

= form_for Request.new do |fr_request|
= fr_request.error_messages
Expand All @@ -25,6 +24,8 @@

- if defined?(getting_started)
= hidden_field_tag :getting_started, getting_started
- if defined?(manage)
= hidden_field_tag :manage, true

= fr_request.submit

2 changes: 2 additions & 0 deletions app/views/shared/_add_friend_dropdown.html.haml
Expand Up @@ -2,4 +2,6 @@
= form_tag '/aspects/add_to_aspect', :id => 'add_to_aspect' do
= select_tag :friend_id, options_from_collection_for_select(friends, "id", "real_name"), :include_blank => true
= hidden_field_tag :aspect_id, aspect.id
- if defined?(manage)
= hidden_field_tag :manage, true
= submit_tag "add to #{aspect.name}"

0 comments on commit a0d83e2

Please sign in to comment.