added a status filter on users/list

git-svn-id: http://redmine.rubyforge.org/svn/trunk@347 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2007-03-18 20:44:33 +00:00
parent 143be7ee02
commit 8bb60b6474
10 changed files with 48 additions and 9 deletions
+7 -1
View File
@@ -32,11 +32,17 @@ class UsersController < ApplicationController
def list
sort_init 'login', 'asc'
sort_update
@user_count = User.count
@status = params[:status] ? params[:status].to_i : 1
conditions = nil
conditions = ["status=?", @status] unless @status == 0
@user_count = User.count(:conditions => conditions)
@user_pages = Paginator.new self, @user_count,
15,
params['page']
@users = User.find :all,:order => sort_clause,
:conditions => conditions,
:limit => @user_pages.items_per_page,
:offset => @user_pages.current.offset
+2 -2
View File
@@ -77,7 +77,7 @@ module ApplicationHelper
def pagination_links_full(paginator, options={}, html_options={})
html = ''
html << link_to_remote(('&#171; ' + l(:label_previous)),
{:update => "content", :url => { :page => paginator.current.previous }},
{:update => "content", :url => params.merge({ :page => paginator.current.previous })},
{:href => url_for(:action => 'list', :params => params.merge({:page => paginator.current.previous}))}) + ' ' if paginator.current.previous
html << (pagination_links_each(paginator, options) do |n|
@@ -87,7 +87,7 @@ module ApplicationHelper
end || '')
html << ' ' + link_to_remote((l(:label_next) + ' &#187;'),
{:update => "content", :url => { :page => paginator.current.next }},
{:update => "content", :url => params.merge({ :page => paginator.current.next })},
{:href => url_for(:action => 'list', :params => params.merge({:page => paginator.current.next}))}) if paginator.current.next
html
end
+6
View File
@@ -16,4 +16,10 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module UsersHelper
def status_options_for_select(selected)
options_for_select([[l(:label_all), "*"],
[l(:status_active), 1],
[l(:status_registered), 2],
[l(:status_locked), 3]], selected)
end
end
+9
View File
@@ -4,6 +4,15 @@
<h2><%=l(:label_user_plural)%></h2>
<% form_tag() do %>
<fieldset><legend><%= l(:label_filter_plural) %></legend>
<label><%= l(:field_status) %> :</label>
<%= select_tag 'status', status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
<%= submit_tag l(:button_apply), :class => "small" %>
</fieldset>
<% end %>
&nbsp;
<table class="list">
<thead><tr>
<%= sort_header_tag('login', :caption => l(:field_login)) %>