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

View File

@ -32,11 +32,17 @@ class UsersController < ApplicationController
def list def list
sort_init 'login', 'asc' sort_init 'login', 'asc'
sort_update 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, @user_pages = Paginator.new self, @user_count,
15, 15,
params['page'] params['page']
@users = User.find :all,:order => sort_clause, @users = User.find :all,:order => sort_clause,
:conditions => conditions,
:limit => @user_pages.items_per_page, :limit => @user_pages.items_per_page,
:offset => @user_pages.current.offset :offset => @user_pages.current.offset

View File

@ -77,7 +77,7 @@ module ApplicationHelper
def pagination_links_full(paginator, options={}, html_options={}) def pagination_links_full(paginator, options={}, html_options={})
html = '' html = ''
html << link_to_remote(('&#171; ' + l(:label_previous)), 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 {:href => url_for(:action => 'list', :params => params.merge({:page => paginator.current.previous}))}) + ' ' if paginator.current.previous
html << (pagination_links_each(paginator, options) do |n| html << (pagination_links_each(paginator, options) do |n|
@ -87,7 +87,7 @@ module ApplicationHelper
end || '') end || '')
html << ' ' + link_to_remote((l(:label_next) + ' &#187;'), 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 {:href => url_for(:action => 'list', :params => params.merge({:page => paginator.current.next}))}) if paginator.current.next
html html
end end

View File

@ -16,4 +16,10 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module UsersHelper 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 end

View File

@ -4,6 +4,15 @@
<h2><%=l(:label_user_plural)%></h2> <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"> <table class="list">
<thead><tr> <thead><tr>
<%= sort_header_tag('login', :caption => l(:field_login)) %> <%= sort_header_tag('login', :caption => l(:field_login)) %>

View File

@ -118,7 +118,6 @@ field_is_in_roadmap: Ansicht der Issues in der Roadmap
field_login: Mitgliedsname field_login: Mitgliedsname
field_mail_notification: Mailbenachrichtigung field_mail_notification: Mailbenachrichtigung
field_admin: Administrator field_admin: Administrator
field_locked: Gesperrt
field_last_login_on: Letzte Anmeldung field_last_login_on: Letzte Anmeldung
field_language: Sprache field_language: Sprache
field_effective_date: Datum field_effective_date: Datum
@ -357,6 +356,10 @@ button_cancel: Annullieren
button_activate: Aktivieren button_activate: Aktivieren
button_sort: Sortieren button_sort: Sortieren
status_active: active
status_registered: registered
status_locked: locked
text_select_mail_notifications: Aktionen für die Mailbenachrichtigung aktiviert werden soll. text_select_mail_notifications: Aktionen für die Mailbenachrichtigung aktiviert werden soll.
text_regexp_info: eg. ^[A-Z0-9]+$ text_regexp_info: eg. ^[A-Z0-9]+$
text_min_max_length_info: 0 heisst keine Beschränkung text_min_max_length_info: 0 heisst keine Beschränkung

View File

@ -118,7 +118,6 @@ field_is_in_roadmap: Issues displayed in roadmap
field_login: Login field_login: Login
field_mail_notification: Mail notifications field_mail_notification: Mail notifications
field_admin: Administrator field_admin: Administrator
field_locked: Locked
field_last_login_on: Last connection field_last_login_on: Last connection
field_language: Language field_language: Language
field_effective_date: Date field_effective_date: Date
@ -357,6 +356,10 @@ button_cancel: Cancel
button_activate: Activate button_activate: Activate
button_sort: Sort button_sort: Sort
status_active: active
status_registered: registered
status_locked: locked
text_select_mail_notifications: Select actions for which mail notifications should be sent. text_select_mail_notifications: Select actions for which mail notifications should be sent.
text_regexp_info: eg. ^[A-Z0-9]+$ text_regexp_info: eg. ^[A-Z0-9]+$
text_min_max_length_info: 0 means no restriction text_min_max_length_info: 0 means no restriction

View File

@ -118,7 +118,6 @@ field_is_in_roadmap: Consultar las peticiones en el roadmap
field_login: Identificador field_login: Identificador
field_mail_notification: Notificación por mail field_mail_notification: Notificación por mail
field_admin: Administrador field_admin: Administrador
field_locked: Cerrado
field_last_login_on: Última conexión field_last_login_on: Última conexión
field_language: Lengua field_language: Lengua
field_effective_date: Fecha field_effective_date: Fecha
@ -357,6 +356,10 @@ button_cancel: Cancelar
button_activate: Activar button_activate: Activar
button_sort: Clasificar button_sort: Clasificar
status_active: active
status_registered: registered
status_locked: locked
text_select_mail_notifications: Seleccionar las actividades que necesitan la activación de la notificación por mail. text_select_mail_notifications: Seleccionar las actividades que necesitan la activación de la notificación por mail.
text_regexp_info: eg. ^[A-Z0-9]+$ text_regexp_info: eg. ^[A-Z0-9]+$
text_min_max_length_info: 0 para ninguna restricción text_min_max_length_info: 0 para ninguna restricción

View File

@ -118,7 +118,6 @@ field_is_in_roadmap: Demandes affichées dans la roadmap
field_login: Identifiant field_login: Identifiant
field_mail_notification: Notifications par mail field_mail_notification: Notifications par mail
field_admin: Administrateur field_admin: Administrateur
field_locked: Verrouillé
field_last_login_on: Dernière connexion field_last_login_on: Dernière connexion
field_language: Langue field_language: Langue
field_effective_date: Date field_effective_date: Date
@ -357,6 +356,10 @@ button_cancel: Annuler
button_activate: Activer button_activate: Activer
button_sort: Trier button_sort: Trier
status_active: actif
status_registered: enregistré
status_locked: vérouillé
text_select_mail_notifications: Sélectionner les actions pour lesquelles la notification par mail doit être activée. text_select_mail_notifications: Sélectionner les actions pour lesquelles la notification par mail doit être activée.
text_regexp_info: ex. ^[A-Z0-9]+$ text_regexp_info: ex. ^[A-Z0-9]+$
text_min_max_length_info: 0 pour aucune restriction text_min_max_length_info: 0 pour aucune restriction

View File

@ -118,7 +118,6 @@ field_is_in_roadmap: Contesti mostrati nel roadmap
field_login: Login field_login: Login
field_mail_notification: Notifiche via e-mail field_mail_notification: Notifiche via e-mail
field_admin: Amministratore field_admin: Amministratore
field_locked: Bloccato
field_last_login_on: Ultima connessione field_last_login_on: Ultima connessione
field_language: Lingua field_language: Lingua
field_effective_date: Data field_effective_date: Data
@ -357,6 +356,10 @@ button_cancel: Annulla
button_activate: Attiva button_activate: Attiva
button_sort: Ordina button_sort: Ordina
status_active: active
status_registered: registered
status_locked: bloccato
text_select_mail_notifications: Select actions for which mail notifications should be sent. text_select_mail_notifications: Select actions for which mail notifications should be sent.
text_regexp_info: eg. ^[A-Z0-9]+$ text_regexp_info: eg. ^[A-Z0-9]+$
text_min_max_length_info: 0 means no restriction text_min_max_length_info: 0 means no restriction

View File

@ -119,7 +119,6 @@ field_is_in_roadmap: Issues displayed in roadmap
field_login: ログイン field_login: ログイン
field_mail_notification: メール通知 field_mail_notification: メール通知
field_admin: 管理者 field_admin: 管理者
field_locked: ロック済
field_last_login_on: 最終接続日 field_last_login_on: 最終接続日
field_language: 言語 field_language: 言語
field_effective_date: 日付 field_effective_date: 日付
@ -358,6 +357,10 @@ button_cancel: キャンセル
button_activate: 有効にする button_activate: 有効にする
button_sort: ソート button_sort: ソート
status_active: active
status_registered: registered
status_locked: ロック済
text_select_mail_notifications: どのメール通知を送信するか、アクションを選択してください。 text_select_mail_notifications: どのメール通知を送信するか、アクションを選択してください。
text_regexp_info: 例) ^[A-Z0-9]+$ text_regexp_info: 例) ^[A-Z0-9]+$
text_min_max_length_info: 0だと無制限になります text_min_max_length_info: 0だと無制限になります