Make name completion pop above instead of below, and increase to 5 maximum names

(imported from commit e663b8e6815c282c6233cd8ed560a82dccc6c507)
This commit is contained in:
Leo Franchi 2013-06-05 15:23:44 -04:00
parent 3bc234f920
commit 68b890ac0a
2 changed files with 13 additions and 4 deletions

View File

@ -207,7 +207,8 @@ exports.initialize = function () {
$( "#private_message_recipient" ).typeahead({
source: typeahead_helper.private_message_typeahead_list,
items: 2,
items: 5,
dropup: true,
highlighter: composebox_typeahead_highlighter,
matcher: function (item) {
var current_recipient = get_last_recipient_in_pm(this.query);
@ -235,8 +236,9 @@ exports.initialize = function () {
$( "#new_message_content" ).typeahead({
source: typeahead_helper.private_message_typeahead_list,
items: 2,
items: 5,
highlighter: composebox_typeahead_highlighter,
dropup: true,
matcher: function (item) {
var query = exports.split_at_cursor(this.query)[0];

View File

@ -1815,6 +1815,7 @@
this.$menu = $(this.options.menu).appendTo('body')
this.source = this.options.source
this.shown = false
this.dropup = this.options.dropup
this.listen()
}
@ -1839,9 +1840,14 @@
height: this.$element[0].offsetHeight
})
var top_pos = pos.top + pos.height
if (this.dropup) {
top_pos = pos.top - this.$menu.outerHeight()
}
this.$menu.css({
top: pos.top + pos.height
, left: pos.left
top: top_pos
, left: pos.left
})
this.$menu.show()
@ -2069,6 +2075,7 @@
, item: '<li><a href="#"></a></li>'
, minLength: 1
, stopAdvance: false
, dropup: false
}
$.fn.typeahead.Constructor = Typeahead