Add columns selector JS component and change Rails view to use it #3439
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
References
#3429
Objectives
Create a new visual component to select which columns will be display on admin budget investments table. Selection will be stored for each user as cookie
Visual Changes
Notes
How it works:
This new feature is based on a JS solution, given display logic to JQuery. To make it run, we just need a couple of data attributes in our table, and render a new shared partial to set checks wrapper
Once Jquery is loaded, It will search a DOM item with id: '#js-columns-selector' to initialize all columns selector JS logic.
columns-selector
triggerhidden
to table columns usingdata-field
property, and will check checkboxes if is included on cookieOnce is loaded, each checkboxes change will trigger an event which toggle column hidden class and update cookie with new value
Adding component to new table
column-selecteable
class to tabledata-field=_FIELD_
attribute to each th we want to add to our chooser, field will identify table attributedata-field=_FIELD_
attribute to each td we want to associate with our chooser