Closed ulmus closed 11 years ago
Nothing like that is in the cards -- DocumentCloud doesn't have any real structured date data by default. Sounds like it would make for a great plugin, or fork, depending on how you implement it.
Easiest way would probably be through the jquery UI datepicker plugin, seeing as you already require jquery UI. Then you get i18n of the datepicker for free. I'll see what I can get together, I'm not an expert backbone.js programmer, but I've done some tinkering.
I'm looking at some way to add options to facets (for a more general way of handling different kind of facets), right now I'm adding an option to the VS.init()
called categoryOptions
like this:
VS.init = function(options) {
var defaults = {
container : '',
query : '',
unquotable : [],
categoryOptions : [],
callbacks : {
search : $.noop,
focus : $.noop,
facetMatches : $.noop,
valueMatches : $.noop
}
};
This could be set on the format:
categoryOptions : [
{category: 'dates', suggest: 'date'},
]
And the facetMatches could look like this:
facetMatches : function(callback) {
callback([
'author', 'title', 'editor',
{ label: 'written', category: 'dates' },
{ label: 'last edited', category: 'dates' },
{ label: 'published', category: 'dates' },
]);
}
This way further suggest types could be added later on and other category options. As this addition is kind of broad in nature and I'm not fully initiated in your code or thinking, it would be great with some feedback on this way to handle options. Any other ideas?
Ulmus has passed this problem to me (he is my employer) and I have made a pull request on a possible solution.
Please comment on it :)
I think this could be better done via custom facet views (if @samuelclay is OK with pull request 50, which adds a hook for that). Although that would be easier if there was some sort of "readonly" minimally complete search facet (I'm trying to extract one but it's a bit gnarly as there's lots of code to keep in order to not break VS's nice keyboard-based behaviors) which could be extended to alter/edit the "value" half with customizable display and behavior.
That way, there wouldn't be a need to stuff VS.ui.SearchFacet
, some sort of DateFacetView
could be instantiated instead iif the facet to render calls for datetime picking.
So I closed this in the other pull request, as it was out of scope. Although now I can see the use. If you want to re-submit this pull request with the updated code (and possibly using the new hooks), I would gladly work it in.
I'm planning to use visualsearch in an electronic medical record system and would very much appreciate a way to provide date search values, preferably with a datepicker, or perhaps with independent autosuggests for year, month and date? Anything like this in the cards? Otherwise I'll take a stab at implementing it myself.