Class: Decidim::FeedsUi::UsersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/decidim/feeds_ui/users_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#permission_class_chain

Instance Method Details

#filter_usersObject



26
27
28
29
30
31
32
33
# File 'app/controllers/decidim/feeds_ui/users_controller.rb', line 26

def filter_users
  # @user = Decidim::User.find_by(name: params[:name], interest: params[:interest], apartment: params[:apartment])
  query = params[:name].downcase
  @users = confirmed_users.where("lower(name) LIKE ? OR lower(nickname) LIKE ?", "%#{query}%", "%#{query}%")
  respond_to do |format|
    format.js
  end
end

#indexObject



10
11
12
13
# File 'app/controllers/decidim/feeds_ui/users_controller.rb', line 10

def index
  enforce_permission_to :read, :users
  @users = confirmed_users
end

#profile_holderObject



20
21
22
23
24
# File 'app/controllers/decidim/feeds_ui/users_controller.rb', line 20

def profile_holder
  return if params[:nickname].blank?

  @profile_holder ||= Decidim::UserBaseEntity.find_by("LOWER(nickname) = ? AND decidim_organization_id = ?", params[:nickname].downcase, current_organization.id)
end

#user_profileObject



15
16
17
18
# File 'app/controllers/decidim/feeds_ui/users_controller.rb', line 15

def 
  @user = confirmed_users.find(params[:id])
  # Additional logic for displaying the user's profile
end