[refs #32] Add user filter
This commit is contained in:
parent
3575d5a266
commit
b3f422e713
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
@ -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
|
||||
|
@ -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
|
||||
|
|
|
@ -259,6 +259,7 @@ ru:
|
|||
confirm_delete: Вы уверены, что хотите удалить этого пользователя?
|
||||
own_projects: Мои проекты
|
||||
part_projects: Участвую в проектах
|
||||
filter_header: Фильтр
|
||||
|
||||
git:
|
||||
repositories:
|
||||
|
|
Loading…
Reference in New Issue