From 68b890ac0a74d0bd6d3007d37f30d209fcfe1e06 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Wed, 5 Jun 2013 15:23:44 -0400 Subject: [PATCH] Make name completion pop above instead of below, and increase to 5 maximum names (imported from commit e663b8e6815c282c6233cd8ed560a82dccc6c507) --- zephyr/static/js/composebox_typeahead.js | 6 ++++-- zephyr/static/third/bootstrap/js/bootstrap.js | 11 +++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/zephyr/static/js/composebox_typeahead.js b/zephyr/static/js/composebox_typeahead.js index b288474121..57956db93e 100644 --- a/zephyr/static/js/composebox_typeahead.js +++ b/zephyr/static/js/composebox_typeahead.js @@ -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]; diff --git a/zephyr/static/third/bootstrap/js/bootstrap.js b/zephyr/static/third/bootstrap/js/bootstrap.js index d808e64905..39fd32dd4c 100644 --- a/zephyr/static/third/bootstrap/js/bootstrap.js +++ b/zephyr/static/third/bootstrap/js/bootstrap.js @@ -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: '
  • ' , minLength: 1 , stopAdvance: false + , dropup: false } $.fn.typeahead.Constructor = Typeahead