diff --git a/apps/common/main/lib/collection/Comments.js b/apps/common/main/lib/collection/Comments.js index 96442986a..f12ef4c7f 100644 --- a/apps/common/main/lib/collection/Comments.js +++ b/apps/common/main/lib/collection/Comments.js @@ -58,6 +58,7 @@ define([ this.each(function(comment) { comment.set('editText', false); comment.set('editTextInPopover', false); + comment.set('showBtnsInPopover', false); comment.set('showReply', false); comment.set('showReplyInPopover', true); comment.set('hideAddReply', false); diff --git a/apps/common/main/lib/model/Comment.js b/apps/common/main/lib/model/Comment.js index dd5086a68..598ab4c3e 100644 --- a/apps/common/main/lib/model/Comment.js +++ b/apps/common/main/lib/model/Comment.js @@ -73,6 +73,7 @@ define([ time : 0, showReply : false, showReplyInPopover : true, + showBtnsInPopover : false, editText : false, editTextInPopover : false, last : undefined, diff --git a/apps/common/main/lib/template/CommentsPopover.template b/apps/common/main/lib/template/CommentsPopover.template index 5185f152d..7a8a03ce0 100644 --- a/apps/common/main/lib/template/CommentsPopover.template +++ b/apps/common/main/lib/template/CommentsPopover.template @@ -11,7 +11,7 @@
<%=scope.pickLink(comment)%>
<% } else { %>
- + <% if (hideAddReply) { %> <% } else { %> @@ -64,9 +64,9 @@ <% if (showReplyInPopover && !hideAddReply && !hint && !scope.viewmode) { %>
- <% if(true) { %> - - + <% if(showBtnsInPopover) { %> + + <% } %>
<% } %> diff --git a/apps/common/main/lib/view/Comments.js b/apps/common/main/lib/view/Comments.js index a71856530..879779f17 100644 --- a/apps/common/main/lib/view/Comments.js +++ b/apps/common/main/lib/view/Comments.js @@ -102,7 +102,7 @@ define([ var view = this, textBox = $(this.el).find('textarea'), domTextBox = null, - minHeight = 21, + minHeight = 55, lineHeight = 0, scrollPos = 0, oldHeight = 0, diff --git a/apps/common/main/lib/view/ReviewPopover.js b/apps/common/main/lib/view/ReviewPopover.js index 578efe39f..bf10d2b0e 100644 --- a/apps/common/main/lib/view/ReviewPopover.js +++ b/apps/common/main/lib/view/ReviewPopover.js @@ -140,10 +140,6 @@ define([ body.css('position', 'relative'); } - me.$window.on('focus', 'textarea', function(e) { me.commentsView.onFocusTextarea(e.currentTarget) }); - me.$window.on('blur', 'textarea', function(e) { me.commentsView.onBlurTextarea(e.currentTarget) }); - - var CommentsPopoverDataView = Common.UI.DataView.extend((function () { var parentView = me; @@ -156,19 +152,6 @@ define([ template: _.template('
') }, - onFocusTextarea: function(textarea) { - if($(textarea).parent().hasClass('reply-ct')) - me.$window.find('.reply-ct button').show(); - }, - - onBlurTextarea: function(textarea) { - if($(textarea).parent().hasClass('reply-ct')){ - setTimeout(() => { - me.$window.find('.reply-ct button').hide(); - }, 120); - } - }, - getTextBox: function () { var text = $(this.el).find('textarea'); return (text && text.length) ? text : undefined; @@ -194,7 +177,7 @@ define([ var view = this, textBox = this.$el.find('textarea'), domTextBox = null, - minHeight = 21, + minHeight = parseFloat(textBox.css('height')), lineHeight = 0, scrollPos = 0, oldHeight = 0, @@ -478,6 +461,11 @@ define([ me.fireEvent('comment:resolve', [commentId]); readdresolves(); + } else if(btn.hasClass('msg-reply') && btn.parent().hasClass('reply-ct') && !record.get('showBtnsInPopover')) { + var val = $(e.target).val(); + record.set('showBtnsInPopover', true); + this.setFocusToTextBox(); + this.getTextBox().val(val); } } }); @@ -502,7 +490,6 @@ define([ me.on({ 'show': function (picker, item, record, e) { - me.commentsView.autoHeightTextBox(); me.$window.find('textarea').keydown(function (event) { if (event.keyCode == Common.UI.Keys.ESC) { me.hide(true); // clear text in dummy comment @@ -510,6 +497,7 @@ define([ }); }, 'animate:before': function () { + me.commentsView.autoHeightTextBox(); var text = me.$window.find('textarea'); if (text && text.length && !$(text).parent().hasClass('reply-ct')){ me.commentsView.setFocusToTextBox(); diff --git a/apps/common/main/resources/less/comments.less b/apps/common/main/resources/less/comments.less index a61089301..ce23b1d45 100644 --- a/apps/common/main/resources/less/comments.less +++ b/apps/common/main/resources/less/comments.less @@ -127,6 +127,10 @@ color: @border-preview-select-ie; color: @border-preview-select; + .new-comment-textarea { + height: 55px; + } + textarea { width: 100%; height: 21px; @@ -477,6 +481,12 @@ } } +#comments-box { + textarea { + height: 55px; + } +} + .comments-caret { width: 7px; height: 7px;