Disable textarea button for comments
This commit is contained in:
parent
169c39a58f
commit
1394b55c54
|
@ -968,11 +968,11 @@ define([
|
|||
|
||||
if (!comment) continue;
|
||||
|
||||
if (this.subEditStrings[saveTxtId] && !hint) {
|
||||
if (this.subEditStrings[saveTxtId] && (comment.get('fullInfoInHint') || !hint)) {
|
||||
comment.set('editTextInPopover', true);
|
||||
text = this.subEditStrings[saveTxtId];
|
||||
}
|
||||
else if (this.subEditStrings[saveTxtReplyId] && !hint) {
|
||||
else if (this.subEditStrings[saveTxtReplyId] && (comment.get('fullInfoInHint') || !hint)) {
|
||||
comment.set('showReplyInPopover', true);
|
||||
text = this.subEditStrings[saveTxtReplyId];
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<div class="color" style="display: inline-block; background-color: <% if (usercolor!==null) { %><%=usercolor%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getEncodedName(parsedName) %>
|
||||
</div>
|
||||
<div class="user-date"><%=date%></div>
|
||||
<% if (!editTextInPopover || hint || scope.viewmode) { %>
|
||||
<% if (!editTextInPopover || (hint && !fullInfoInHint) || scope.viewmode) { %>
|
||||
<div oo_editor_input="true" tabindex="-1" class="user-message user-select"><%=scope.pickLink(comment)%></div>
|
||||
<% } else { %>
|
||||
<div class="inner-edit-ct">
|
||||
|
|
|
@ -98,6 +98,17 @@ define([
|
|||
var text = $(this.el).find('textarea');
|
||||
return (text && text.length) ? text.val().trim() : '';
|
||||
},
|
||||
disableTextBoxButton: function(textboxEl) {
|
||||
var button = $(textboxEl.siblings('#id-comments-change')[0]);
|
||||
|
||||
if(textboxEl.val().length > 0) {
|
||||
button.removeAttr('disabled');
|
||||
button.removeClass('disabled');
|
||||
} else {
|
||||
button.attr('disabled', true);
|
||||
button.addClass('disabled');
|
||||
}
|
||||
},
|
||||
autoHeightTextBox: function () {
|
||||
var view = this,
|
||||
textBox = $(this.el).find('textarea'),
|
||||
|
@ -127,13 +138,19 @@ define([
|
|||
view.autoScrollToEditButtons();
|
||||
}
|
||||
|
||||
function onTextareaInput(event) {
|
||||
updateTextBoxHeight();
|
||||
view.disableTextBoxButton($(event.target));
|
||||
}
|
||||
|
||||
if (textBox && textBox.length) {
|
||||
domTextBox = textBox.get(0);
|
||||
|
||||
view.disableTextBoxButton(textBox);
|
||||
if (domTextBox) {
|
||||
lineHeight = parseInt(textBox.css('lineHeight'), 10) * 0.25;
|
||||
updateTextBoxHeight();
|
||||
textBox.bind('input propertychange', updateTextBoxHeight)
|
||||
textBox.bind('input propertychange', onTextareaInput)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,7 +188,7 @@ define([
|
|||
|
||||
addCommentHeight: 45,
|
||||
newCommentHeight: 110,
|
||||
textBoxAutoSizeLocked: undefined, // disable autosize textbox
|
||||
textBoxAutoSizeLocked: undefined, // disable autoHeightTextBoxsize textbox
|
||||
viewmode: false,
|
||||
|
||||
_commentsViewOnItemClick: function (picker, item, record, e) {
|
||||
|
@ -694,7 +711,17 @@ define([
|
|||
this.layout.setResizeValue(0, container.height() - this.addCommentHeight);
|
||||
}
|
||||
},
|
||||
disableTextBoxButton: function(textboxEl) {
|
||||
var button = $(textboxEl.parent().siblings('.add')[0]);
|
||||
|
||||
if(textboxEl.val().length > 0) {
|
||||
button.removeAttr('disabled');
|
||||
button.removeClass('disabled');
|
||||
} else {
|
||||
button.attr('disabled', true);
|
||||
button.addClass('disabled');
|
||||
}
|
||||
},
|
||||
autoHeightTextBox: function () {
|
||||
var me = this, domTextBox = null, lineHeight = 0, minHeight = 44;
|
||||
var textBox = $('#comment-msg-new', this.el);
|
||||
|
@ -736,9 +763,15 @@ define([
|
|||
Math.min(height - contentHeight - textBoxMinHeightIndent, height - me.newCommentHeight)));
|
||||
}
|
||||
|
||||
function onTextareaInput(event) {
|
||||
updateTextBoxHeight();
|
||||
me.disableTextBoxButton($(event.target));
|
||||
}
|
||||
|
||||
me.disableTextBoxButton(textBox);
|
||||
lineHeight = parseInt(textBox.css('lineHeight'), 10) * 0.25;
|
||||
updateTextBoxHeight();
|
||||
textBox.bind('input propertychange', updateTextBoxHeight);
|
||||
textBox.bind('input propertychange', onTextareaInput);
|
||||
|
||||
this.textBox = textBox;
|
||||
},
|
||||
|
|
|
@ -173,6 +173,17 @@ define([
|
|||
var text = $(this.el).find('textarea');
|
||||
return (text && text.length) ? text.val().trim() : '';
|
||||
},
|
||||
disableTextBoxButton: function(textboxEl) {
|
||||
var button = $(textboxEl.siblings('#id-comments-change-popover')[0]);
|
||||
|
||||
if(textboxEl.val().length > 0) {
|
||||
button.removeAttr('disabled');
|
||||
button.removeClass('disabled');
|
||||
} else {
|
||||
button.attr('disabled', true);
|
||||
button.addClass('disabled');
|
||||
}
|
||||
},
|
||||
autoHeightTextBox: function () {
|
||||
var view = this,
|
||||
textBox = this.$el.find('textarea'),
|
||||
|
@ -183,6 +194,7 @@ define([
|
|||
oldHeight = 0,
|
||||
newHeight = 0;
|
||||
|
||||
|
||||
function updateTextBoxHeight() {
|
||||
scrollPos = parentView.scroller.getScrollTop();
|
||||
if (domTextBox.scrollHeight > domTextBox.clientHeight) {
|
||||
|
@ -211,13 +223,20 @@ define([
|
|||
parentView.autoScrollToEditButtons();
|
||||
}
|
||||
|
||||
function onTextareaInput(event) {
|
||||
updateTextBoxHeight();
|
||||
view.disableTextBoxButton($(event.target));
|
||||
}
|
||||
|
||||
|
||||
if (textBox && textBox.length && parentView.scroller) {
|
||||
domTextBox = textBox.get(0);
|
||||
|
||||
view.disableTextBoxButton(textBox);
|
||||
if (domTextBox) {
|
||||
lineHeight = parseInt(textBox.css('lineHeight'), 10) * 0.25;
|
||||
updateTextBoxHeight();
|
||||
textBox.bind('input propertychange', updateTextBoxHeight)
|
||||
textBox.bind('input propertychange', onTextareaInput)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -519,8 +538,10 @@ define([
|
|||
},
|
||||
'animate:before': function () {
|
||||
var text = me.$window.find('textarea');
|
||||
if (text && text.length)
|
||||
if (text && text.length){
|
||||
text.focus();
|
||||
me.commentsView.disableTextBoxButton(text);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue