Class: RubyCms::Admin::UsersController
Constant Summary
RubyCms::AdminPagination::DEFAULT_MAX_PER_PAGE, RubyCms::AdminPagination::DEFAULT_MIN_PER_PAGE
Instance Method Summary
collapse
#turbo_frame_id, #turbo_frame_request?, #turbo_redirect_to, #turbo_render_index, #turbo_stream_replace_table, #turbo_stream_request?, #turbo_stream_update_table
#paginate_collection, #set_pagination_vars
Instance Method Details
#bulk_delete ⇒ Object
34
35
36
37
38
39
40
41
42
|
# File 'app/controllers/ruby_cms/admin/users_controller.rb', line 34
def bulk_delete
ids = Array(params[:item_ids]).filter_map(&:to_i)
users = user_class.where(id: ids)
count = users.count
users.destroy_all
turbo_redirect_to ruby_cms_admin_users_path, notice: "#{count} user(s) #{
t('ruby_cms.admin.users.deleted')
}."
end
|
#create ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'app/controllers/ruby_cms/admin/users_controller.rb', line 19
def create
user = user_class.new(user_params)
if user.save
redirect_to ruby_cms_admin_users_path, notice: t("ruby_cms.admin.users.created")
else
handle_create_failure(user)
end
end
|
#destroy ⇒ Object
28
29
30
31
32
|
# File 'app/controllers/ruby_cms/admin/users_controller.rb', line 28
def destroy
user = user_class.find(params[:id])
user.destroy
redirect_to ruby_cms_admin_users_path, notice: t("ruby_cms.admin.users.deleted")
end
|
#index ⇒ Object
14
15
16
17
|
# File 'app/controllers/ruby_cms/admin/users_controller.rb', line 14
def index
@users = paginated_users
@index ||= user_class.none
end
|