ccmdesign-archives / open-government-research-exchange

1 stars 3 forks source link

2 alternate filter macro implementations that are generic and modular, reverts 8f4b09ad57083a2a9c6ccf54a0860ac0104e7985 #16

Closed ghost closed 8 years ago

ghost commented 8 years ago

provides 2 options for a generic macro implementation.

both are importable from _macros.html 👍

option 1: filterDropdown super small 18 line macro where all logic is in js, and is modular and generic unlike hardcoding in 8f4b09ad57083a2a9c6ccf54a0860ac0104e7985

option 2: filterDropdownAlt slightly more verbose macro that has some basic logic in the macro, and all the advanced logic is handled by very lightweight custom js filters

either can be implemented.

also adds the following filters, which can be used in any nunjucks template or macro:

array | contains(value)
array | pushIfNew(value) 
array | pushPossibleValues(obj, prop, category, prefix) 
claudioccm commented 8 years ago

not merging this before launch. We can revisit this in the future