diff options
author | Matt Jankowski <mjankowski@thoughtbot.com> | 2017-04-14 21:09:55 -0400 |
---|---|---|
committer | Eugen <eugen@zeonfederated.com> | 2017-04-15 03:09:55 +0200 |
commit | 09540192c96d2ed35accf0b34f3acd9d04170727 (patch) | |
tree | c81ec35f2176631b10ae5a83abcdddfa417a5593 /app/helpers/admin | |
parent | 08059ddda96496e5f3e257edbbecab43404faee7 (diff) |
Rename admin/accounts_helper to admin/filter_helper (#1816)
- Add some spec coverage for both methods - Add explicit constant call-outs for where the params are from
Diffstat (limited to 'app/helpers/admin')
-rw-r--r-- | app/helpers/admin/filter_helper.rb (renamed from app/helpers/admin/accounts_helper.rb) | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/app/helpers/admin/accounts_helper.rb b/app/helpers/admin/filter_helper.rb index 497abf80d..591056dd7 100644 --- a/app/helpers/admin/accounts_helper.rb +++ b/app/helpers/admin/filter_helper.rb @@ -1,9 +1,10 @@ # frozen_string_literal: true -module Admin::AccountsHelper - def filter_params(more_params) - params.permit(:local, :remote, :by_domain, :silenced, :suspended, :recent, :resolved).merge(more_params) - end +module Admin::FilterHelper + ACCOUNT_FILTERS = %i[local remote by_domain silenced suspended recent].freeze + REPORT_FILTERS = %i[resolved].freeze + + FILTERS = ACCOUNT_FILTERS + REPORT_FILTERS def filter_link_to(text, more_params) new_url = filtered_url_for(more_params) @@ -16,6 +17,10 @@ module Admin::AccountsHelper private + def filter_params(more_params) + params.permit(FILTERS).merge(more_params) + end + def filter_link_class(new_url) filtered_url_for(params) == new_url ? 'selected' : '' end |