From 2ecd34a0897a67adc6043678b8e3888dbeca1a29 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Tue, 27 Jan 2009 14:33:29 -0300 Subject: [PATCH] ActionItem900: using a popup to confirm joining --- app/controllers/public/profile_controller.rb | 2 ++ app/views/blocks/profile_info_actions/community.rhtml | 2 +- app/views/profile/join.rhtml | 2 +- app/views/shared/join_community_popup.rhtml | 2 +- test/functional/profile_controller_test.rb | 9 +++++++++ 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/controllers/public/profile_controller.rb b/app/controllers/public/profile_controller.rb index 44c5ca8..0f4e4ad 100644 --- a/app/controllers/public/profile_controller.rb +++ b/app/controllers/public/profile_controller.rb @@ -48,6 +48,8 @@ class ProfileController < PublicController profile.add_member(current_user.person) flash[:notice] = _('%s administrator still needs to accept you as member.') % profile.name if profile.closed? redirect_to profile.url + else + render :layout => false end end diff --git a/app/views/blocks/profile_info_actions/community.rhtml b/app/views/blocks/profile_info_actions/community.rhtml index b4be4b2..3a2e8e5 100644 --- a/app/views/blocks/profile_info_actions/community.rhtml +++ b/app/views/blocks/profile_info_actions/community.rhtml @@ -7,7 +7,7 @@ <% else %>
  • - <%= link_to content_tag('span', _('Join')), { :profile => profile.identifier, :controller => 'profile', :action => 'join' }, :class => 'button with-text icon-add', :title => _('Join this community') %> + <%= lightbox_link_to content_tag('span', _('Join')), { :profile => profile.identifier, :controller => 'profile', :action => 'join' }, :class => 'button with-text icon-add', :title => _('Join this community') %>
  • <% end %> diff --git a/app/views/profile/join.rhtml b/app/views/profile/join.rhtml index ebd44b0..9920e9c 100644 --- a/app/views/profile/join.rhtml +++ b/app/views/profile/join.rhtml @@ -7,5 +7,5 @@ <% form_tag do %> <%= hidden_field_tag(:confirmation, 1) %> <%= submit_button(:ok, _("Yes, I want to join.") % profile.name) %> - <%= button(:cancel, _("No, I don't want."), :action => 'index') %> + <%= lightbox_close_button(_("No, I don't want."), :action => 'index') %> <% end %> diff --git a/app/views/shared/join_community_popup.rhtml b/app/views/shared/join_community_popup.rhtml index fdfcdd5..9e5bb47 100644 --- a/app/views/shared/join_community_popup.rhtml +++ b/app/views/shared/join_community_popup.rhtml @@ -2,7 +2,7 @@

    <%= __('Do you want to join this community?') %>

    <% button_bar do %> - <%= button(:ok, _('Yes'), :controller => 'profile', :action => 'join', :profile => profile.identifier) %> + <%= lightbox_button(:ok, _('Yes'), :controller => 'profile', :action => 'join', :profile => profile.identifier) %> <%= button_to_function(:cancel, _('Not now'), "$('join-community-popup').hide()") %> <%= button(:cancel, _('No and don\'t ask again'), :controller => 'profile', :action => 'refuse_join', :profile => profile.identifier) %> <% end %> diff --git a/test/functional/profile_controller_test.rb b/test/functional/profile_controller_test.rb index 496d1ff..17afd4c 100644 --- a/test/functional/profile_controller_test.rb +++ b/test/functional/profile_controller_test.rb @@ -63,6 +63,15 @@ class ProfileControllerTest < Test::Unit::TestCase assert_kind_of Array, assigns(:favorite_enterprises) end + should 'render join template without layout when not' do + community = Community.create!(:name => 'my test community') + login_as(@profile.identifier) + get :join, :profile => community.identifier + assert_response :success + assert_template 'join' + assert_no_tag :tag => 'html' + end + should 'show Join This Community button for non-member users' do login_as(@profile.identifier) community = Community.create!(:name => 'my test community') -- libgit2 0.21.2