pills: Streamline input pills (for user groups).

The main point of this change is to streamline the core
code for input pills, and we use also modify user groups.

The main change to input_pill.js is that you now
configure a function called `create_item_from_text`, and
that can return an arbitrary object, and it just needs
a field called `display_value`.

Other changes:
    * You now call `input.create(opts)` to create the
      widget.
    * There is no longer a cache, because we can
      write smarter code in typeahead `source` functions
      that exclude ids up front.
    * There is no value/optinalKey complexity, because
      the calling code can supply arbitrary objects and
      do their own external data management on the pill
      items.
    * We eliminate `prependPill`.
    * We eliminate `data`, `keys`, and `values`, and just
      have `items`.
This commit is contained in:
Steve Howell
2018-03-06 09:03:20 -05:00
committed by Tim Abbott
parent 0d29864c6a
commit f0d101edf5
7 changed files with 257 additions and 266 deletions

View File

@@ -1004,6 +1004,7 @@ JS_SPECS = {
'js/localstorage.js',
'js/drafts.js',
'js/input_pill.js',
'js/user_pill.js',
'js/channel.js',
'js/setup.js',
'js/unread_ui.js',