diff --git a/app/controllers/public/profile_controller.rb b/app/controllers/public/profile_controller.rb index 0f4e4ad..a116966 100644 --- a/app/controllers/public/profile_controller.rb +++ b/app/controllers/public/profile_controller.rb @@ -49,7 +49,9 @@ class ProfileController < PublicController flash[:notice] = _('%s administrator still needs to accept you as member.') % profile.name if profile.closed? redirect_to profile.url else - render :layout => false + if request.xhr? + render :layout => false + end end end diff --git a/app/views/profile/join.rhtml b/app/views/profile/join.rhtml index 9920e9c..35a5e8b 100644 --- a/app/views/profile/join.rhtml +++ b/app/views/profile/join.rhtml @@ -7,5 +7,9 @@ <% form_tag do %> <%= hidden_field_tag(:confirmation, 1) %> <%= submit_button(:ok, _("Yes, I want to join.") % profile.name) %> - <%= lightbox_close_button(_("No, I don't want."), :action => 'index') %> + <% if logged_in? && request.xhr? %> + <%= lightbox_close_button(_("No, I don't want")) %> + <% else %> + <%= button(:cancel, _("No, I don't want."), profile.url) %> + <% end %> <% end %> diff --git a/app/views/shared/join_community_popup.rhtml b/app/views/shared/join_community_popup.rhtml index 9e5bb47..22004c8 100644 --- a/app/views/shared/join_community_popup.rhtml +++ b/app/views/shared/join_community_popup.rhtml @@ -2,7 +2,11 @@

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

<% button_bar do %> - <%= lightbox_button(:ok, _('Yes'), :controller => 'profile', :action => 'join', :profile => profile.identifier) %> + <% if logged_in? %> + <%= lightbox_button(:ok, _('Yes'), :controller => 'profile', :action => 'join', :profile => profile.identifier) %> + <% else %> + <%= button(:ok, _('Yes'), :controller => 'profile', :action => 'join', :profile => profile.identifier) %> + <% end %> <%= 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/public/stylesheets/common.css b/public/stylesheets/common.css index ca8e8b8..81071ea 100644 --- a/public/stylesheets/common.css +++ b/public/stylesheets/common.css @@ -401,7 +401,7 @@ div.pending-tasks { /* theme test panel */ #theme-test-panel { - z-index: 1000; + z-index: 150; position: absolute; width: 300px; height: 180; @@ -421,7 +421,7 @@ div.pending-tasks { /* join community popup */ #join-community-popup { - z-index: 1000; + z-index: 150; position: absolute; width: 350px; height: 180; diff --git a/public/stylesheets/thickbox.css b/public/stylesheets/thickbox.css index d63f2fe..55deaaa 100644 --- a/public/stylesheets/thickbox.css +++ b/public/stylesheets/thickbox.css @@ -27,7 +27,7 @@ /* ----------------------------------------------------------------------------------------------------------------*/ #TB_overlay { position: fixed; - z-index:100; + z-index:200; top: 0px; left: 0px; height:100%; @@ -50,7 +50,7 @@ #TB_window { position: fixed; background: white; - z-index: 102; + z-index: 202; color:#000000; display:none; border: 4px solid #525252; @@ -124,7 +124,7 @@ margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = d display:none; height:13px; width:208px; - z-index:103; + z-index:203; top: 50%; left: 50%; margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */ @@ -136,7 +136,7 @@ margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = d } #TB_HideSelect{ - z-index:99; + z-index:199; position:fixed; top: 0; left: 0; diff --git a/test/functional/profile_controller_test.rb b/test/functional/profile_controller_test.rb index 17afd4c..b9519f9 100644 --- a/test/functional/profile_controller_test.rb +++ b/test/functional/profile_controller_test.rb @@ -63,15 +63,28 @@ class ProfileControllerTest < Test::Unit::TestCase assert_kind_of Array, assigns(:favorite_enterprises) end - should 'render join template without layout when not' do + should 'render join template without layout when called with AJAX' do community = Community.create!(:name => 'my test community') login_as(@profile.identifier) + @request.expects(:xhr?).returns(true) + get :join, :profile => community.identifier assert_response :success assert_template 'join' assert_no_tag :tag => 'html' end + should 'render join template with layout in general' do + community = Community.create!(:name => 'my test community') + login_as(@profile.identifier) + @request.expects(:xhr?).returns(false) + + get :join, :profile => community.identifier + assert_response :success + assert_template 'join' + assert_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