Commit 2ecd34a0897a67adc6043678b8e3888dbeca1a29

Authored by Antonio Terceiro
1 parent 091011fb

ActionItem900: using a popup to confirm joining

app/controllers/public/profile_controller.rb
... ... @@ -48,6 +48,8 @@ class ProfileController < PublicController
48 48 profile.add_member(current_user.person)
49 49 flash[:notice] = _('%s administrator still needs to accept you as member.') % profile.name if profile.closed?
50 50 redirect_to profile.url
  51 + else
  52 + render :layout => false
51 53 end
52 54 end
53 55  
... ...
app/views/blocks/profile_info_actions/community.rhtml
... ... @@ -7,7 +7,7 @@
7 7 </li>
8 8 <% else %>
9 9 <li>
10   - <%= link_to content_tag('span', _('Join')), { :profile => profile.identifier, :controller => 'profile', :action => 'join' }, :class => 'button with-text icon-add', :title => _('Join this community') %>
  10 + <%= lightbox_link_to content_tag('span', _('Join')), { :profile => profile.identifier, :controller => 'profile', :action => 'join' }, :class => 'button with-text icon-add', :title => _('Join this community') %>
11 11 </li>
12 12 <% end %>
13 13  
... ...
app/views/profile/join.rhtml
... ... @@ -7,5 +7,5 @@
7 7 <% form_tag do %>
8 8 <%= hidden_field_tag(:confirmation, 1) %>
9 9 <%= submit_button(:ok, _("Yes, I want to join.") % profile.name) %>
10   - <%= button(:cancel, _("No, I don't want."), :action => 'index') %>
  10 + <%= lightbox_close_button(_("No, I don't want."), :action => 'index') %>
11 11 <% end %>
... ...
app/views/shared/join_community_popup.rhtml
... ... @@ -2,7 +2,7 @@
2 2 <h3> <%= __('Do you want to join this community?') %> </h3>
3 3  
4 4 <% button_bar do %>
5   - <%= button(:ok, _('Yes'), :controller => 'profile', :action => 'join', :profile => profile.identifier) %>
  5 + <%= lightbox_button(:ok, _('Yes'), :controller => 'profile', :action => 'join', :profile => profile.identifier) %>
6 6 <%= button_to_function(:cancel, _('Not now'), "$('join-community-popup').hide()") %>
7 7 <%= button(:cancel, _('No and don\'t ask again'), :controller => 'profile', :action => 'refuse_join', :profile => profile.identifier) %>
8 8 <% end %>
... ...
test/functional/profile_controller_test.rb
... ... @@ -63,6 +63,15 @@ class ProfileControllerTest &lt; Test::Unit::TestCase
63 63 assert_kind_of Array, assigns(:favorite_enterprises)
64 64 end
65 65  
  66 + should 'render join template without layout when not' do
  67 + community = Community.create!(:name => 'my test community')
  68 + login_as(@profile.identifier)
  69 + get :join, :profile => community.identifier
  70 + assert_response :success
  71 + assert_template 'join'
  72 + assert_no_tag :tag => 'html'
  73 + end
  74 +
66 75 should 'show Join This Community button for non-member users' do
67 76 login_as(@profile.identifier)
68 77 community = Community.create!(:name => 'my test community')
... ...