From 3ca078f9aef1ae6383ae6dd72fca4811403aeafa Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Mon, 14 May 2012 20:31:56 -0400 Subject: fixed height of the tag input box at 64px --- askbot/skins/common/media/js/post.js | 26 ++++++++++++++++++++++++++ askbot/skins/default/media/style/style.less | 11 ++++++----- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/askbot/skins/common/media/js/post.js b/askbot/skins/common/media/js/post.js index 87e00688..b830eb94 100644 --- a/askbot/skins/common/media/js/post.js +++ b/askbot/skins/common/media/js/post.js @@ -2427,6 +2427,7 @@ TagEditor.prototype.addTag = function(tag_name) { me.removeSelectedTag(tag_name); tag.dispose(); $('.acResults').hide();//a hack to hide the autocompleter + me.fixHeight(); }); this._tags_container.append(tag.getElement()); this.addSelectedTag(tag_name); @@ -2437,6 +2438,7 @@ TagEditor.prototype.getAddTagHandler = function() { return function(tag_name) { me.addTag(tag_name); me.clearNewTagInput(); + me.fixHeight(); }; }; @@ -2477,6 +2479,27 @@ TagEditor.prototype.completeTagInput = function() { } }; +TagEditor.prototype.saveHeight = function() { + return; + var elem = this._visible_tags_input; + this._height = elem.offset().top; +}; + +TagEditor.prototype.fixHeight = function() { + return; + var new_height = this._visible_tags_input.offset().top; + //@todo: replace this by real measurement + var element_height = parseInt( + this._element.css('height').replace('px', '') + ); + if (new_height > this._height) { + this._element.css('height', element_height + 28);//magic number!!! + } else if (new_height < this._height) { + this._element.css('height', element_height - 28);//magic number!!! + } + this.saveHeight(); +}; + TagEditor.prototype.getTagInputKeyHandler = function() { var new_tags = this._visible_tags_input; var me = this; @@ -2484,6 +2507,7 @@ TagEditor.prototype.getTagInputKeyHandler = function() { if (e.shiftKey) { return; } + me.saveHeight(); var key = e.which || e.keyCode; var text = me.getRawNewTagValue(); //space 32, backspace 8, enter 13 @@ -2503,6 +2527,7 @@ TagEditor.prototype.getTagInputKeyHandler = function() { if (key !== 8) { me.setHotBackspace(false); } + me.fixHeight(); return false; }; } @@ -2514,6 +2539,7 @@ TagEditor.prototype.decorate = function(element) { var visible_tags_input = element.find('.new-tags-input'); this._visible_tags_input = visible_tags_input; + this.saveHeight(); var me = this; var tagsAc = new AutoCompleter({ diff --git a/askbot/skins/default/media/style/style.less b/askbot/skins/default/media/style/style.less index fe0d6e34..49b2ab12 100644 --- a/askbot/skins/default/media/style/style.less +++ b/askbot/skins/default/media/style/style.less @@ -3581,20 +3581,21 @@ textarea.tipped-input { /* tag editor */ .tag-editor { - height: 36px; + height: 64px; border: #ccc 3px solid; padding-left: 8px; ul.tags { - margin: 7px 0 0 0; + margin: 0; li { - margin-top: 1px; + margin-top: 8px; } } input.new-tags-input { - line-height: 16px; + border-style: none; font-size: 15px; font-color: @info-text; - border-style: none; + line-height: 16px; + margin-top: 9px; } } -- cgit v1.2.3-1-g7c22