opf/openproject — pull request #8 by schmidt (2012-12-21 14:10:29+00:00)
Title: Replace Project Jump Box with select2 based version

The code attached replaces the current chosen based project jump box with an updated version based on select2.

This enables

(a) advanced filtering techniques
(b) improved performance for users with a large number of visible projects

**Advanced filtering techniques**

The new jump box performs a token based match. This way not only full matches but also multiple partial matches work, i.e. searching for "ab de" matches in "abc def".

The project hierarchy is preserved. When child projects match, but parents don't, then the whole parent hierarchy will be displayed, but deactivated. This way, the parent information is preserved while the proper matching is still guaranteed.

The parts of the project name, that match the query, are now underlined.

**Improved performance**

While traditionally the list of visible projects was populated for each request, the code attached only loads the list of projects when the project jump box is loaded. This results in a reduced load time for every request and only a short delay when using the widget.

By using select2's built-in pagination feature, the number of generated HTML nodes is reduced and therefore the available choices are displayed a lot faster.

**Technical notes**

A development version of select2 is used, since the last release caused problems in IE 8.

This pull request includes the changes from #2 since select2 renders some texts, that need I18n.

The code attached contains some tests written in QUnit. They do not run in the regular test suite, but need to be executed separately by opening /javascripts/qunit/ in a browser.