diff options
author | Adolfo Fitoria <adolfo.fitoria@gmail.com> | 2013-05-29 11:24:59 -0600 |
---|---|---|
committer | Adolfo Fitoria <adolfo.fitoria@gmail.com> | 2013-05-29 11:24:59 -0600 |
commit | 61216651b5b6bef40711e71094b496213e171a36 (patch) | |
tree | 9fda8da4400643936cbe8bb6f9747b0422c1c62c | |
parent | 838dfd5813382538943912b6bc54dce1673d7b82 (diff) | |
parent | 0f2dc303750f3ddd88e911b0e4af9a497774036d (diff) | |
download | askbot-61216651b5b6bef40711e71094b496213e171a36.tar.gz askbot-61216651b5b6bef40711e71094b496213e171a36.tar.bz2 askbot-61216651b5b6bef40711e71094b496213e171a36.zip |
Merge branch 'master' of github.com:ASKBOT/askbot-devel into solrmultilang
-rw-r--r-- | askbot/media/js/live_search.js | 42 | ||||
-rw-r--r-- | askbot/templates/base.html | 1 | ||||
-rw-r--r-- | askbot/templates/widgets/ask_form.html | 1 |
3 files changed, 41 insertions, 3 deletions
diff --git a/askbot/media/js/live_search.js b/askbot/media/js/live_search.js index b812070c..2cb62b2b 100644 --- a/askbot/media/js/live_search.js +++ b/askbot/media/js/live_search.js @@ -14,6 +14,14 @@ SearchDropMenu.prototype.setAskHandler = function(handler) { this._askHandler = handler; }; +SearchDropMenu.prototype.setSearchWidget = function(widget) { + this._searchWidget = widget; +}; + +SearchDropMenu.prototype.getSearchWidget = function() { + return this._searchWidget; +}; + SearchDropMenu.prototype.setAskButtonEnabled = function(isEnabled) { this._askButtonEnabled = isEnabled; }; @@ -42,6 +50,11 @@ SearchDropMenu.prototype.render = function() { } }; +SearchDropMenu.prototype.clearSelectedItem = function() { + this._selectedItemIndex = 0; + this._resultsList.find('li').removeClass('selected'); +} + /** * @param {number} idx position of item starting from 1 for the topmost * Selects item inentified by position. @@ -126,7 +139,17 @@ SearchDropMenu.prototype.makeKeyHandler = function() { return false; } } - me.selectItem(curItem); + + var widget = me.getSearchWidget(); + if (curItem === 0) { + //activate key handlers on input box + widget.setFullTextSearchEnabled(true); + me.clearSelectedItem(); + } else { + //deactivate key handlers on input box + widget.setFullTextSearchEnabled(false); + me.selectItem(curItem); + } return false } }; @@ -772,6 +795,14 @@ FullTextSearch.prototype.updateToolTip = function() { } }; +FullTextSearch.prototype.setFullTextSearchEnabled = function(enabled) { + this._fullTextSearchEnabled = enabled; +}; + +FullTextSearch.prototype.getFullTextSearchEnabled = function() { + return this._fullTextSearchEnabled; +}; + /** * keydown handler operates on the tooltip and the X button * also opens and closes drop menu according to the min search word threshold @@ -793,8 +824,12 @@ FullTextSearch.prototype.makeKeyDownHandler = function() { return false; } } else if (keyCode === 13) { - formSubmitHandler(e); - return false; + if (me.getFullTextSearchEnabled()) { + formSubmitHandler(e); + return false; + } else { + return true; + } } var query = me.getSearchQuery(); @@ -856,6 +891,7 @@ FullTextSearch.prototype.decorate = function(element) { this._toolTip = toolTip; var dropMenu = new SearchDropMenu(); + dropMenu.setSearchWidget(this); dropMenu.setAskHandler(this.makeAskHandler()); dropMenu.setAskButtonEnabled(this._askButtonEnabled); this._dropMenu = dropMenu; diff --git a/askbot/templates/base.html b/askbot/templates/base.html index 332fa093..93f1c170 100644 --- a/askbot/templates/base.html +++ b/askbot/templates/base.html @@ -12,6 +12,7 @@ {% if settings.GOOGLE_SITEMAP_CODE %} <meta name="google-site-verification" content="{{settings.GOOGLE_SITEMAP_CODE}}" /> {% endif %} + <meta name="referrer" content="always" /> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" /> {% if settings.SITE_FAVICON %} <link rel="shortcut icon" href="{{ settings.SITE_FAVICON|media }}" /> diff --git a/askbot/templates/widgets/ask_form.html b/askbot/templates/widgets/ask_form.html index 3ddb07dd..1d5029f1 100644 --- a/askbot/templates/widgets/ask_form.html +++ b/askbot/templates/widgets/ask_form.html @@ -13,6 +13,7 @@ </div> </div> {% set editor_is_folded = ( + settings.QUESTION_BODY_EDITOR_MODE == 'folded' and settings.MIN_QUESTION_BODY_LENGTH == 0 and form.text.value()|is_empty_editor_value() ) |