Sha256: 5dac0d9641e18097c62e292a0772120cedf9fdcce410bf87c1687f5fc631e22e

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 KB

Contents

<!--
# @title README - mod: filter
-->

# Filter mod

This mod provides a framework for enhancing card searches with advanced filtering
interfaces. 

Include the Abstract::Filter set in any search set to add both:

- a `filter_form` view with progressive disclosure filter accordions inside an offcanvas, 
  and
- a `compact_filter_form` view that opens compact filter interfaces in place above search
  results.

The mod also adds support for a `filtered_list` view of list/pointer cards that makes it
easier to choose list items from options too numerous or complicated to fit into a 
standard dropdown.

Filters for a given set can be specified with the `#filter_map` method, which should
return a list of filter configurations. Each configuration can be a Symbol or a Hash.
For example, here is a simple configuration with three filters.

```
def filter_map 
  [name topic bookmark]
end
```

For each filter you can use methods to define:
  1. labels, eg `#filter_topic_label` (same as the filter key if not defined)
  2. options, eg `#filter_topic_options` (empty by default)
  3. a default value, eg `#filter_topic_default` (blank unless specified), and
  4. a type, eg `#filter_topic_type` (defaults to text).

Type options include:

  - text
  - autocomplete
  - radio
  - check
  - select
  - multiselect
  - range

It is also possible to write custom filter types in the following manner:

```
def filter_myfield_type
  :my_custom_type
end  

def my_custom_type_filter
  # returns filter ui
end
```

Note that fields that use radio and check filtering in the `filter_form` view will use 
select and multiselect filtering respectively in the `compact_filter_form` view.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
card-mod-filter-0.2 README.md