[refs #32] Add user filter

This commit is contained in:
konstantin.grabar 2011-12-15 20:15:25 +04:00
parent 3575d5a266
commit b3f422e713
4 changed files with 26 additions and 1 deletions

View File

@ -7,7 +7,13 @@ class UsersController < ApplicationController
autocomplete :user, :uname
def index
@users = User.paginate(:page => params[:user_page])
@user = User.scoped
if !params[:filter].blank? && !params[:filter][:email].blank?
@users = @users.where(:email => params[:filter][:email])
@email = params[:filter][:email]
end
@users = @users.paginate(:page => params[:user_page])
@action_url = users_path
end
def show

View File

@ -0,0 +1,14 @@
%h2.title= t("layout.users.filter_header")
= form_for :filter, :url => @action_url, :html => { :method => :get, :class => :form } do |f|
.columns.wat-cf
.column.left
.group
= f.label :status, t("activerecord.attributes.users.email"), :class => :label
= f.text_field :email, :class => :text_field, :value => @email
.group.navform.wat-cf
%button.button{ :type => "submit" }
= image_tag("web-app-theme/icons/tick.png", :alt => "Save")
= t("layout.search")

View File

@ -6,11 +6,14 @@
.content
%h2.title
= t("layout.users.list_header")
.inner
= render :partial => "users/filter", :action_url => @action_url
.inner
%table.table
%tr
%th.first ID
%th= t("activerecord.attributes.user.name")
%th= t("activerecord.attributes.user.uname")
%th= t("activerecord.attributes.user.email")
%th= t("activerecord.attributes.user.role")
%th.last &nbsp;
@ -18,6 +21,7 @@
%tr{:class => cycle("odd", "even")}
%td= user.id
%td= link_to user.name, user_path(user)
%td= link_to user.uname, user_path(user)
%td= user.email
%td= user.role
%td.last

View File

@ -259,6 +259,7 @@ ru:
confirm_delete: Вы уверены, что хотите удалить этого пользователя?
own_projects: Мои проекты
part_projects: Участвую в проектах
filter_header: Фильтр
git:
repositories: