Commit 31416a5522151b9764377275e5a5bb482440c6e7

Authored by Antonio Terceiro
1 parent 2ecd34a0

ActionItem900: some usability changes

app/controllers/public/profile_controller.rb
... ... @@ -49,7 +49,9 @@ class ProfileController < PublicController
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 51 else
52   - render :layout => false
  52 + if request.xhr?
  53 + render :layout => false
  54 + end
53 55 end
54 56 end
55 57  
... ...
app/views/profile/join.rhtml
... ... @@ -7,5 +7,9 @@
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   - <%= lightbox_close_button(_("No, I don't want."), :action => 'index') %>
  10 + <% if logged_in? && request.xhr? %>
  11 + <%= lightbox_close_button(_("No, I don't want")) %>
  12 + <% else %>
  13 + <%= button(:cancel, _("No, I don't want."), profile.url) %>
  14 + <% end %>
11 15 <% end %>
... ...
app/views/shared/join_community_popup.rhtml
... ... @@ -2,7 +2,11 @@
2 2 <h3> <%= __('Do you want to join this community?') %> </h3>
3 3  
4 4 <% button_bar do %>
5   - <%= lightbox_button(:ok, _('Yes'), :controller => 'profile', :action => 'join', :profile => profile.identifier) %>
  5 + <% if logged_in? %>
  6 + <%= lightbox_button(:ok, _('Yes'), :controller => 'profile', :action => 'join', :profile => profile.identifier) %>
  7 + <% else %>
  8 + <%= button(:ok, _('Yes'), :controller => 'profile', :action => 'join', :profile => profile.identifier) %>
  9 + <% end %>
6 10 <%= button_to_function(:cancel, _('Not now'), "$('join-community-popup').hide()") %>
7 11 <%= button(:cancel, _('No and don\'t ask again'), :controller => 'profile', :action => 'refuse_join', :profile => profile.identifier) %>
8 12 <% end %>
... ...
public/stylesheets/common.css
... ... @@ -401,7 +401,7 @@ div.pending-tasks {
401 401  
402 402 /* theme test panel */
403 403 #theme-test-panel {
404   - z-index: 1000;
  404 + z-index: 150;
405 405 position: absolute;
406 406 width: 300px;
407 407 height: 180;
... ... @@ -421,7 +421,7 @@ div.pending-tasks {
421 421  
422 422 /* join community popup */
423 423 #join-community-popup {
424   - z-index: 1000;
  424 + z-index: 150;
425 425 position: absolute;
426 426 width: 350px;
427 427 height: 180;
... ...
public/stylesheets/thickbox.css
... ... @@ -27,7 +27,7 @@
27 27 /* ----------------------------------------------------------------------------------------------------------------*/
28 28 #TB_overlay {
29 29 position: fixed;
30   - z-index:100;
  30 + z-index:200;
31 31 top: 0px;
32 32 left: 0px;
33 33 height:100%;
... ... @@ -50,7 +50,7 @@
50 50 #TB_window {
51 51 position: fixed;
52 52 background: white;
53   - z-index: 102;
  53 + z-index: 202;
54 54 color:#000000;
55 55 display:none;
56 56 border: 4px solid #525252;
... ... @@ -124,7 +124,7 @@ margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = d
124 124 display:none;
125 125 height:13px;
126 126 width:208px;
127   - z-index:103;
  127 + z-index:203;
128 128 top: 50%;
129 129 left: 50%;
130 130 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
136 136 }
137 137  
138 138 #TB_HideSelect{
139   - z-index:99;
  139 + z-index:199;
140 140 position:fixed;
141 141 top: 0;
142 142 left: 0;
... ...
test/functional/profile_controller_test.rb
... ... @@ -63,15 +63,28 @@ 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
  66 + should 'render join template without layout when called with AJAX' do
67 67 community = Community.create!(:name => 'my test community')
68 68 login_as(@profile.identifier)
  69 + @request.expects(:xhr?).returns(true)
  70 +
69 71 get :join, :profile => community.identifier
70 72 assert_response :success
71 73 assert_template 'join'
72 74 assert_no_tag :tag => 'html'
73 75 end
74 76  
  77 + should 'render join template with layout in general' do
  78 + community = Community.create!(:name => 'my test community')
  79 + login_as(@profile.identifier)
  80 + @request.expects(:xhr?).returns(false)
  81 +
  82 + get :join, :profile => community.identifier
  83 + assert_response :success
  84 + assert_template 'join'
  85 + assert_tag :tag => 'html'
  86 + end
  87 +
75 88 should 'show Join This Community button for non-member users' do
76 89 login_as(@profile.identifier)
77 90 community = Community.create!(:name => 'my test community')
... ...