diff options
-rw-r--r-- | askbot/media/js/group_messaging.js | 1 | ||||
-rw-r--r-- | askbot/media/js/live_search.js | 1 | ||||
-rw-r--r-- | askbot/media/js/post.js | 5 | ||||
-rw-r--r-- | askbot/media/js/tag_selector.js | 1 | ||||
-rw-r--r-- | askbot/media/js/user.js | 1 | ||||
-rw-r--r-- | askbot/media/js/utils.js | 24 | ||||
-rw-r--r-- | askbot/media/js/wmd/wmd.js | 19 | ||||
-rw-r--r-- | askbot/media/style/style.css | 51 | ||||
-rw-r--r-- | askbot/media/style/style.less | 51 | ||||
-rw-r--r-- | askbot/templates/macros.html | 1 | ||||
-rw-r--r-- | askbot/views/writers.py | 4 |
11 files changed, 107 insertions, 52 deletions
diff --git a/askbot/media/js/group_messaging.js b/askbot/media/js/group_messaging.js index 30519f1f..add50425 100644 --- a/askbot/media/js/group_messaging.js +++ b/askbot/media/js/group_messaging.js @@ -309,7 +309,6 @@ NewThreadComposer.prototype.createDom = function() { var usersAc = new AutoCompleter({ url: '/get-users-info/',//askbot['urls']['get_users_info'], - preloadData: false, minChars: 1, useCache: true, matchInside: true, diff --git a/askbot/media/js/live_search.js b/askbot/media/js/live_search.js index e238a13f..b744e69e 100644 --- a/askbot/media/js/live_search.js +++ b/askbot/media/js/live_search.js @@ -420,7 +420,6 @@ FullTextSearch.prototype.activateTagSearchInput = function() { var me = this; var ac = new AutoCompleter({ url: askbot['urls']['get_tag_list'], - preloadData: true, minChars: 1, useCache: true, matchInside: true, diff --git a/askbot/media/js/post.js b/askbot/media/js/post.js index 5b9bf4ee..1fb1203f 100644 --- a/askbot/media/js/post.js +++ b/askbot/media/js/post.js @@ -1243,7 +1243,6 @@ var questionRetagger = function(){ //populate input var tagAc = new AutoCompleter({ url: askbot['urls']['get_tag_list'], - preloadData: true, minChars: 1, useCache: true, matchInside: true, @@ -3033,7 +3032,6 @@ TagEditor.prototype.decorate = function(element) { me.clearNewTagInput(); } }, - preloadData: true, minChars: 1, useCache: true, matchInside: true, @@ -4034,7 +4032,6 @@ $(document).ready(function() { var fakeUserAc = new AutoCompleter({ url: '/get-users-info/',//askbot['urls']['get_users_info'], - preloadData: true, promptText: gettext('User name:'), minChars: 1, useCache: true, @@ -4056,7 +4053,6 @@ $(document).ready(function() { if (groupsInput.length === 1) { var groupsAc = new AutoCompleter({ url: askbot['urls']['getGroupsList'], - preloadData: true, promptText: gettext('Group name:'), minChars: 1, useCache: false, @@ -4070,7 +4066,6 @@ $(document).ready(function() { if (usersInput.length === 1) { var usersAc = new AutoCompleter({ url: '/get-users-info/', - preloadData: true, promptText: gettext('User name:'), minChars: 1, useCache: false, diff --git a/askbot/media/js/tag_selector.js b/askbot/media/js/tag_selector.js index c1ccd691..dfc8a29a 100644 --- a/askbot/media/js/tag_selector.js +++ b/askbot/media/js/tag_selector.js @@ -372,7 +372,6 @@ function pickedTags(){ setupTagFilterControl('email'); var ac = new AutoCompleter({ url: askbot['urls']['get_tag_list'], - preloadData: true, minChars: 1, useCache: true, matchInside: true, diff --git a/askbot/media/js/user.js b/askbot/media/js/user.js index 2fd1195b..251ee004 100644 --- a/askbot/media/js/user.js +++ b/askbot/media/js/user.js @@ -950,7 +950,6 @@ GroupAdderWidget.prototype.decorate = function(element){ var groupsAc = new AutoCompleter({ url: askbot['urls']['getGroupsList'], - preloadData: true, minChars: 1, useCache: false, matchInside: false, diff --git a/askbot/media/js/utils.js b/askbot/media/js/utils.js index 8b549d59..6a00d364 100644 --- a/askbot/media/js/utils.js +++ b/askbot/media/js/utils.js @@ -2225,6 +2225,8 @@ var AutoCompleter = function(options) { */ this.finishOnBlur_ = true; + this._isRunning = false; + this.options.minChars = parseInt(this.options.minChars, 10); if (isNaN(this.options.minChars) || this.options.minChars < 1) { this.options.minChars = 2; @@ -2453,6 +2455,9 @@ AutoCompleter.prototype.activate = function() { }; AutoCompleter.prototype.activateNow = function() { + if (this._isRunning) { + return; + } var value = this.getValue(); if (value.length === 0) { this.finish(); @@ -2466,6 +2471,10 @@ AutoCompleter.prototype.activateNow = function() { } }; +AutoCompleter.prototype.setIsRunning = function(isRunning) { + this._isRunning = isRunning; +}; + AutoCompleter.prototype.fetchData = function(value) { var self = this; this.fetchRemoteData(value, function(remoteData) { @@ -2496,11 +2505,21 @@ AutoCompleter.prototype.fetchRemoteData = function(filter, callback) { }; $.ajax({ url: this.makeUrl(filter), - success: ajaxCallback, + success: function(data) { + ajaxCallback(data); + self.setIsRunning(false); + //if query changed - rerun the search immediately + var newQuery = self.getValue(); + if (newQuery && newQuery !== filter) { + self.activateNow(); + } + }, error: function() { ajaxCallback(false); + self.setIsRunning(false); } }); + self.setIsRunning(true); } }; @@ -2824,6 +2843,9 @@ AutoCompleter.prototype.isContentChar = function(symbol){ * autocompletable word */ AutoCompleter.prototype.getValue = function(){ + if (this._element === undefined) { + return ''; + } var sel = this._element.getSelection(); var text = this._element.val(); var pos = sel.start;//estimated start diff --git a/askbot/media/js/wmd/wmd.js b/askbot/media/js/wmd/wmd.js index 91d98694..ad56aee3 100644 --- a/askbot/media/js/wmd/wmd.js +++ b/askbot/media/js/wmd/wmd.js @@ -2472,21 +2472,15 @@ Attacklab.wmd_env = {}; Attacklab.account_options = {}; Attacklab.wmd_defaults = {version:1, output:"Markdown", lineLength:40, delayLoad:false}; -if(!Attacklab.wmd) -{ - Attacklab.wmd = function() - { - Attacklab.loadEnv = function() - { - var mergeEnv = function(env) - { - if(!env) - { +if (askbot['settings']['editorType'] == 'markdown' && !Attacklab.wmd) { + Attacklab.wmd = function() { + Attacklab.loadEnv = function() { + var mergeEnv = function(env) { + if(!env) { return; } - for(var key in env) - { + for(var key in env) { Attacklab.wmd_env[key] = env[key]; } }; @@ -2507,4 +2501,3 @@ if(!Attacklab.wmd) Attacklab.wmdBase(); Attacklab.Util.startEditor(); }; - diff --git a/askbot/media/style/style.css b/askbot/media/style/style.css index ced2398a..3b52c293 100644 --- a/askbot/media/style/style.css +++ b/askbot/media/style/style.css @@ -449,6 +449,20 @@ body.user-messages { height: 41px; z-index: 10000; position: relative; + /* the guts are absolute-positioned */ + +} +#searchBar input.searchInput, +#searchBar div.input-tool-tip, +#searchBar input[type="submit"].searchBtn, +#searchBar input[type="button"].cancelSearchBtn { + position: absolute; + z-index: 100; +} +#searchBar input.searchInput { + z-index: 99; + /* just below the buttons and the hint */ + } #searchBar input.searchInput { font-size: 22px; @@ -461,19 +475,36 @@ body.user-messages { font-family: Arial; width: 100%; margin: 8px 0 6px 0; - padding: 0; + padding: 0 80px 0 8px; + top: 0; + left: 0; -webkit-box-shadow: 0 0 0 #929292; -moz-box-shadow: 0 0 0 #929292; box-shadow: 0 0 0 #929292; + box-sizing: border-box; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; } #searchBar div.input-tool-tip { - margin-top: -40px; - padding-top: 10px; - height: 30px; - line-height: 20px; + padding: 0 0 0 10px; + height: 41px; + line-height: 41px; font-size: 20px; font-style: italic; - position: absolute; + bottom: 0; + left: 0; + box-sizing: border-box; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + width: 100% a; +} +#searchBar input[type="submit"].searchBtn { + right: 0; + top: 0; +} +#searchBar input[type="button"].cancelSearchBtn { + right: 48px; + top: 0; } .search-drop-menu { box-sizing: border-box; @@ -482,7 +513,6 @@ body.user-messages { border-top: none; margin: 0; position: relative; - top: 0; z-index: 10000; } .search-drop-menu ul { @@ -531,8 +561,7 @@ input[type="submit"].searchBtn { border: #FFF 1px solid; line-height: 22px; text-align: center; - float: right; - margin: 1px -48px 0 0; + margin: 1px 0 0 0; width: 48px; background: -98px -37px url(../images/sprites.png) no-repeat; border-radius: 0; @@ -544,7 +573,6 @@ input[type="submit"].searchBtn { -moz-box-shadow: 0 0 0 #929292; box-shadow: 0 0 0 #929292; cursor: pointer; - position: relative; z-index: 10001; } .groups-page input[type="submit"].searchBtn, @@ -597,9 +625,6 @@ input[type="button"].cancelSearchBtn { text-align: center; width: 35px !important; cursor: pointer; - float: right; - margin: -40px 0 0 0; - position: relative; z-index: 10001; } .cancelSearchBtn:hover { diff --git a/askbot/media/style/style.less b/askbot/media/style/style.less index 21a1bd06..a4c3a6b2 100644 --- a/askbot/media/style/style.less +++ b/askbot/media/style/style.less @@ -491,6 +491,19 @@ body.user-messages { z-index: 10000; position: relative; + /* the guts are absolute-positioned */ + input.searchInput, + div.input-tool-tip, + input[type="submit"].searchBtn, + input[type="button"].cancelSearchBtn { + position: absolute; + z-index: 100; + } + + input.searchInput { + z-index: 99;/* just below the buttons and the hint */ + } + input.searchInput { font-size: 22px; height: 26px; @@ -502,18 +515,36 @@ body.user-messages { font-family:@body-font; width: 100%; margin: 8px 0 6px 0; - padding: 0; + padding: 0 80px 0 8px; + top: 0; + left: 0; .box-shadow(0, 0, 0); + box-sizing: border-box; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; } div.input-tool-tip { - margin-top: -40px; - padding-top: 10px; - height: 30px; - line-height: 20px; + padding: 0 0 0 10px; + height: 41px; + line-height: 41px; font-size: 20px; font-style: italic; - position: absolute; + bottom: 0; + left: 0; + box-sizing: border-box; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + width: 100%a + } + + input[type="submit"].searchBtn { + right: 0; + top: 0; + } + input[type="button"].cancelSearchBtn { + right: 48px; + top: 0; } } @@ -524,7 +555,6 @@ body.user-messages { border-top: none; margin: 0; position: relative; - top: 0; z-index: 10000; ul { @@ -581,14 +611,12 @@ input[type="submit"].searchBtn { border:#FFF 1px solid; line-height: 22px; text-align: center; - float:right; - margin: 1px -48px 0 0; + margin: 1px 0 0 0; width: 48px; .sprites(-98px,-37px); .rounded-corners(0); .box-shadow(0, 0, 0); cursor:pointer; - position: relative; z-index: 10001; } @@ -643,9 +671,6 @@ input[type="button"].cancelSearchBtn { text-align: center; width: 35px !important; cursor:pointer; - float: right; - margin: -40px 0 0 0; - position: relative; z-index: 10001; } diff --git a/askbot/templates/macros.html b/askbot/templates/macros.html index 29f88621..2d345940 100644 --- a/askbot/templates/macros.html +++ b/askbot/templates/macros.html @@ -539,7 +539,6 @@ for the purposes of the AJAX comment editor #} {%- macro tag_autocomplete_js(id = '#id_tags') -%} var tagAc = new AutoCompleter({ url: '{% url "get_tag_list" %}', - preloadData: true, minChars: 1, useCache: true, matchInside: true, diff --git a/askbot/views/writers.py b/askbot/views/writers.py index 58530522..4ad7ea7b 100644 --- a/askbot/views/writers.py +++ b/askbot/views/writers.py @@ -122,8 +122,8 @@ def upload(request):#ajax upload file to a question or answer # 'file_url': file_url #}) #return HttpResponse(data, mimetype = 'application/json') - xml_template = "<result><msg><![CDATA[%s]]></msg><error><![CDATA[%s]]></error><file_url>%s</file_url></result>" - xml = xml_template % (result, error, file_url) + xml_template = "<result><msg><![CDATA[%s]]></msg><error><![CDATA[%s]]></error><file_url>%s</file_url><orig_file_name><![CDATA[%s]]></orig_file_name></result>" + xml = xml_template % (result, error, file_url, f.name) return HttpResponse(xml, mimetype="application/xml") |