Commit Graph

15 Commits

Author SHA1 Message Date
Albert Yi
ceecc62aa8 Merge pull request #3557 from evazion/fix-autocomplete-consistency
Fix inconsistencies in autocomplete behavior
2018-02-21 14:51:50 -08:00
evazion
c482175050 Fix #3558: Autocomplete: negated metatags aren't completed.
Fix Danbooru.Autocomplete.parse_query to strip prefixes off of
metatags.
2018-02-19 23:57:46 -06:00
evazion
d8e195d168 autocomplete: unify autocomplete options.
Use a single set of default options so that autocomplete behaves
the same way everywhere.
2018-02-18 19:22:46 -06:00
evazion
4754daf594 autocomplete: unify menu item rendering.
* Use `Danbooru.Autocomplete.render_item` for all menu item rendering.
  Fixes usernames not being colorized when completing mentions, and post
  counts not being shown when completing pools on the /pools page.

* Make the /pools page autocomplete pool names the same way that the
  pool:<name> metatag does. Previously autocomplete on the /pools page
  listed most recently updated pools first; now it lists largest pools first.
2018-02-18 19:22:46 -06:00
evazion
962842815d autocomplete: move artist/pool/wiki autocompletion to autocomplete.js.
* Move all autocomplete code to autocomplete.js.

* Mark autocompleted fields with `data-autocomplete="<type>"` attributes,
  instead of hardcoding input field IDs in the javascript.
2018-02-18 19:22:17 -06:00
evazion
0e259bd4f6 autocomplete: fix issues with Enter key.
* Disable autoFocus. This means that the first item in the autocomplete
  menu isn't automatically selected.

* Add Tab keybinding, to make the Tab key work as normal with autoFocus disabled.

* Fix the Enter key to 1) insert the selected tag when inside the
  autocomplete menu, and 2) submit the search as normal when not inside
  the autocomplete menu.
2018-02-14 22:09:14 -06:00
evazion
b877c037b2 autocomplete: factor out insert_completion function. 2018-02-14 20:23:37 -06:00
evazion
f0754c21f5 autocomplete: make enter key submit on exact match. 2018-02-13 10:52:43 -06:00
evazion
ab86c2049f autocomplete: factor out parse_query function. 2018-02-13 10:36:20 -06:00
Albert Yi
4e10913e31 Merge pull request #3544 from BrokenEagle/fix-autocomplete-nosource
Clear results when a non-autocomplete metatag is used
2018-02-13 00:30:31 -08:00
BrokenEagle
30401591fb Set blank results when a non-autocomplete metatag is used
-Otherwise, the last valid autocomplete result will remain
--Causes incorrect results on Tab/Enter completion
-This clears the autocomplete results instead
2018-02-12 17:20:12 -08:00
evazion
cf27de2ec9 Fix #3532: Make Enter key accept current tag during autocomplete.
Previously we patched the jqueryui-autocomplete library in order to
customize how the Tab and Enter keys behaved. Specifically, we wanted to
prevent the Tab key from moving the focus out of the tag input box, and
we wanted to prevent the Enter key from submitting the page when editing tags.

These things can achieved without patching the library by using
`event.preventDefault` and `event.stopImmediatePropagation` to prevent
other event handlers from running after these keys trigger the
`autocompleteselect` event.
2018-02-06 19:11:01 -06:00
BrokenEagle
d829ab3a00 Move all order logic to models
- Have a default order for each model
-- The overall default is ID DESC
- Allow for custom orderings
-- When comma-separated IDs are used
2018-01-29 11:42:53 -08:00
BrokenEagle
8f0e4398eb Fix metatags being treated as normal tags
- Add parent metatag defaults any and none
- Add missing user-based metatags to user source
- Remove all negative metatags since the prior code strips the '-'
2018-01-02 19:52:13 -08:00
BrokenEagle
d54b26c61d Convert tag category Javascript/CSS assets to ERB 2017-12-24 17:01:17 -08:00