Skip to content
This repository has been archived by the owner on May 18, 2021. It is now read-only.

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
PanfilovDenis committed Feb 21, 2013
1 parent a18d7ac commit dbcb662
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
8 changes: 6 additions & 2 deletions app/controllers/web/admin/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ def create
end

def index
@search = User.search(params[:q])
@users = @search.result.alphabetically.page(params[:page]).per(50)
@search = User.ransack(params[:q])
if params[:q]
@users = @search.result.page(params[:page]).per(50)
else
@users = @search.result.alphabetically.page(params[:page]).per(50)
end
end

def show
Expand Down
9 changes: 7 additions & 2 deletions app/controllers/web/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
class Web::UsersController < Web::ApplicationController

def index
@search = User.search(params[:q])
@users = @search.result.activated.shown_as_participants.alphabetically
@search = User.ransack(params[:q])
if params[:q]
@users = @search.result.activated.shown_as_participants
else
@users = @search.result.activated.shown_as_participants.alphabetically
end

end

def new
Expand Down
2 changes: 1 addition & 1 deletion app/views/web/admin/users/index.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.page-header
%h1=t('.title')

/ FIXME vdv73rus, form-inline not work
= simple_form_for @search, url: admin_users_path, method: :get, html: { class: 'form-inline' } do |f|
.form-inputs
= f.input :last_name_cont, label: t(".last_name"), required: false
Expand Down
3 changes: 1 addition & 2 deletions app/views/web/users/index.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
%h1=t '.title'
%h3=t '.registred', activated_count: User.activated.count
%h3=t '.participants', participants_count: User.activated.shown_as_participants.count
%h5=t '.registred_title', activated_count: User.activated.count, participants_count: User.activated.shown_as_participants.count
%table.table.table-striped
%thead
%tr
Expand Down
4 changes: 2 additions & 2 deletions config/locales/ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ ru:

index:
title: 'Пойдут на стачку'
registred: "Зарегистрировалось – %{activated_count}."
participants: "%{participants_count}, кто согласился рассказать о себе."
# TODO add pluralize word "участников
registred_title: "Зарегистрировалось – %{activated_count} участников. Ниже %{participants_count}, кто согласился рассказать о себе."

welcome:
index:
Expand Down

0 comments on commit dbcb662

Please sign in to comment.