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

View File

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