Commit 2ecd34a0897a67adc6043678b8e3888dbeca1a29
1 parent
091011fb
Exists in
master
and in
29 other branches
ActionItem900: using a popup to confirm joining
Showing
5 changed files
with
14 additions
and
3 deletions
Show diff stats
app/controllers/public/profile_controller.rb
@@ -48,6 +48,8 @@ class ProfileController < PublicController | @@ -48,6 +48,8 @@ class ProfileController < PublicController | ||
48 | profile.add_member(current_user.person) | 48 | profile.add_member(current_user.person) |
49 | flash[:notice] = _('%s administrator still needs to accept you as member.') % profile.name if profile.closed? | 49 | flash[:notice] = _('%s administrator still needs to accept you as member.') % profile.name if profile.closed? |
50 | redirect_to profile.url | 50 | redirect_to profile.url |
51 | + else | ||
52 | + render :layout => false | ||
51 | end | 53 | end |
52 | end | 54 | end |
53 | 55 |
app/views/blocks/profile_info_actions/community.rhtml
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | </li> | 7 | </li> |
8 | <% else %> | 8 | <% else %> |
9 | <li> | 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 | </li> | 11 | </li> |
12 | <% end %> | 12 | <% end %> |
13 | 13 |
app/views/profile/join.rhtml
@@ -7,5 +7,5 @@ | @@ -7,5 +7,5 @@ | ||
7 | <% form_tag do %> | 7 | <% form_tag do %> |
8 | <%= hidden_field_tag(:confirmation, 1) %> | 8 | <%= hidden_field_tag(:confirmation, 1) %> |
9 | <%= submit_button(:ok, _("Yes, I want to join.") % profile.name) %> | 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 | <% end %> | 11 | <% end %> |
app/views/shared/join_community_popup.rhtml
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | <h3> <%= __('Do you want to join this community?') %> </h3> | 2 | <h3> <%= __('Do you want to join this community?') %> </h3> |
3 | 3 | ||
4 | <% button_bar do %> | 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 | <%= button_to_function(:cancel, _('Not now'), "$('join-community-popup').hide()") %> | 6 | <%= button_to_function(:cancel, _('Not now'), "$('join-community-popup').hide()") %> |
7 | <%= button(:cancel, _('No and don\'t ask again'), :controller => 'profile', :action => 'refuse_join', :profile => profile.identifier) %> | 7 | <%= button(:cancel, _('No and don\'t ask again'), :controller => 'profile', :action => 'refuse_join', :profile => profile.identifier) %> |
8 | <% end %> | 8 | <% end %> |
test/functional/profile_controller_test.rb
@@ -63,6 +63,15 @@ class ProfileControllerTest < Test::Unit::TestCase | @@ -63,6 +63,15 @@ class ProfileControllerTest < Test::Unit::TestCase | ||
63 | assert_kind_of Array, assigns(:favorite_enterprises) | 63 | assert_kind_of Array, assigns(:favorite_enterprises) |
64 | end | 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 | should 'show Join This Community button for non-member users' do | 75 | should 'show Join This Community button for non-member users' do |
67 | login_as(@profile.identifier) | 76 | login_as(@profile.identifier) |
68 | community = Community.create!(:name => 'my test community') | 77 | community = Community.create!(:name => 'my test community') |