Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion app/controllers/accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ class AccountsController < BaseController
before_action :find_account, only: [:follow, :unfollow]
before_action :find_admin, only: [:follow, :unfollow]

def index
super
@account_search_query = account_search_query
end

def show; end

def follow
Expand Down Expand Up @@ -44,6 +49,22 @@ def find_admin
end

def records_filter
@filter = Filter::Account.new(params)
@filter = Filter::Account.new(filter_params)
end

private

def filter_params
{
q: account_search_query,
page: params[:page]
}
end

def account_search_query
q_param = params[:q]
return {} unless q_param.respond_to?(:permit)

q_param.permit(:username_cont).to_h
end
end
2 changes: 1 addition & 1 deletion app/views/accounts/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
.card-header
%h3.card-title Registered Users
.card-tools.d-flex.justify-content-end.align-items-center
%a{ href: export_accounts_path(format: :csv, q: params[:q]), class: "btn btn-danger", title: "export CSV", style: "display: inline-flex; align-items: center; color: #ffffff !important; margin-right: 8px;" }
%a{ href: export_accounts_path(format: :csv, q: @account_search_query), class: "btn btn-danger", title: "export CSV", style: "display: inline-flex; align-items: center; color: #ffffff !important; margin-right: 8px;" }
= image_tag("icons/download.svg", style: "width: 1em; height: 1em; margin-right: 5px;")
Export CSV
= search_form_for @search do |f|
Expand Down