From: Jean-Philippe Lang Date: Sun, 18 Mar 2007 20:44:33 +0000 (+0000) Subject: added a status filter on users/list X-Git-Tag: 0.5.0~93 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8bb60b64747647fd17073ed11b60cfd1d7624919;p=redmine.git added a status filter on users/list git-svn-id: http://redmine.rubyforge.org/svn/trunk@347 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 5f0afcec7..45cec2e7a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0a6c29101..21f1b0247 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -77,7 +77,7 @@ module ApplicationHelper def pagination_links_full(paginator, options={}, html_options={}) html = '' html << link_to_remote(('« ' + 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) + ' »'), - {: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 diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index adc62fb77..9dc87c5cc 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -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 diff --git a/app/views/users/list.rhtml b/app/views/users/list.rhtml index 87d42391c..5d6e26d37 100644 --- a/app/views/users/list.rhtml +++ b/app/views/users/list.rhtml @@ -4,6 +4,15 @@

<%=l(:label_user_plural)%>

+<% form_tag() do %> +
<%= l(:label_filter_plural) %> + +<%= select_tag 'status', status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %> +<%= submit_tag l(:button_apply), :class => "small" %> +
+<% end %> +  + <%= sort_header_tag('login', :caption => l(:field_login)) %> diff --git a/lang/de.yml b/lang/de.yml index 8c5bbf170..3e679ed63 100644 --- a/lang/de.yml +++ b/lang/de.yml @@ -118,7 +118,6 @@ field_is_in_roadmap: Ansicht der Issues in der Roadmap field_login: Mitgliedsname field_mail_notification: Mailbenachrichtigung field_admin: Administrator -field_locked: Gesperrt field_last_login_on: Letzte Anmeldung field_language: Sprache field_effective_date: Datum @@ -357,6 +356,10 @@ button_cancel: Annullieren button_activate: Aktivieren 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_regexp_info: eg. ^[A-Z0-9]+$ text_min_max_length_info: 0 heisst keine Beschränkung diff --git a/lang/en.yml b/lang/en.yml index b6ada109b..b7a2e96fb 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -118,7 +118,6 @@ field_is_in_roadmap: Issues displayed in roadmap field_login: Login field_mail_notification: Mail notifications field_admin: Administrator -field_locked: Locked field_last_login_on: Last connection field_language: Language field_effective_date: Date @@ -357,6 +356,10 @@ button_cancel: Cancel button_activate: Activate 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_regexp_info: eg. ^[A-Z0-9]+$ text_min_max_length_info: 0 means no restriction diff --git a/lang/es.yml b/lang/es.yml index 337e5c753..9640ab144 100644 --- a/lang/es.yml +++ b/lang/es.yml @@ -118,7 +118,6 @@ field_is_in_roadmap: Consultar las peticiones en el roadmap field_login: Identificador field_mail_notification: Notificación por mail field_admin: Administrador -field_locked: Cerrado field_last_login_on: Última conexión field_language: Lengua field_effective_date: Fecha @@ -357,6 +356,10 @@ button_cancel: Cancelar button_activate: Activar 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_regexp_info: eg. ^[A-Z0-9]+$ text_min_max_length_info: 0 para ninguna restricción diff --git a/lang/fr.yml b/lang/fr.yml index 84995c83d..758406d7e 100644 --- a/lang/fr.yml +++ b/lang/fr.yml @@ -118,7 +118,6 @@ field_is_in_roadmap: Demandes affichées dans la roadmap field_login: Identifiant field_mail_notification: Notifications par mail field_admin: Administrateur -field_locked: Verrouillé field_last_login_on: Dernière connexion field_language: Langue field_effective_date: Date @@ -357,6 +356,10 @@ button_cancel: Annuler button_activate: Activer 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_regexp_info: ex. ^[A-Z0-9]+$ text_min_max_length_info: 0 pour aucune restriction diff --git a/lang/it.yml b/lang/it.yml index 47c623bcc..c7a4bb92f 100644 --- a/lang/it.yml +++ b/lang/it.yml @@ -118,7 +118,6 @@ field_is_in_roadmap: Contesti mostrati nel roadmap field_login: Login field_mail_notification: Notifiche via e-mail field_admin: Amministratore -field_locked: Bloccato field_last_login_on: Ultima connessione field_language: Lingua field_effective_date: Data @@ -357,6 +356,10 @@ button_cancel: Annulla button_activate: Attiva 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_regexp_info: eg. ^[A-Z0-9]+$ text_min_max_length_info: 0 means no restriction diff --git a/lang/ja.yml b/lang/ja.yml index 8466cf62f..06d0d4651 100644 --- a/lang/ja.yml +++ b/lang/ja.yml @@ -119,7 +119,6 @@ field_is_in_roadmap: Issues displayed in roadmap field_login: ログイン field_mail_notification: メール通知 field_admin: 管理者 -field_locked: ロック済 field_last_login_on: 最終接続日 field_language: 言語 field_effective_date: 日付 @@ -358,6 +357,10 @@ button_cancel: キャンセル button_activate: 有効にする button_sort: ソート +status_active: active +status_registered: registered +status_locked: ロック済 + text_select_mail_notifications: どのメール通知を送信するか、アクションを選択してください。 text_regexp_info: 例) ^[A-Z0-9]+$ text_min_max_length_info: 0だと無制限になります