Class: Editor::UsersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ApplicationController
- Editor::UsersController
- Defined in:
- app/controllers/editor/users_controller.rb
Overview
This controller manage User model for editors
Instance Method Summary collapse
-
#index ⇒ Object
GET /editor/users.
-
#list ⇒ Object
GET /editor/users/list.
-
#show ⇒ Object
GET /editor/users/:id.
-
#tickets ⇒ Object
GET /editor/users/:id/tickets.
Methods inherited from ApplicationController
#default_url_options, #new_session_path
Instance Method Details
#index ⇒ Object
GET /editor/users
8 9 10 11 12 13 14 |
# File 'app/controllers/editor/users_controller.rb', line 8 def index if filter_params[:text].present? @text = [ "email ilike :text or email ilike :text", { text: "%#{filter_params[:text]}%" } ] end @pagy, @users = pagy User.where(@text) end |
#list ⇒ Object
GET /editor/users/list
17 18 19 20 21 22 23 |
# File 'app/controllers/editor/users_controller.rb', line 17 def list if filter_params[:text].present? @text = [ "email ilike :text or email ilike :text", { text: "%#{filter_params[:text]}%" } ] end @pagy, @users = pagy(User.where(@text).where()) end |
#show ⇒ Object
GET /editor/users/:id
26 27 28 |
# File 'app/controllers/editor/users_controller.rb', line 26 def show @categories = [ [ @user.email, @user.id ] ] end |
#tickets ⇒ Object
GET /editor/users/:id/tickets
31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/editor/users_controller.rb', line 31 def tickets @text = [ "events.title ilike :string", { string: "%#{filter_params[:text]}%" } ] if filter_params[:text].present? if current_user.admin? @pagy, @tickets = pagy(@user.tickets.joins(happening: [ :event ]).where(@text), items: 6) else @pagy, @tickets = pagy( @user.tickets.joins(happening: [ :event ]).where(happening: { event: @current_user.events }).where(@text), items: 6 ) end end |