##// END OF EJS Templates
Preserve status filter and page number when using lock/unlock/activate links on the users list (closes #998)....
Jean-Philippe Lang -
r1319:0249ae5f5000
parent child
Show More
@@ -83,7 +83,8 class UsersController < ApplicationController
83 end
83 end
84 if @user.update_attributes(params[:user])
84 if @user.update_attributes(params[:user])
85 flash[:notice] = l(:notice_successful_update)
85 flash[:notice] = l(:notice_successful_update)
86 redirect_to :action => 'list'
86 # Give a string to redirect_to otherwise it would use status param as the response code
87 redirect_to(url_for(:action => 'list', :status => params[:status], :page => params[:page]))
87 end
88 end
88 end
89 end
89 @auth_sources = AuthSource.find(:all)
90 @auth_sources = AuthSource.find(:all)
@@ -22,4 +22,16 module UsersHelper
22 [l(:status_registered), 2],
22 [l(:status_registered), 2],
23 [l(:status_locked), 3]], selected)
23 [l(:status_locked), 3]], selected)
24 end
24 end
25
26 def change_status_link(user)
27 url = {:action => 'edit', :id => user, :page => params[:page], :status => params[:status]}
28
29 if user.locked?
30 link_to l(:button_unlock), url.merge(:user => {:status => User::STATUS_ACTIVE}), :method => :post, :class => 'icon icon-unlock'
31 elsif user.registered?
32 link_to l(:button_activate), url.merge(:user => {:status => User::STATUS_ACTIVE}), :method => :post, :class => 'icon icon-unlock'
33 else
34 link_to l(:button_lock), url.merge(:user => {:status => User::STATUS_LOCKED}), :method => :post, :class => 'icon icon-lock'
35 end
36 end
25 end
37 end
@@ -33,17 +33,7
33 <td align="center"><%= image_tag('true.png') if user.admin? %></td>
33 <td align="center"><%= image_tag('true.png') if user.admin? %></td>
34 <td class="created_on" align="center"><%= format_time(user.created_on) %></td>
34 <td class="created_on" align="center"><%= format_time(user.created_on) %></td>
35 <td class="last_login_on" align="center"><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td>
35 <td class="last_login_on" align="center"><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td>
36 <td>
36 <td><small><%= change_status_link(user) %></small></td>
37 <small>
38 <% if user.locked? -%>
39 <%= link_to l(:button_unlock), {:action => 'edit', :id => user, :user => {:status => User::STATUS_ACTIVE}}, :method => :post, :class => 'icon icon-unlock' %>
40 <% elsif user.registered? -%>
41 <%= link_to l(:button_activate), {:action => 'edit', :id => user, :user => {:status => User::STATUS_ACTIVE}}, :method => :post, :class => 'icon icon-unlock' %>
42 <% else -%>
43 <%= link_to l(:button_lock), {:action => 'edit', :id => user, :user => {:status => User::STATUS_LOCKED}}, :method => :post, :class => 'icon icon-lock' %>
44 <% end -%>
45 </small>
46 </td>
47 </tr>
37 </tr>
48 <% end -%>
38 <% end -%>
49 </tbody>
39 </tbody>
General Comments 0
You need to be logged in to leave comments. Login now