diff options
author | のら <noraworld@users.noreply.github.com> | 2017-07-07 07:48:09 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-07-07 00:48:09 +0200 |
commit | 2d6128672fcadeb29c99551a33648b4880969d22 (patch) | |
tree | 5941f2a332538046142a7edec4cb1fbb2289869c /app/helpers | |
parent | 185b41beb4adea5f0b55f56c0898bef74fd35435 (diff) |
Togglable filter links (#4021)
* Togglable filter links * Rename is_selected to selected?
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/admin/filter_helper.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/helpers/admin/filter_helper.rb b/app/helpers/admin/filter_helper.rb index 0dfa30e56..6a57b3d63 100644 --- a/app/helpers/admin/filter_helper.rb +++ b/app/helpers/admin/filter_helper.rb @@ -6,15 +6,21 @@ module Admin::FilterHelper FILTERS = ACCOUNT_FILTERS + REPORT_FILTERS - def filter_link_to(text, more_params) - new_url = filtered_url_for(more_params) - link_to text, new_url, class: filter_link_class(new_url) + def filter_link_to(text, link_to_params, link_class_params = link_to_params) + new_url = filtered_url_for(link_to_params) + new_class = filtered_url_for(link_class_params) + link_to text, new_url, class: filter_link_class(new_class) end def table_link_to(icon, text, path, options = {}) link_to safe_join([fa_icon(icon), text]), path, options.merge(class: 'table-action-link') end + def selected?(more_params) + new_url = filtered_url_for(more_params) + filter_link_class(new_url) == 'selected' ? true : false + end + private def filter_params(more_params) |