Skip to content

Instantly share code, notes, and snippets.

@jtribble
Last active January 20, 2016 22:15
Show Gist options
  • Save jtribble/b00c5c502aff7d904899 to your computer and use it in GitHub Desktop.
Save jtribble/b00c5c502aff7d904899 to your computer and use it in GitHub Desktop.
//
// Example filters
// - will populate a dropdown <select>
// - has an optional useKeywordFilter flag
//
const losFilters = {
key: 'lineOfService',
label: 'Line of Service',
useKeywordFilter: true,
values: [
{
text: 'Heating Ventilation AC',
value: 'hvac'
},
{
text: 'Signs',
value: 'signs'
}
]
};
const etaFilters = {
key: 'localEta',
label: 'Expected Completion Month',
values: [
{
text: 'November, 2015',
value: '2015-11'
},
{
text: 'September, 2015',
value: '2015-09'
}
]
};
const sortBy = {
key: 'sortBy',
label: 'Sort By',
values: [
{
text: 'Local Time-In',
value: 'localTimeIn'
},
{
text: 'Estimated Time of Completion',
value: 'localEta'
}
]
};
//
// Example of filters combined and sent down as a single "filters" array
// - this is what's sent down to the client
// - iterate through array of filters and populate controls (w/ label, <select>, etc.)
//
const filters = [
{
key: 'foo',
label: 'Foo',
useKeywordFilter: true,
values: [
// ...
]
},
{
key: 'bar',
label: 'Bar',
values: [
// ...
]
}
];
//
// Example: User opens "Line of Service" dropdown and selects "Signs"
//
// ...triggers /servicerequest?lineOfService=signs
//
//
// Example: User opens "Sort By" dropdown and selects "Local Time-In"
//
// ...triggers /servicerequest?sortBy=localTimeIn
//
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment