Show comments and review changes in the same window
This commit is contained in:
parent
bb29cc5e27
commit
dbdf13f1a1
|
@ -46,7 +46,8 @@ define([
|
|||
'core',
|
||||
'common/main/lib/model/Comment',
|
||||
'common/main/lib/collection/Comments',
|
||||
'common/main/lib/view/Comments'
|
||||
'common/main/lib/view/Comments',
|
||||
'common/main/lib/view/ReviewPopover'
|
||||
], function () {
|
||||
'use strict';
|
||||
|
||||
|
@ -67,7 +68,7 @@ define([
|
|||
],
|
||||
views : [
|
||||
'Common.Views.Comments',
|
||||
'Common.Views.CommentsPopover'
|
||||
'Common.Views.ReviewPopover'
|
||||
],
|
||||
sdkViewName : '#id_main',
|
||||
subEditStrings : {},
|
||||
|
@ -101,6 +102,27 @@ define([
|
|||
|
||||
// work handlers
|
||||
|
||||
'comment:closeEditing': _.bind(this.closeEditing, this)
|
||||
},
|
||||
|
||||
'Common.Views.ReviewPopover': {
|
||||
|
||||
// comments handlers
|
||||
|
||||
'comment:change': _.bind(this.onChangeComment, this),
|
||||
'comment:remove': _.bind(this.onRemoveComment, this),
|
||||
'comment:resolve': _.bind(this.onResolveComment, this),
|
||||
'comment:show': _.bind(this.onShowComment, this),
|
||||
|
||||
// reply handlers
|
||||
|
||||
'comment:addReply': _.bind(this.onAddReplyComment, this),
|
||||
'comment:changeReply': _.bind(this.onChangeReplyComment, this),
|
||||
'comment:removeReply': _.bind(this.onRemoveReplyComment, this),
|
||||
'comment:editReply': _.bind(this.onShowEditReplyComment, this),
|
||||
|
||||
// work handlers
|
||||
|
||||
'comment:closeEditing': _.bind(this.closeEditing, this),
|
||||
'comment:disableHint': _.bind(this.disableHint, this),
|
||||
'comment:addDummyComment': _.bind(this.onAddDummyComment, this)
|
||||
|
@ -128,10 +150,7 @@ define([
|
|||
this.popoverComments.comparator = function (collection) { return -collection.get('time'); };
|
||||
}
|
||||
|
||||
this.view = this.createView('Common.Views.Comments', {
|
||||
store : this.collection,
|
||||
popoverComments : this.popoverComments
|
||||
});
|
||||
this.view = this.createView('Common.Views.Comments', { store: this.collection });
|
||||
this.view.render();
|
||||
|
||||
this.userCollection = this.getApplication().getCollection('Common.Collections.Users');
|
||||
|
@ -270,7 +289,7 @@ define([
|
|||
|
||||
if (comment.get('unattached')) {
|
||||
if (this.getPopover()) {
|
||||
this.getPopover().hide();
|
||||
this.getPopover().hideComments();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -296,7 +315,7 @@ define([
|
|||
}
|
||||
|
||||
if (this.getPopover()) {
|
||||
this.getPopover().hide();
|
||||
this.getPopover().hideComments();
|
||||
}
|
||||
|
||||
this.isSelectedComment = false;
|
||||
|
@ -670,7 +689,7 @@ define([
|
|||
this.popoverComments.remove(model);
|
||||
if (0 === this.popoverComments.length) {
|
||||
if (this.getPopover()) {
|
||||
this.getPopover().hide();
|
||||
this.getPopover().hideComments();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -863,7 +882,7 @@ define([
|
|||
}
|
||||
|
||||
popover.setLeftTop(posX, posY, leftX);
|
||||
popover.show(animate, false, true, text);
|
||||
popover.showComments(animate, false, true, text);
|
||||
}
|
||||
},
|
||||
onApiHideComment: function (hint) {
|
||||
|
@ -887,7 +906,7 @@ define([
|
|||
});
|
||||
|
||||
this.getPopover().saveText(true);
|
||||
this.getPopover().hide();
|
||||
this.getPopover().hideComments();
|
||||
|
||||
this.collection.clearEditing();
|
||||
this.popoverComments.clearEditing();
|
||||
|
@ -941,9 +960,9 @@ define([
|
|||
}
|
||||
|
||||
useAnimation = true;
|
||||
this.getPopover().show(useAnimation, undefined, undefined, text);
|
||||
this.getPopover().showComments(useAnimation, undefined, undefined, text);
|
||||
} else if (!this.getPopover().isVisible()) {
|
||||
this.getPopover().show(false, undefined, undefined, text);
|
||||
this.getPopover().showComments(false, undefined, undefined, text);
|
||||
}
|
||||
|
||||
this.getPopover().setLeftTop(posX, posY, leftX, undefined, true);
|
||||
|
@ -1078,8 +1097,16 @@ define([
|
|||
}
|
||||
}
|
||||
},
|
||||
|
||||
getPopover: function () {
|
||||
return this.view.getPopover(this.sdkViewName);
|
||||
if (_.isUndefined(this.popover)) {
|
||||
this.popover = Common.Views.ReviewPopover.prototype.getPopover({
|
||||
commentsStore : this.popoverComments,
|
||||
renderTo : this.sdkViewName
|
||||
});
|
||||
this.popover.setCommentsStore(this.popoverComments);
|
||||
}
|
||||
return this.popover;
|
||||
},
|
||||
|
||||
// helpers
|
||||
|
@ -1225,7 +1252,7 @@ define([
|
|||
anchor.asc_getY(),
|
||||
this.hintmode ? anchor.asc_getX() : undefined);
|
||||
|
||||
dialog.show(true, false, true);
|
||||
dialog.showComments(true, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1243,7 +1270,7 @@ define([
|
|||
|
||||
this.popoverComments.reset();
|
||||
if (this.getPopover().isVisible()) {
|
||||
this.getPopover().hide();
|
||||
this.getPopover().hideComments();
|
||||
}
|
||||
comment.asc_putText(commentVal);
|
||||
comment.asc_putTime(this.utcDateToString(new Date()));
|
||||
|
@ -1280,7 +1307,7 @@ define([
|
|||
});
|
||||
|
||||
if (dialog.isVisible()) {
|
||||
dialog.hide();
|
||||
dialog.hideComments();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1325,7 +1352,7 @@ define([
|
|||
anchor.asc_getY(),
|
||||
this.hintmode ? anchor.asc_getX() : undefined);
|
||||
|
||||
this.getPopover().show(true, false, true);
|
||||
this.getPopover().showComments(true, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ define([
|
|||
'common/main/lib/model/ReviewChange',
|
||||
'common/main/lib/collection/ReviewChanges',
|
||||
'common/main/lib/view/ReviewChanges',
|
||||
'common/main/lib/view/ReviewPopover',
|
||||
'common/main/lib/view/LanguageDialog'
|
||||
], function () {
|
||||
'use strict';
|
||||
|
@ -58,7 +59,7 @@ define([
|
|||
],
|
||||
views : [
|
||||
'Common.Views.ReviewChanges',
|
||||
'Common.Views.ReviewChangesPopover'
|
||||
'Common.Views.ReviewPopover'
|
||||
],
|
||||
sdkViewName : '#id_main',
|
||||
|
||||
|
@ -69,8 +70,6 @@ define([
|
|||
'settings:apply': this.applySettings.bind(this)
|
||||
},
|
||||
'Common.Views.ReviewChanges': {
|
||||
|
||||
// comments handlers
|
||||
'reviewchange:accept': _.bind(this.onAcceptClick, this),
|
||||
'reviewchange:reject': _.bind(this.onRejectClick, this),
|
||||
'reviewchange:delete': _.bind(this.onDeleteClick, this),
|
||||
|
@ -83,6 +82,11 @@ define([
|
|||
'reviewchange:accept': _.bind(this.onAcceptClick, this),
|
||||
'reviewchange:reject': _.bind(this.onRejectClick, this),
|
||||
'reviewchange:preview': _.bind(this.onBtnPreviewClick, this)
|
||||
},
|
||||
'Common.Views.ReviewPopover': {
|
||||
'reviewchange:accept': _.bind(this.onAcceptClick, this),
|
||||
'reviewchange:reject': _.bind(this.onRejectClick, this),
|
||||
'reviewchange:delete': _.bind(this.onDeleteClick, this)
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -122,12 +126,7 @@ define([
|
|||
setMode: function(mode) {
|
||||
this.appConfig = mode;
|
||||
this.popoverChanges = new Common.Collections.ReviewChanges();
|
||||
|
||||
this.view = this.createView('Common.Views.ReviewChanges', {
|
||||
// store : this.collection,
|
||||
popoverChanges : this.popoverChanges,
|
||||
mode : mode
|
||||
});
|
||||
this.view = this.createView('Common.Views.ReviewChanges', { mode: mode });
|
||||
|
||||
return this;
|
||||
},
|
||||
|
@ -153,10 +152,10 @@ define([
|
|||
|
||||
if (animate) {
|
||||
if ( this.getPopover().isVisible() ) this.getPopover().hide();
|
||||
this.getPopover().setLeftTop(posX+25, posY);
|
||||
this.getPopover().setLeftTop(posX, posY);
|
||||
}
|
||||
|
||||
this.getPopover().show(animate, lock, lockUser);
|
||||
this.getPopover().showReview(animate, lock, lockUser);
|
||||
|
||||
if (!this.appConfig.isReviewOnly && this._state.lock !== lock) {
|
||||
this.view.btnAccept.setDisabled(lock==true);
|
||||
|
@ -175,8 +174,8 @@ define([
|
|||
this._state.posx = this._state.posy = -1000;
|
||||
this._state.changes_length = 0;
|
||||
this._state.popoverVisible = false;
|
||||
this.getPopover().hide();
|
||||
this.popoverChanges.reset();
|
||||
this.getPopover().hideReview();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -194,7 +193,7 @@ define([
|
|||
} else if (this.popoverChanges.length>0) {
|
||||
if (!this.getPopover().isVisible())
|
||||
this.getPopover().show(false);
|
||||
this.getPopover().setLeftTop(posX+25, posY);
|
||||
this.getPopover().setLeftTop(posX, posY);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -208,7 +207,14 @@ define([
|
|||
},
|
||||
|
||||
getPopover: function () {
|
||||
return this.view.getPopover(this.sdkViewName);
|
||||
if (this.appConfig.canReview && _.isUndefined(this.popover)) {
|
||||
this.popover = Common.Views.ReviewPopover.prototype.getPopover({
|
||||
reviewStore : this.popoverChanges,
|
||||
renderTo : this.sdkViewName
|
||||
});
|
||||
this.popover.setReviewStore(this.popoverChanges);
|
||||
}
|
||||
return this.popover;
|
||||
},
|
||||
|
||||
// helpers
|
||||
|
|
|
@ -48,14 +48,13 @@ Common.Views = Common.Views || {};
|
|||
define([
|
||||
'text!common/main/lib/template/Comments.template',
|
||||
'text!common/main/lib/template/CommentsPanel.template',
|
||||
'text!common/main/lib/template/CommentsPopover.template',
|
||||
'common/main/lib/util/utils',
|
||||
'common/main/lib/component/Button',
|
||||
'common/main/lib/component/ComboBox',
|
||||
'common/main/lib/component/DataView',
|
||||
'common/main/lib/component/Layout',
|
||||
'common/main/lib/component/Window'
|
||||
], function (commentsTemplate, panelTemplate, popoverTemplate) {
|
||||
], function (commentsTemplate, panelTemplate) {
|
||||
'use strict';
|
||||
|
||||
function replaceWords (template, words) {
|
||||
|
@ -73,759 +72,6 @@ define([
|
|||
return tpl;
|
||||
}
|
||||
|
||||
Common.Views.CommentsPopover = Common.UI.Window.extend({
|
||||
|
||||
// Window
|
||||
|
||||
initialize : function (options) {
|
||||
var _options = {};
|
||||
|
||||
_.extend(_options, {
|
||||
closable : false,
|
||||
width : 265,
|
||||
height : 120,
|
||||
header : false,
|
||||
modal : false
|
||||
}, options);
|
||||
|
||||
this.template = options.template || [
|
||||
'<div class="box">',
|
||||
'<div id="id-comments-popover" class="comments-popover"></div>',
|
||||
'<div id="id-comments-arrow" class="comments-arrow"></div>',
|
||||
'</div>'
|
||||
].join('');
|
||||
|
||||
this.store = options.store;
|
||||
this.delegate = options.delegate;
|
||||
|
||||
_options.tpl = _.template(this.template)(_options);
|
||||
|
||||
this.arrow = {margin: 20, width: 12, height: 34};
|
||||
this.sdkBounds = {width: 0, height: 0, padding: 10, paddingTop: 20};
|
||||
|
||||
Common.UI.Window.prototype.initialize.call(this, _options);
|
||||
},
|
||||
render: function () {
|
||||
Common.UI.Window.prototype.render.call(this);
|
||||
|
||||
var me = this,
|
||||
t = this.delegate,
|
||||
window = this.$window;
|
||||
|
||||
window.css({
|
||||
height: '',
|
||||
minHeight: '',
|
||||
overflow: 'hidden',
|
||||
position: 'absolute',
|
||||
zIndex: '990'
|
||||
});
|
||||
|
||||
// for spreadsheets - bug 23127
|
||||
|
||||
// if ($('#ws-h-scrollbar').length) {
|
||||
// window.css({zIndex: '5'});
|
||||
// }
|
||||
|
||||
var body = window.find('.body');
|
||||
if (body) {
|
||||
body.css('position', 'relative');
|
||||
}
|
||||
|
||||
window.on('click', _.bind(function() {
|
||||
window.css({zIndex: '991'});
|
||||
Common.NotificationCenter.trigger('comments:click');
|
||||
}, this));
|
||||
Common.NotificationCenter.on('review:click', function() {
|
||||
window.css({zIndex: '990'});
|
||||
});
|
||||
|
||||
var PopoverDataView = Common.UI.DataView.extend((function() {
|
||||
|
||||
var parentView = me;
|
||||
|
||||
return {
|
||||
|
||||
options : {
|
||||
handleSelect: false,
|
||||
scrollable: true,
|
||||
template: _.template('<div class="dataview-ct inner" style="overflow-y: hidden;"></div>')
|
||||
},
|
||||
|
||||
getTextBox: function () {
|
||||
var text = $(this.el).find('textarea');
|
||||
return (text && text.length) ? text : undefined;
|
||||
},
|
||||
setFocusToTextBox: function (blur) {
|
||||
var text = $(this.el).find('textarea');
|
||||
if (blur) {
|
||||
text.blur();
|
||||
} else {
|
||||
if (text && text.length) {
|
||||
var val = text.val();
|
||||
text.focus();
|
||||
text.val('');
|
||||
text.val(val);
|
||||
}
|
||||
}
|
||||
},
|
||||
getActiveTextBoxVal: function () {
|
||||
var text = $(this.el).find('textarea');
|
||||
return (text && text.length) ? text.val().trim() : '';
|
||||
},
|
||||
autoHeightTextBox: function () {
|
||||
var view = this,
|
||||
textBox = this.$el.find('textarea'),
|
||||
domTextBox = null,
|
||||
minHeight = 50,
|
||||
lineHeight = 0,
|
||||
scrollPos = 0,
|
||||
oldHeight = 0,
|
||||
newHeight = 0;
|
||||
|
||||
function updateTextBoxHeight() {
|
||||
scrollPos = view.scroller.getScrollTop();
|
||||
|
||||
if (domTextBox.scrollHeight > domTextBox.clientHeight) {
|
||||
textBox.css({height: (domTextBox.scrollHeight + lineHeight) + 'px'});
|
||||
|
||||
parentView.calculateSizeOfContent();
|
||||
} else {
|
||||
oldHeight = domTextBox.clientHeight;
|
||||
if (oldHeight >= minHeight) {
|
||||
textBox.css({height: minHeight + 'px'});
|
||||
|
||||
if (domTextBox.scrollHeight > domTextBox.clientHeight) {
|
||||
newHeight = Math.max(domTextBox.scrollHeight + lineHeight, minHeight);
|
||||
textBox.css({height: newHeight + 'px'});
|
||||
}
|
||||
|
||||
parentView.calculateSizeOfContent();
|
||||
parentView.setLeftTop(me.arrowPosX, me.arrowPosY, me.leftX);
|
||||
parentView.calculateSizeOfContent();
|
||||
}
|
||||
}
|
||||
|
||||
view.scroller.scrollTop(scrollPos);
|
||||
view.autoScrollToEditButtons();
|
||||
}
|
||||
|
||||
if (textBox && textBox.length) {
|
||||
domTextBox = textBox.get(0);
|
||||
|
||||
if (domTextBox) {
|
||||
lineHeight = parseInt(textBox.css('lineHeight'), 10) * 0.25;
|
||||
updateTextBoxHeight();
|
||||
textBox.bind('input propertychange', updateTextBoxHeight)
|
||||
}
|
||||
}
|
||||
|
||||
this.textBox = textBox;
|
||||
},
|
||||
clearTextBoxBind: function () {
|
||||
if (this.textBox) {
|
||||
this.textBox.unbind('input propertychange');
|
||||
this.textBox = undefined;
|
||||
}
|
||||
},
|
||||
autoScrollToEditButtons: function () {
|
||||
var button = $('#id-comments-change-popover'), // TODO: add to cache
|
||||
btnBounds = null,
|
||||
contentBounds = this.el.getBoundingClientRect(),
|
||||
moveY = 0,
|
||||
padding = 7;
|
||||
|
||||
if (button.length) {
|
||||
btnBounds = button.get(0).getBoundingClientRect();
|
||||
if (btnBounds && contentBounds) {
|
||||
moveY = contentBounds.bottom - (btnBounds.bottom + padding);
|
||||
if (moveY < 0) {
|
||||
this.scroller.scrollTop(this.scroller.getScrollTop() - moveY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})());
|
||||
if (PopoverDataView) {
|
||||
if (this.commentsView) {
|
||||
this.commentsView.render($('#id-comments-popover'));
|
||||
this.commentsView.onResetItems();
|
||||
} else {
|
||||
this.commentsView = new PopoverDataView({
|
||||
el: $('#id-comments-popover'),
|
||||
store: me.store,
|
||||
itemTemplate: _.template(replaceWords(popoverTemplate, {
|
||||
textAddReply: t.textAddReply,
|
||||
textAdd: t.textAdd,
|
||||
textCancel: t.textCancel,
|
||||
textEdit: t.textEdit,
|
||||
textReply: t.textReply,
|
||||
textClose: t.textClose,
|
||||
maxCommLength: Asc.c_oAscMaxCellOrCommentLength
|
||||
})
|
||||
)
|
||||
});
|
||||
|
||||
var addtooltip = function (dataview, view, record) {
|
||||
if (view.tipsArray) {
|
||||
view.tipsArray.forEach(function(item){
|
||||
item.remove();
|
||||
});
|
||||
}
|
||||
|
||||
var arr = [],
|
||||
btns = $(view.el).find('.btn-resolve');
|
||||
btns.tooltip({title: t.textResolve, placement: 'cursor'});
|
||||
btns.each(function(idx, item){
|
||||
arr.push($(item).data('bs.tooltip').tip());
|
||||
});
|
||||
btns = $(view.el).find('.btn-resolve-check');
|
||||
btns.tooltip({title: t.textOpenAgain, placement: 'cursor'});
|
||||
btns.each(function(idx, item){
|
||||
arr.push($(item).data('bs.tooltip').tip());
|
||||
});
|
||||
view.tipsArray = arr;
|
||||
this.autoHeightTextBox();
|
||||
};
|
||||
|
||||
var onCommentsViewMouseOver = function() {
|
||||
me._isMouseOver = true;
|
||||
};
|
||||
|
||||
var onCommentsViewMouseOut = function() {
|
||||
me._isMouseOver = false;
|
||||
};
|
||||
|
||||
this.commentsView.on('item:add', addtooltip);
|
||||
this.commentsView.on('item:remove', addtooltip);
|
||||
this.commentsView.on('item:change', addtooltip);
|
||||
this.commentsView.cmpEl.on('mouseover', onCommentsViewMouseOver).on('mouseout', onCommentsViewMouseOut);
|
||||
|
||||
this.commentsView.on('item:click', function (picker, item, record, e) {
|
||||
var btn, showEditBox, showReplyBox, commentId, replyId, hideAddReply;
|
||||
|
||||
function readdresolves() {
|
||||
me.update();
|
||||
}
|
||||
|
||||
btn = $(e.target);
|
||||
if (btn) {
|
||||
showEditBox = record.get('editTextInPopover');
|
||||
showReplyBox = record.get('showReplyInPopover');
|
||||
hideAddReply = record.get('hideAddReply');
|
||||
commentId = record.get('uid');
|
||||
replyId = btn.attr('data-value');
|
||||
|
||||
if (record.get('hint')) {
|
||||
t.fireEvent('comment:disableHint', [record]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (btn.hasClass('btn-edit')) {
|
||||
if (!_.isUndefined(replyId)) {
|
||||
t.fireEvent('comment:closeEditing', [commentId]);
|
||||
t.fireEvent('comment:editReply', [commentId, replyId, true]);
|
||||
|
||||
this.replyId = replyId;
|
||||
|
||||
this.autoHeightTextBox();
|
||||
|
||||
me.calculateSizeOfContent();
|
||||
me.setLeftTop(me.arrowPosX, me.arrowPosY, me.leftX);
|
||||
me.calculateSizeOfContent();
|
||||
|
||||
readdresolves();
|
||||
|
||||
me.hookTextBox();
|
||||
|
||||
this.autoScrollToEditButtons();
|
||||
this.setFocusToTextBox();
|
||||
} else {
|
||||
if (!showEditBox) {
|
||||
t.fireEvent('comment:closeEditing');
|
||||
record.set('editTextInPopover', true);
|
||||
|
||||
t.fireEvent('comment:show', [commentId]);
|
||||
|
||||
this.autoHeightTextBox();
|
||||
|
||||
me.calculateSizeOfContent();
|
||||
me.setLeftTop(me.arrowPosX, me.arrowPosY, me.leftX);
|
||||
me.calculateSizeOfContent();
|
||||
|
||||
readdresolves();
|
||||
|
||||
me.hookTextBox();
|
||||
|
||||
this.autoScrollToEditButtons();
|
||||
this.setFocusToTextBox();
|
||||
}
|
||||
}
|
||||
} else if (btn.hasClass('btn-delete')) {
|
||||
if (!_.isUndefined(replyId)) {
|
||||
t.fireEvent('comment:removeReply', [commentId, replyId]);
|
||||
|
||||
me.calculateSizeOfContent();
|
||||
me.setLeftTop(me.arrowPosX, me.arrowPosY, me.leftX);
|
||||
me.calculateSizeOfContent();
|
||||
|
||||
} else {
|
||||
t.fireEvent('comment:remove', [commentId]);
|
||||
}
|
||||
|
||||
t.fireEvent('comment:closeEditing');
|
||||
|
||||
readdresolves();
|
||||
|
||||
} else if (btn.hasClass('user-reply')) {
|
||||
t.fireEvent('comment:closeEditing');
|
||||
record.set('showReplyInPopover', true);
|
||||
|
||||
me.calculateSizeOfContent();
|
||||
me.setLeftTop(me.arrowPosX, me.arrowPosY, me.leftX);
|
||||
me.calculateSizeOfContent();
|
||||
|
||||
readdresolves();
|
||||
|
||||
this.autoHeightTextBox();
|
||||
me.hookTextBox();
|
||||
|
||||
this.autoScrollToEditButtons();
|
||||
this.setFocusToTextBox();
|
||||
} else if (btn.hasClass('btn-reply', false)) {
|
||||
if (showReplyBox) {
|
||||
this.clearTextBoxBind();
|
||||
|
||||
t.fireEvent('comment:addReply', [commentId, this.getActiveTextBoxVal()]);
|
||||
t.fireEvent('comment:closeEditing');
|
||||
|
||||
readdresolves();
|
||||
}
|
||||
} else if (btn.hasClass('btn-close', false)) {
|
||||
t.fireEvent('comment:closeEditing', [commentId]);
|
||||
me.calculateSizeOfContent();
|
||||
t.fireEvent('comment:show', [commentId]);
|
||||
|
||||
readdresolves();
|
||||
|
||||
} else if (btn.hasClass('btn-inner-edit', false)) {
|
||||
|
||||
if (record.get('dummy')) {
|
||||
var commentVal = this.getActiveTextBoxVal();
|
||||
if (commentVal.length>0)
|
||||
t.fireEvent('comment:addDummyComment', [commentVal]);
|
||||
else {
|
||||
var text = me.$window.find('textarea:not(.user-message)');
|
||||
if (text && text.length)
|
||||
setTimeout(function(){
|
||||
text.focus();
|
||||
}, 10);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
this.clearTextBoxBind();
|
||||
|
||||
if (!_.isUndefined(this.replyId)) {
|
||||
t.fireEvent('comment:changeReply', [commentId, this.replyId, this.getActiveTextBoxVal()]);
|
||||
this.replyId = undefined;
|
||||
t.fireEvent('comment:closeEditing');
|
||||
} else if (showEditBox) {
|
||||
t.fireEvent('comment:change', [commentId, this.getActiveTextBoxVal()]);
|
||||
t.fireEvent('comment:closeEditing');
|
||||
me.calculateSizeOfContent();
|
||||
}
|
||||
|
||||
readdresolves();
|
||||
|
||||
} else if (btn.hasClass('btn-inner-close', false)) {
|
||||
if (record.get('dummy')) {
|
||||
me.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
if (hideAddReply && this.getActiveTextBoxVal().length > 0) {
|
||||
me.saveText();
|
||||
record.set('hideAddReply', false);
|
||||
this.getTextBox().val(me.textVal);
|
||||
this.autoHeightTextBox();
|
||||
} else {
|
||||
|
||||
this.clearTextBoxBind();
|
||||
|
||||
t.fireEvent('comment:closeEditing', [commentId]);
|
||||
}
|
||||
|
||||
this.replyId = undefined;
|
||||
|
||||
me.calculateSizeOfContent();
|
||||
me.setLeftTop(me.arrowPosX, me.arrowPosY, me.leftX);
|
||||
me.calculateSizeOfContent();
|
||||
|
||||
readdresolves();
|
||||
|
||||
} else if (btn.hasClass('btn-resolve', false)) {
|
||||
var tip = btn.data('bs.tooltip');
|
||||
if (tip) tip.dontShow = true;
|
||||
|
||||
t.fireEvent('comment:resolve', [commentId]);
|
||||
|
||||
readdresolves();
|
||||
} else if (btn.hasClass('btn-resolve-check', false)) {
|
||||
var tip = btn.data('bs.tooltip');
|
||||
if (tip) tip.dontShow = true;
|
||||
|
||||
t.fireEvent('comment:resolve', [commentId]);
|
||||
|
||||
readdresolves();
|
||||
}
|
||||
}
|
||||
});
|
||||
me.on({
|
||||
'show': function () {
|
||||
me.commentsView.autoHeightTextBox();
|
||||
me.$window.find('textarea').keydown(function (event) {
|
||||
if (event.keyCode == Common.UI.Keys.ESC) {
|
||||
me.hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
'animate:before': function () {
|
||||
var text = me.$window.find('textarea');
|
||||
if (text && text.length)
|
||||
text.focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
show: function (animate, loadText, focus, showText) {
|
||||
this.options.animate = animate;
|
||||
|
||||
var me = this,textBox = this.commentsView.getTextBox();
|
||||
|
||||
if (loadText && this.textVal) {
|
||||
textBox && textBox.val(this.textVal);
|
||||
}
|
||||
|
||||
if (showText && showText.length) {
|
||||
textBox && textBox.val(showText);
|
||||
}
|
||||
|
||||
// this.calculateSizeOfContent();
|
||||
// this.commentsView.autoHeightTextBox();
|
||||
|
||||
Common.UI.Window.prototype.show.call(this);
|
||||
|
||||
if (this.commentsView.scroller) {
|
||||
this.commentsView.scroller.update({minScrollbarLength: 40, alwaysVisibleY: true});
|
||||
}
|
||||
|
||||
this.hookTextBox();
|
||||
},
|
||||
hide: function () {
|
||||
if (this.handlerHide) {
|
||||
this.handlerHide ();
|
||||
}
|
||||
this.hideTips();
|
||||
Common.UI.Window.prototype.hide.call(this);
|
||||
|
||||
if (!_.isUndefined(this.e) && this.e.keyCode == Common.UI.Keys.ESC) {
|
||||
this.e.preventDefault();
|
||||
this.e.stopImmediatePropagation();
|
||||
this.e = undefined;
|
||||
}
|
||||
},
|
||||
|
||||
// CommentsPopover
|
||||
|
||||
update: function (needRender) {
|
||||
if (this.commentsView && needRender)
|
||||
this.commentsView.onResetItems();
|
||||
if (this.commentsView && this.commentsView.scroller) {
|
||||
this.commentsView.scroller.update({minScrollbarLength: 40, alwaysVisibleY: true});
|
||||
}
|
||||
},
|
||||
|
||||
isVisible: function () {
|
||||
return (this.$window && this.$window.is(':visible'));
|
||||
},
|
||||
setLeftTop: function (posX, posY, leftX, loadInnerValues, retainContent) {
|
||||
if (!this.$window)
|
||||
this.render();
|
||||
|
||||
if (loadInnerValues) {
|
||||
posX = this.arrowPosX;
|
||||
posY = this.arrowPosY;
|
||||
leftX = this.leftX;
|
||||
}
|
||||
|
||||
if (_.isUndefined(posX) && _.isUndefined(posY))
|
||||
return;
|
||||
|
||||
this.arrowPosX = posX;
|
||||
this.arrowPosY = posY;
|
||||
this.leftX = leftX;
|
||||
|
||||
var commentsView = $('#id-comments-popover'),
|
||||
arrowView = $('#id-comments-arrow'),
|
||||
editorView = $('#editor_sdk'),
|
||||
editorBounds = null,
|
||||
sdkBoundsHeight = 0,
|
||||
sdkBoundsTop = 0,
|
||||
sdkBoundsLeft = 0,
|
||||
sdkPanelRight = '',
|
||||
sdkPanelRightWidth = 0,
|
||||
sdkPanelLeft = '',
|
||||
sdkPanelLeftWidth = 0,
|
||||
sdkPanelThumbs = '', // for PE
|
||||
sdkPanelThumbsWidth = 0, // for PE
|
||||
sdkPanelTop = '',
|
||||
sdkPanelHeight = 0,
|
||||
leftPos = 0,
|
||||
windowWidth = 0,
|
||||
outerHeight = 0,
|
||||
topPos = 0,
|
||||
sdkBoundsTopPos = 0;
|
||||
|
||||
if (commentsView && arrowView && editorView && editorView.get(0)) {
|
||||
editorBounds = editorView.get(0).getBoundingClientRect();
|
||||
if (editorBounds) {
|
||||
sdkBoundsHeight = editorBounds.height - this.sdkBounds.padding * 2;
|
||||
|
||||
this.$window.css({maxHeight: sdkBoundsHeight + 'px'});
|
||||
|
||||
this.sdkBounds.width = editorBounds.width;
|
||||
this.sdkBounds.height = editorBounds.height;
|
||||
|
||||
// LEFT CORNER
|
||||
|
||||
if (!_.isUndefined(posX)) {
|
||||
|
||||
sdkPanelRight = $('#id_vertical_scroll');
|
||||
if (sdkPanelRight.length) {
|
||||
sdkPanelRightWidth = (sdkPanelRight.css('display') !== 'none') ? sdkPanelRight.width() : 0;
|
||||
} else {
|
||||
sdkPanelRight = $('#ws-v-scrollbar');
|
||||
if (sdkPanelRight.length) {
|
||||
sdkPanelRightWidth = (sdkPanelRight.css('display') !== 'none') ? sdkPanelRight.width() : 0;
|
||||
}
|
||||
}
|
||||
|
||||
this.sdkBounds.width -= sdkPanelRightWidth;
|
||||
|
||||
sdkPanelLeft = $('#id_panel_left');
|
||||
if (sdkPanelLeft.length) {
|
||||
sdkPanelLeftWidth = (sdkPanelLeft.css('display') !== 'none') ? sdkPanelLeft.width() : 0;
|
||||
}
|
||||
sdkPanelThumbs = $('#id_panel_thumbnails');
|
||||
if (sdkPanelThumbs.length) {
|
||||
sdkPanelThumbsWidth = (sdkPanelThumbs.css('display') !== 'none') ? sdkPanelThumbs.width() : 0;
|
||||
this.sdkBounds.width -= sdkPanelThumbsWidth;
|
||||
}
|
||||
|
||||
leftPos = Math.min(sdkBoundsLeft + posX + this.arrow.width, sdkBoundsLeft + this.sdkBounds.width - this.$window.outerWidth() - 25);
|
||||
leftPos = Math.max(sdkBoundsLeft + sdkPanelLeftWidth + this.arrow.width, leftPos);
|
||||
|
||||
arrowView.removeClass('right').addClass('left');
|
||||
|
||||
if (!_.isUndefined(leftX)) {
|
||||
windowWidth = this.$window.outerWidth();
|
||||
if (windowWidth) {
|
||||
if ((posX + windowWidth > this.sdkBounds.width - this.arrow.width + 5) && (this.leftX > windowWidth)) {
|
||||
leftPos = this.leftX - windowWidth + sdkBoundsLeft - this.arrow.width;
|
||||
arrowView.removeClass('left').addClass('right');
|
||||
} else {
|
||||
leftPos = sdkBoundsLeft + posX + this.arrow.width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.$window.css('left', leftPos + 'px');
|
||||
}
|
||||
|
||||
// TOP CORNER
|
||||
|
||||
if (!_.isUndefined(posY)) {
|
||||
sdkPanelTop = $('#id_panel_top');
|
||||
sdkBoundsTopPos = sdkBoundsTop;
|
||||
if (sdkPanelTop.length) {
|
||||
sdkPanelHeight = (sdkPanelTop.css('display') !== 'none') ? sdkPanelTop.height() : 0;
|
||||
sdkBoundsTopPos += this.sdkBounds.paddingTop;
|
||||
} else {
|
||||
sdkPanelTop = $('#ws-h-scrollbar');
|
||||
if (sdkPanelTop.length) {
|
||||
sdkPanelHeight = (sdkPanelTop.css('display') !== 'none') ? sdkPanelTop.height() : 0;
|
||||
}
|
||||
}
|
||||
|
||||
this.sdkBounds.height -= sdkPanelHeight;
|
||||
|
||||
outerHeight = this.$window.outerHeight();
|
||||
|
||||
topPos = Math.min(sdkBoundsTop + sdkBoundsHeight - outerHeight, this.arrowPosY + sdkBoundsTop - this.arrow.height);
|
||||
topPos = Math.max(topPos, sdkBoundsTopPos);
|
||||
|
||||
this.$window.css('top', topPos + 'px');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!retainContent)
|
||||
this.calculateSizeOfContent();
|
||||
},
|
||||
calculateSizeOfContent: function (testVisible) {
|
||||
if (testVisible && !this.$window.is(':visible'))
|
||||
return;
|
||||
|
||||
this.$window.css({overflow: 'hidden'});
|
||||
|
||||
var arrowView = $('#id-comments-arrow'),
|
||||
commentsView = $('#id-comments-popover'),
|
||||
contentBounds = null,
|
||||
editorView = null,
|
||||
editorBounds = null,
|
||||
sdkBoundsHeight = 0,
|
||||
sdkBoundsTop = 0,
|
||||
sdkBoundsLeft = 0,
|
||||
sdkPanelTop = '',
|
||||
sdkPanelHeight = 0,
|
||||
arrowPosY = 0,
|
||||
windowHeight = 0,
|
||||
outerHeight = 0,
|
||||
topPos = 0,
|
||||
sdkBoundsTopPos = 0;
|
||||
|
||||
if (commentsView && arrowView && commentsView.get(0)) {
|
||||
commentsView.css({height: '100%'});
|
||||
|
||||
contentBounds = commentsView.get(0).getBoundingClientRect();
|
||||
if (contentBounds) {
|
||||
editorView = $('#editor_sdk');
|
||||
if (editorView && editorView.get(0)) {
|
||||
editorBounds = editorView.get(0).getBoundingClientRect();
|
||||
if (editorBounds) {
|
||||
sdkBoundsHeight = editorBounds.height - this.sdkBounds.padding * 2;
|
||||
sdkBoundsTopPos = sdkBoundsTop;
|
||||
windowHeight = this.$window.outerHeight();
|
||||
|
||||
// TOP CORNER
|
||||
|
||||
sdkPanelTop = $('#id_panel_top');
|
||||
if (sdkPanelTop.length) {
|
||||
sdkPanelHeight = (sdkPanelTop.css('display') !== 'none') ? sdkPanelTop.height() : 0;
|
||||
sdkBoundsTopPos += this.sdkBounds.paddingTop;
|
||||
} else {
|
||||
sdkPanelTop = $('#ws-h-scrollbar');
|
||||
if (sdkPanelTop.length) {
|
||||
sdkPanelHeight = (sdkPanelTop.css('display') !== 'none') ? sdkPanelTop.height() : 0;
|
||||
}
|
||||
}
|
||||
|
||||
outerHeight = Math.max(commentsView.outerHeight(), this.$window.outerHeight());
|
||||
|
||||
if (sdkBoundsHeight <= outerHeight) {
|
||||
this.$window.css({
|
||||
maxHeight: sdkBoundsHeight - sdkPanelHeight + 'px',
|
||||
top: sdkBoundsTop + sdkPanelHeight + 'px'});
|
||||
|
||||
commentsView.css({height: sdkBoundsHeight - sdkPanelHeight - 3 + 'px'});
|
||||
|
||||
// arrowPosY = Math.max(this.arrow.margin, this.arrowPosY - sdkPanelHeight - this.arrow.width);
|
||||
arrowPosY = Math.min(arrowPosY, sdkBoundsHeight - (sdkPanelHeight + this.arrow.margin + this.arrow.width));
|
||||
|
||||
arrowView.css({top: arrowPosY + 'px'});
|
||||
} else {
|
||||
|
||||
outerHeight = windowHeight;
|
||||
|
||||
if (outerHeight > 0) {
|
||||
if (contentBounds.top + outerHeight > sdkBoundsHeight + sdkBoundsTop || contentBounds.height === 0) {
|
||||
topPos = Math.min(sdkBoundsTop + sdkBoundsHeight - outerHeight, this.arrowPosY + sdkBoundsTop - this.arrow.height);
|
||||
topPos = Math.max(topPos, sdkBoundsTopPos);
|
||||
|
||||
this.$window.css({top: topPos + 'px'});
|
||||
}
|
||||
}
|
||||
|
||||
arrowPosY = Math.max(this.arrow.margin, this.arrowPosY - (sdkBoundsHeight - outerHeight) - this.arrow.width);
|
||||
arrowPosY = Math.min(arrowPosY, outerHeight - this.arrow.margin - this.arrow.width);
|
||||
|
||||
arrowView.css({top: arrowPosY + 'px'});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.$window.css({overflow: ''});
|
||||
},
|
||||
saveText: function (clear) {
|
||||
if (this.commentsView && this.commentsView.cmpEl.find('.lock-area').length<1) {
|
||||
this.textVal = undefined;
|
||||
if (!clear) {
|
||||
this.textVal = this.commentsView.getActiveTextBoxVal();
|
||||
} else {
|
||||
this.commentsView.clearTextBoxBind();
|
||||
}
|
||||
}
|
||||
},
|
||||
loadText: function () {
|
||||
if (this.textVal && this.commentsView) {
|
||||
var textBox = this.commentsView.getTextBox();
|
||||
textBox && textBox.val(this.textVal);
|
||||
}
|
||||
},
|
||||
getEditText: function () {
|
||||
if (this.commentsView) {
|
||||
return this.commentsView.getActiveTextBoxVal();
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
|
||||
hookTextBox: function () {
|
||||
var me = this, textBox = this.commentsView.getTextBox();
|
||||
|
||||
textBox && textBox.keydown(function (event) {
|
||||
if ((event.ctrlKey || event.metaKey) && !event.altKey && event.keyCode === Common.UI.Keys.RETURN) {
|
||||
var buttonChangeComment = $('#id-comments-change-popover');
|
||||
if (buttonChangeComment && buttonChangeComment.length) {
|
||||
buttonChangeComment.click();
|
||||
}
|
||||
|
||||
event.stopImmediatePropagation();
|
||||
} else if (event.keyCode === Common.UI.Keys.TAB) {
|
||||
var $this, end, start;
|
||||
start = this.selectionStart;
|
||||
end = this.selectionEnd;
|
||||
$this = $(this);
|
||||
$this.val($this.val().substring(0, start) + '\t' + $this.val().substring(end));
|
||||
this.selectionStart = this.selectionEnd = start + 1;
|
||||
|
||||
event.stopImmediatePropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
me.e = event;
|
||||
});
|
||||
},
|
||||
|
||||
hideTips: function() {
|
||||
if (this.commentsView)
|
||||
_.each(this.commentsView.dataViewItems, function(item) {
|
||||
if (item.tipsArray) {
|
||||
item.tipsArray.forEach(function(item){
|
||||
item.hide();
|
||||
});
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
|
||||
isCommentsViewMouseOver: function() {
|
||||
return this._isMouseOver;
|
||||
}
|
||||
});
|
||||
|
||||
Common.Views.Comments = Common.UI.BaseView.extend(_.extend({
|
||||
el: '#left-panel-comments',
|
||||
template: _.template(panelTemplate),
|
||||
|
@ -838,7 +84,6 @@ define([
|
|||
Common.UI.BaseView.prototype.initialize.call(this, options);
|
||||
|
||||
this.store = this.options.store;
|
||||
this.popoverComments = this.options.popoverComments;
|
||||
},
|
||||
render: function () {
|
||||
var me = this;
|
||||
|
@ -890,8 +135,6 @@ define([
|
|||
}
|
||||
var CommentsPanelDataView = Common.UI.DataView.extend((function() {
|
||||
|
||||
var parentView = me;
|
||||
|
||||
return {
|
||||
|
||||
options : {
|
||||
|
@ -1157,19 +400,6 @@ define([
|
|||
}
|
||||
},
|
||||
|
||||
getPopover: function (sdkViewName) {
|
||||
|
||||
if (_.isUndefined(this.popover)) {
|
||||
this.popover = new Common.Views.CommentsPopover({
|
||||
store : this.popoverComments,
|
||||
delegate : this,
|
||||
renderTo : sdkViewName
|
||||
});
|
||||
}
|
||||
|
||||
return this.popover;
|
||||
},
|
||||
|
||||
showEditContainer: function (show) {
|
||||
var addCommentLink = $('.add-link-ct', this.el),
|
||||
newCommentBlock = $('.new-comment-ct', this.el),
|
||||
|
|
|
@ -46,369 +46,14 @@ if (Common === undefined)
|
|||
Common.Views = Common.Views || {};
|
||||
|
||||
define([
|
||||
'text!common/main/lib/template/ReviewChangesPopover.template',
|
||||
'common/main/lib/util/utils',
|
||||
'common/main/lib/component/Button',
|
||||
'common/main/lib/component/DataView',
|
||||
'common/main/lib/component/Layout',
|
||||
'common/main/lib/component/Window'
|
||||
], function (popoverTemplate) {
|
||||
], function () {
|
||||
'use strict';
|
||||
|
||||
Common.Views.ReviewChangesPopover = Common.UI.Window.extend({
|
||||
|
||||
// Window
|
||||
|
||||
initialize : function (options) {
|
||||
var _options = {};
|
||||
|
||||
_.extend(_options, {
|
||||
closable : false,
|
||||
width : 265,
|
||||
height : 120,
|
||||
header : false,
|
||||
modal : false
|
||||
}, options);
|
||||
|
||||
this.template = options.template || [
|
||||
'<div class="box">',
|
||||
'<div id="id-review-popover" class="comments-popover dataview-ct"></div>',
|
||||
'<div id="id-review-arrow" class="comments-arrow review"></div>',
|
||||
'</div>'
|
||||
].join('');
|
||||
|
||||
this.store = options.store;
|
||||
this.delegate = options.delegate;
|
||||
|
||||
_options.tpl = _.template(this.template)(_options);
|
||||
|
||||
this.arrow = {margin: 20, width: 12, height: 34};
|
||||
this.sdkBounds = {width: 0, height: 0, padding: 10, paddingTop: 20};
|
||||
|
||||
Common.UI.Window.prototype.initialize.call(this, _options);
|
||||
},
|
||||
render: function () {
|
||||
Common.UI.Window.prototype.render.call(this);
|
||||
|
||||
var me = this,
|
||||
t = this.delegate,
|
||||
window = this.$window;
|
||||
|
||||
window.css({
|
||||
height: '',
|
||||
minHeight: '',
|
||||
overflow: 'hidden',
|
||||
position: 'absolute',
|
||||
zIndex: '991'
|
||||
});
|
||||
|
||||
var body = window.find('.body');
|
||||
if (body) {
|
||||
body.css('position', 'relative');
|
||||
}
|
||||
|
||||
window.on('click', function() {
|
||||
window.css({zIndex: '991'});
|
||||
Common.NotificationCenter.trigger('review:click');
|
||||
});
|
||||
Common.NotificationCenter.on('comments:click', function() {
|
||||
window.css({zIndex: '990'});
|
||||
});
|
||||
|
||||
var PopoverDataView = Common.UI.DataView.extend((function() {
|
||||
|
||||
var parentView = me;
|
||||
|
||||
return {
|
||||
options : {
|
||||
handleSelect: false,
|
||||
scrollable: true,
|
||||
template: _.template('<div class="dataview-ct inner" style="overflow-y: hidden;">'+
|
||||
'</div>' +
|
||||
'<div class="lock-area" style="cursor: default;"></div>' +
|
||||
'<div class="lock-author" style="cursor: default;"></div>'
|
||||
)
|
||||
}
|
||||
}
|
||||
})());
|
||||
if (PopoverDataView) {
|
||||
if (this.reviewChangesView) {
|
||||
this.reviewChangesView.render($('#id-review-popover'));
|
||||
this.reviewChangesView.onResetItems();
|
||||
} else {
|
||||
this.reviewChangesView = new PopoverDataView({
|
||||
el: $('#id-review-popover'),
|
||||
store: me.store,
|
||||
itemTemplate: _.template(popoverTemplate)
|
||||
});
|
||||
|
||||
this.reviewChangesView.on('item:click', function (picker, item, record, e) {
|
||||
var btn = $(e.target);
|
||||
if (btn) {
|
||||
if (btn.hasClass('btn-accept')) {
|
||||
t.fireEvent('reviewchange:accept', [record.get('changedata')]);
|
||||
} else if (btn.hasClass('btn-reject')) {
|
||||
t.fireEvent('reviewchange:reject', [record.get('changedata')]);
|
||||
} else if (btn.hasClass('btn-delete')) {
|
||||
t.fireEvent('reviewchange:delete', [record.get('changedata')]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
show: function (animate, lock, lockuser) {
|
||||
this.options.animate = animate;
|
||||
|
||||
var me = this;
|
||||
|
||||
// this.calculateSizeOfContent();
|
||||
|
||||
Common.UI.Window.prototype.show.call(this);
|
||||
if (this.reviewChangesView.scroller) {
|
||||
this.reviewChangesView.scroller.update({minScrollbarLength: 40, alwaysVisibleY: true});
|
||||
}
|
||||
|
||||
this.reviewChangesView.cmpEl.find('.lock-area').toggleClass('hidden', !lock);
|
||||
this.reviewChangesView.cmpEl.find('.lock-author').toggleClass('hidden', !lock || _.isEmpty(lockuser)).text(lockuser);
|
||||
},
|
||||
hide: function () {
|
||||
if (this.handlerHide) {
|
||||
this.handlerHide ();
|
||||
}
|
||||
|
||||
Common.UI.Window.prototype.hide.call(this);
|
||||
|
||||
if (!_.isUndefined(this.e) && this.e.keyCode == Common.UI.Keys.ESC) {
|
||||
this.e.preventDefault();
|
||||
this.e.stopImmediatePropagation();
|
||||
this.e = undefined;
|
||||
}
|
||||
},
|
||||
|
||||
update: function () {
|
||||
if (this.reviewChangesView && this.reviewChangesView.scroller) {
|
||||
this.reviewChangesView.scroller.update({minScrollbarLength: 40, alwaysVisibleY: true});
|
||||
}
|
||||
},
|
||||
|
||||
isVisible: function () {
|
||||
return (this.$window && this.$window.is(':visible'));
|
||||
},
|
||||
|
||||
setLeftTop: function (posX, posY, leftX, loadInnerValues) {
|
||||
if (!this.$window)
|
||||
this.render();
|
||||
|
||||
if (loadInnerValues) {
|
||||
posX = this.arrowPosX;
|
||||
posY = this.arrowPosY;
|
||||
leftX = this.leftX;
|
||||
}
|
||||
|
||||
if (_.isUndefined(posX) && _.isUndefined(posY))
|
||||
return;
|
||||
|
||||
this.arrowPosX = posX;
|
||||
this.arrowPosY = posY;
|
||||
this.leftX = leftX;
|
||||
|
||||
var reviewChangesView = $('#id-review-popover'),
|
||||
arrowView = $('#id-review-arrow'),
|
||||
editorView = $('#editor_sdk'),
|
||||
editorBounds = null,
|
||||
sdkBoundsHeight = 0,
|
||||
sdkBoundsTop = 0,
|
||||
sdkBoundsLeft = 0,
|
||||
sdkPanelRight = '',
|
||||
sdkPanelRightWidth = 0,
|
||||
sdkPanelLeft = '',
|
||||
sdkPanelLeftWidth = 0,
|
||||
sdkPanelThumbs = '', // for PE
|
||||
sdkPanelThumbsWidth = 0, // for PE
|
||||
sdkPanelTop = '',
|
||||
sdkPanelHeight = 0,
|
||||
leftPos = 0,
|
||||
windowWidth = 0,
|
||||
outerHeight = 0,
|
||||
topPos = 0,
|
||||
sdkBoundsTopPos = 0;
|
||||
|
||||
if (reviewChangesView && arrowView && editorView && editorView.get(0)) {
|
||||
editorBounds = editorView.get(0).getBoundingClientRect();
|
||||
if (editorBounds) {
|
||||
sdkBoundsHeight = editorBounds.height - this.sdkBounds.padding * 2;
|
||||
|
||||
this.$window.css({maxHeight: sdkBoundsHeight + 'px'});
|
||||
|
||||
this.sdkBounds.width = editorBounds.width;
|
||||
this.sdkBounds.height = editorBounds.height;
|
||||
|
||||
// LEFT CORNER
|
||||
|
||||
if (!_.isUndefined(posX)) {
|
||||
|
||||
sdkPanelRight = $('#id_vertical_scroll');
|
||||
if (sdkPanelRight.length) {
|
||||
sdkPanelRightWidth = (sdkPanelRight.css('display') !== 'none') ? sdkPanelRight.width() : 0;
|
||||
} else {
|
||||
sdkPanelRight = $('#ws-v-scrollbar');
|
||||
if (sdkPanelRight.length) {
|
||||
sdkPanelRightWidth = (sdkPanelRight.css('display') !== 'none') ? sdkPanelRight.width() : 0;
|
||||
}
|
||||
}
|
||||
|
||||
this.sdkBounds.width -= sdkPanelRightWidth;
|
||||
|
||||
sdkPanelLeft = $('#id_panel_left');
|
||||
if (sdkPanelLeft.length) {
|
||||
sdkPanelLeftWidth = (sdkPanelLeft.css('display') !== 'none') ? sdkPanelLeft.width() : 0;
|
||||
}
|
||||
sdkPanelThumbs = $('#id_panel_thumbnails');
|
||||
if (sdkPanelThumbs.length) {
|
||||
sdkPanelThumbsWidth = (sdkPanelThumbs.css('display') !== 'none') ? sdkPanelThumbs.width() : 0;
|
||||
this.sdkBounds.width -= sdkPanelThumbsWidth;
|
||||
}
|
||||
|
||||
leftPos = Math.min(sdkBoundsLeft + posX + this.arrow.width, sdkBoundsLeft + this.sdkBounds.width - this.$window.outerWidth());
|
||||
leftPos = Math.max(sdkBoundsLeft + sdkPanelLeftWidth + this.arrow.width, leftPos);
|
||||
|
||||
arrowView.removeClass('right').addClass('left');
|
||||
|
||||
if (!_.isUndefined(leftX)) {
|
||||
windowWidth = this.$window.outerWidth();
|
||||
if (windowWidth) {
|
||||
if ((posX + windowWidth > this.sdkBounds.width - this.arrow.width + 5) && (this.leftX > windowWidth)) {
|
||||
leftPos = this.leftX - windowWidth + sdkBoundsLeft - this.arrow.width;
|
||||
arrowView.removeClass('left').addClass('right');
|
||||
} else {
|
||||
leftPos = sdkBoundsLeft + posX + this.arrow.width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.$window.css('left', leftPos + 'px');
|
||||
}
|
||||
|
||||
// TOP CORNER
|
||||
|
||||
if (!_.isUndefined(posY)) {
|
||||
sdkPanelTop = $('#id_panel_top');
|
||||
sdkBoundsTopPos = sdkBoundsTop;
|
||||
if (sdkPanelTop.length) {
|
||||
sdkPanelHeight = (sdkPanelTop.css('display') !== 'none') ? sdkPanelTop.height() : 0;
|
||||
sdkBoundsTopPos += this.sdkBounds.paddingTop;
|
||||
} else {
|
||||
sdkPanelTop = $('#ws-h-scrollbar');
|
||||
if (sdkPanelTop.length) {
|
||||
sdkPanelHeight = (sdkPanelTop.css('display') !== 'none') ? sdkPanelTop.height() : 0;
|
||||
sdkBoundsTopPos -= this.sdkBounds.paddingTop;
|
||||
}
|
||||
}
|
||||
|
||||
this.sdkBounds.height -= sdkPanelHeight;
|
||||
|
||||
outerHeight = this.$window.outerHeight();
|
||||
|
||||
topPos = Math.min(sdkBoundsTop + sdkBoundsHeight - outerHeight, this.arrowPosY + sdkBoundsTop - this.arrow.height);
|
||||
topPos = Math.max(topPos, sdkBoundsTopPos);
|
||||
|
||||
this.$window.css('top', topPos + 'px');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.calculateSizeOfContent();
|
||||
},
|
||||
calculateSizeOfContent: function (testVisible) {
|
||||
if (testVisible && !this.$window.is(':visible'))
|
||||
return;
|
||||
|
||||
this.$window.css({overflow: 'hidden'});
|
||||
|
||||
var arrowView = $('#id-review-arrow'),
|
||||
reviewChangesView = $('#id-review-popover'),
|
||||
contentBounds = null,
|
||||
editorView = null,
|
||||
editorBounds = null,
|
||||
sdkBoundsHeight = 0,
|
||||
sdkBoundsTop = 0,
|
||||
sdkBoundsLeft = 0,
|
||||
sdkPanelTop = '',
|
||||
sdkPanelHeight = 0,
|
||||
arrowPosY = 0,
|
||||
windowHeight = 0,
|
||||
outerHeight = 0,
|
||||
topPos = 0,
|
||||
sdkBoundsTopPos = 0;
|
||||
|
||||
if (reviewChangesView && arrowView && reviewChangesView.get(0)) {
|
||||
reviewChangesView.css({height: '100%'});
|
||||
|
||||
contentBounds = reviewChangesView.get(0).getBoundingClientRect();
|
||||
if (contentBounds) {
|
||||
editorView = $('#editor_sdk');
|
||||
if (editorView && editorView.get(0)) {
|
||||
editorBounds = editorView.get(0).getBoundingClientRect();
|
||||
if (editorBounds) {
|
||||
sdkBoundsHeight = editorBounds.height - this.sdkBounds.padding * 2;
|
||||
sdkBoundsTopPos = sdkBoundsTop;
|
||||
windowHeight = this.$window.outerHeight();
|
||||
|
||||
// TOP CORNER
|
||||
|
||||
sdkPanelTop = $('#id_panel_top');
|
||||
if (sdkPanelTop.length) {
|
||||
sdkPanelHeight = (sdkPanelTop.css('display') !== 'none') ? sdkPanelTop.height() : 0;
|
||||
sdkBoundsTopPos += this.sdkBounds.paddingTop;
|
||||
} else {
|
||||
sdkPanelTop = $('#ws-h-scrollbar');
|
||||
if (sdkPanelTop.length) {
|
||||
sdkPanelHeight = (sdkPanelTop.css('display') !== 'none') ? sdkPanelTop.height() : 0;
|
||||
sdkBoundsTopPos -= this.sdkBounds.paddingTop;
|
||||
}
|
||||
}
|
||||
|
||||
outerHeight = Math.max(reviewChangesView.outerHeight(), this.$window.outerHeight());
|
||||
|
||||
if (sdkBoundsHeight <= outerHeight) {
|
||||
this.$window.css({
|
||||
maxHeight: sdkBoundsHeight - sdkPanelHeight + 'px',
|
||||
top: sdkBoundsTop + sdkPanelHeight + 'px'});
|
||||
|
||||
reviewChangesView.css({height: sdkBoundsHeight - sdkPanelHeight - 3 + 'px'});
|
||||
|
||||
// arrowPosY = Math.max(this.arrow.margin, this.arrowPosY - sdkPanelHeight - this.arrow.width);
|
||||
arrowPosY = Math.min(arrowPosY, sdkBoundsHeight - (sdkPanelHeight + this.arrow.margin + this.arrow.width));
|
||||
|
||||
arrowView.css({top: arrowPosY + 'px'});
|
||||
} else {
|
||||
|
||||
outerHeight = windowHeight;
|
||||
|
||||
if (outerHeight > 0) {
|
||||
if (contentBounds.top + outerHeight > sdkBoundsHeight + sdkBoundsTop || contentBounds.height === 0) {
|
||||
topPos = Math.min(sdkBoundsTop + sdkBoundsHeight - outerHeight, this.arrowPosY + sdkBoundsTop - this.arrow.height);
|
||||
topPos = Math.max(topPos, sdkBoundsTopPos);
|
||||
|
||||
this.$window.css({top: topPos + 'px'});
|
||||
}
|
||||
}
|
||||
|
||||
arrowPosY = Math.max(this.arrow.margin, this.arrowPosY - (sdkBoundsHeight - outerHeight) - this.arrow.width);
|
||||
arrowPosY = Math.min(arrowPosY, outerHeight - this.arrow.margin - this.arrow.width);
|
||||
|
||||
arrowView.css({top: arrowPosY + 'px'});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.$window.css({overflow: ''});
|
||||
}
|
||||
});
|
||||
|
||||
Common.Views.ReviewChanges = Common.UI.BaseView.extend(_.extend((function(){
|
||||
var template =
|
||||
'<section id="review-changes-panel" class="panel" data-tab="review">' +
|
||||
|
@ -525,8 +170,6 @@ define([
|
|||
initialize: function (options) {
|
||||
Common.UI.BaseView.prototype.initialize.call(this, options);
|
||||
|
||||
// this.store = this.options.store;
|
||||
// this.popoverChanges = this.options.popoverChanges;
|
||||
this.appConfig = options.mode;
|
||||
|
||||
if ( this.appConfig.canReview ) {
|
||||
|
@ -807,18 +450,6 @@ define([
|
|||
this.fireEvent('show', this);
|
||||
},
|
||||
|
||||
getPopover: function (sdkViewName) {
|
||||
if (this.appConfig.canReview && _.isUndefined(this.popover)) {
|
||||
this.popover = new Common.Views.ReviewChangesPopover({
|
||||
store: this.options.popoverChanges,
|
||||
delegate: this,
|
||||
renderTo: sdkViewName
|
||||
});
|
||||
}
|
||||
|
||||
return this.popover;
|
||||
},
|
||||
|
||||
getButton: function(type, parent) {
|
||||
if ( type == 'turn' && parent == 'statusbar' ) {
|
||||
var button = new Common.UI.Button({
|
||||
|
|
935
apps/common/main/lib/view/ReviewPopover.js
Normal file
935
apps/common/main/lib/view/ReviewPopover.js
Normal file
|
@ -0,0 +1,935 @@
|
|||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System Limited 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* ReviewPopover.js
|
||||
*
|
||||
* View
|
||||
*
|
||||
* Created by Julia Radzhabova on 06.06.2018
|
||||
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
if (Common === undefined)
|
||||
var Common = {};
|
||||
|
||||
Common.Views = Common.Views || {};
|
||||
|
||||
define([
|
||||
'text!common/main/lib/template/CommentsPopover.template',
|
||||
'text!common/main/lib/template/ReviewChangesPopover.template',
|
||||
'common/main/lib/util/utils',
|
||||
'common/main/lib/component/Button',
|
||||
'common/main/lib/component/ComboBox',
|
||||
'common/main/lib/component/DataView',
|
||||
'common/main/lib/component/Layout',
|
||||
'common/main/lib/component/Window'
|
||||
], function (commentsTemplate, reviewTemplate) {
|
||||
'use strict';
|
||||
|
||||
function replaceWords(template, words) {
|
||||
var word,
|
||||
value,
|
||||
tpl = template;
|
||||
|
||||
for (word in words) {
|
||||
if (undefined !== word) {
|
||||
value = words[word];
|
||||
tpl = tpl.replace(new RegExp(word, 'g'), value);
|
||||
}
|
||||
}
|
||||
|
||||
return tpl;
|
||||
}
|
||||
|
||||
Common.Views.ReviewPopover = Common.UI.Window.extend(_.extend({
|
||||
|
||||
// Window
|
||||
|
||||
initialize: function (options) {
|
||||
var _options = {};
|
||||
|
||||
_.extend(_options, {
|
||||
closable: false,
|
||||
width: 265,
|
||||
height: 120,
|
||||
header: false,
|
||||
modal: false,
|
||||
alias: 'Common.Views.ReviewPopover'
|
||||
}, options);
|
||||
|
||||
this.template = options.template || [
|
||||
'<div class="box">',
|
||||
'<div id="id-popover" class="comments-popover" style="overflow-y: hidden;position: relative;">',
|
||||
'<div id="id-review-popover"></div>',
|
||||
'<div id="id-comments-popover"></div>',
|
||||
'</div>',
|
||||
'<div id="id-comments-arrow" class="comments-arrow"></div>',
|
||||
'</div>'
|
||||
].join('');
|
||||
|
||||
this.commentsStore = options.commentsStore;
|
||||
this.reviewStore = options.reviewStore;
|
||||
this._state = {commentsVisible: false, reviewVisible: false};
|
||||
|
||||
_options.tpl = _.template(this.template)(_options);
|
||||
|
||||
this.arrow = {margin: 20, width: 12, height: 34};
|
||||
this.sdkBounds = {width: 0, height: 0, padding: 10, paddingTop: 20};
|
||||
|
||||
Common.UI.Window.prototype.initialize.call(this, _options);
|
||||
return this;
|
||||
},
|
||||
render: function (comments, review) {
|
||||
Common.UI.Window.prototype.render.call(this);
|
||||
|
||||
var me = this,
|
||||
window = this.$window;
|
||||
|
||||
window.css({
|
||||
height: '',
|
||||
minHeight: '',
|
||||
overflow: 'hidden',
|
||||
position: 'absolute',
|
||||
zIndex: '990'
|
||||
});
|
||||
|
||||
var body = window.find('.body');
|
||||
if (body) {
|
||||
body.css('position', 'relative');
|
||||
}
|
||||
|
||||
var CommentsPopoverDataView = Common.UI.DataView.extend((function () {
|
||||
|
||||
var parentView = me;
|
||||
|
||||
return {
|
||||
|
||||
options: {
|
||||
handleSelect: false,
|
||||
allowScrollbar: false,
|
||||
template: _.template('<div class="dataview-ct inner" style="overflow-y: visible;"></div>')
|
||||
},
|
||||
|
||||
getTextBox: function () {
|
||||
var text = $(this.el).find('textarea');
|
||||
return (text && text.length) ? text : undefined;
|
||||
},
|
||||
setFocusToTextBox: function (blur) {
|
||||
var text = $(this.el).find('textarea');
|
||||
if (blur) {
|
||||
text.blur();
|
||||
} else {
|
||||
if (text && text.length) {
|
||||
var val = text.val();
|
||||
text.focus();
|
||||
text.val('');
|
||||
text.val(val);
|
||||
}
|
||||
}
|
||||
},
|
||||
getActiveTextBoxVal: function () {
|
||||
var text = $(this.el).find('textarea');
|
||||
return (text && text.length) ? text.val().trim() : '';
|
||||
},
|
||||
autoHeightTextBox: function () {
|
||||
var view = this,
|
||||
textBox = this.$el.find('textarea'),
|
||||
domTextBox = null,
|
||||
minHeight = 50,
|
||||
lineHeight = 0,
|
||||
scrollPos = 0,
|
||||
oldHeight = 0,
|
||||
newHeight = 0;
|
||||
|
||||
function updateTextBoxHeight() {
|
||||
scrollPos = parentView.scroller.getScrollTop();
|
||||
|
||||
if (domTextBox.scrollHeight > domTextBox.clientHeight) {
|
||||
textBox.css({height: (domTextBox.scrollHeight + lineHeight) + 'px'});
|
||||
|
||||
parentView.calculateSizeOfContent();
|
||||
} else {
|
||||
oldHeight = domTextBox.clientHeight;
|
||||
if (oldHeight >= minHeight) {
|
||||
textBox.css({height: minHeight + 'px'});
|
||||
|
||||
if (domTextBox.scrollHeight > domTextBox.clientHeight) {
|
||||
newHeight = Math.max(domTextBox.scrollHeight + lineHeight, minHeight);
|
||||
textBox.css({height: newHeight + 'px'});
|
||||
}
|
||||
|
||||
parentView.calculateSizeOfContent();
|
||||
parentView.setLeftTop(me.arrowPosX, me.arrowPosY, me.leftX);
|
||||
parentView.calculateSizeOfContent();
|
||||
}
|
||||
}
|
||||
|
||||
parentView.scroller.scrollTop(scrollPos);
|
||||
view.autoScrollToEditButtons();
|
||||
}
|
||||
|
||||
if (textBox && textBox.length) {
|
||||
domTextBox = textBox.get(0);
|
||||
|
||||
if (domTextBox) {
|
||||
lineHeight = parseInt(textBox.css('lineHeight'), 10) * 0.25;
|
||||
updateTextBoxHeight();
|
||||
textBox.bind('input propertychange', updateTextBoxHeight)
|
||||
}
|
||||
}
|
||||
|
||||
this.textBox = textBox;
|
||||
},
|
||||
clearTextBoxBind: function () {
|
||||
if (this.textBox) {
|
||||
this.textBox.unbind('input propertychange');
|
||||
this.textBox = undefined;
|
||||
}
|
||||
},
|
||||
autoScrollToEditButtons: function () {
|
||||
var button = $('#id-comments-change-popover'), // TODO: add to cache
|
||||
btnBounds = null,
|
||||
contentBounds = this.el.getBoundingClientRect(),
|
||||
moveY = 0,
|
||||
padding = 7;
|
||||
|
||||
if (button.length) {
|
||||
btnBounds = button.get(0).getBoundingClientRect();
|
||||
if (btnBounds && contentBounds) {
|
||||
moveY = contentBounds.bottom - (btnBounds.bottom + padding);
|
||||
if (moveY < 0) {
|
||||
parentView.scroller.scrollTop(parentView.scroller.getScrollTop() - moveY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})());
|
||||
if (CommentsPopoverDataView) {
|
||||
if (this.commentsView) {
|
||||
this.commentsView.render($('#id-comments-popover'));
|
||||
this.commentsView.onResetItems();
|
||||
} else {
|
||||
this.commentsView = new CommentsPopoverDataView({
|
||||
el: $('#id-comments-popover'),
|
||||
store: me.commentsStore,
|
||||
itemTemplate: _.template(replaceWords(commentsTemplate, {
|
||||
textAddReply: me.textAddReply,
|
||||
textAdd: me.textAdd,
|
||||
textCancel: me.textCancel,
|
||||
textEdit: me.textEdit,
|
||||
textReply: me.textReply,
|
||||
textClose: me.textClose,
|
||||
maxCommLength: Asc.c_oAscMaxCellOrCommentLength
|
||||
})
|
||||
)
|
||||
});
|
||||
|
||||
var addtooltip = function (dataview, view, record) {
|
||||
if (view.tipsArray) {
|
||||
view.tipsArray.forEach(function (item) {
|
||||
item.remove();
|
||||
});
|
||||
}
|
||||
|
||||
var arr = [],
|
||||
btns = $(view.el).find('.btn-resolve');
|
||||
btns.tooltip({title: me.textResolve, placement: 'cursor'});
|
||||
btns.each(function (idx, item) {
|
||||
arr.push($(item).data('bs.tooltip').tip());
|
||||
});
|
||||
btns = $(view.el).find('.btn-resolve-check');
|
||||
btns.tooltip({title: me.textOpenAgain, placement: 'cursor'});
|
||||
btns.each(function (idx, item) {
|
||||
arr.push($(item).data('bs.tooltip').tip());
|
||||
});
|
||||
view.tipsArray = arr;
|
||||
this.autoHeightTextBox();
|
||||
};
|
||||
|
||||
var onCommentsViewMouseOver = function () {
|
||||
me._isMouseOver = true;
|
||||
};
|
||||
|
||||
var onCommentsViewMouseOut = function () {
|
||||
me._isMouseOver = false;
|
||||
};
|
||||
|
||||
this.commentsView.on('item:add', addtooltip);
|
||||
this.commentsView.on('item:remove', addtooltip);
|
||||
this.commentsView.on('item:change', addtooltip);
|
||||
this.commentsView.cmpEl.on('mouseover', onCommentsViewMouseOver).on('mouseout', onCommentsViewMouseOut);
|
||||
|
||||
this.commentsView.on('item:click', function (picker, item, record, e) {
|
||||
var btn, showEditBox, showReplyBox, commentId, replyId, hideAddReply;
|
||||
|
||||
function readdresolves() {
|
||||
me.update();
|
||||
}
|
||||
|
||||
btn = $(e.target);
|
||||
if (btn) {
|
||||
showEditBox = record.get('editTextInPopover');
|
||||
showReplyBox = record.get('showReplyInPopover');
|
||||
hideAddReply = record.get('hideAddReply');
|
||||
commentId = record.get('uid');
|
||||
replyId = btn.attr('data-value');
|
||||
|
||||
if (record.get('hint')) {
|
||||
me.fireEvent('comment:disableHint', [record]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (btn.hasClass('btn-edit')) {
|
||||
if (!_.isUndefined(replyId)) {
|
||||
me.fireEvent('comment:closeEditing', [commentId]);
|
||||
me.fireEvent('comment:editReply', [commentId, replyId, true]);
|
||||
|
||||
this.replyId = replyId;
|
||||
|
||||
this.autoHeightTextBox();
|
||||
|
||||
me.calculateSizeOfContent();
|
||||
me.setLeftTop(me.arrowPosX, me.arrowPosY, me.leftX);
|
||||
me.calculateSizeOfContent();
|
||||
|
||||
readdresolves();
|
||||
|
||||
me.hookTextBox();
|
||||
|
||||
this.autoScrollToEditButtons();
|
||||
this.setFocusToTextBox();
|
||||
} else {
|
||||
if (!showEditBox) {
|
||||
me.fireEvent('comment:closeEditing');
|
||||
record.set('editTextInPopover', true);
|
||||
|
||||
me.fireEvent('comment:show', [commentId]);
|
||||
|
||||
this.autoHeightTextBox();
|
||||
|
||||
me.calculateSizeOfContent();
|
||||
me.setLeftTop(me.arrowPosX, me.arrowPosY, me.leftX);
|
||||
me.calculateSizeOfContent();
|
||||
|
||||
readdresolves();
|
||||
|
||||
me.hookTextBox();
|
||||
|
||||
this.autoScrollToEditButtons();
|
||||
this.setFocusToTextBox();
|
||||
}
|
||||
}
|
||||
} else if (btn.hasClass('btn-delete')) {
|
||||
if (!_.isUndefined(replyId)) {
|
||||
me.fireEvent('comment:removeReply', [commentId, replyId]);
|
||||
|
||||
me.calculateSizeOfContent();
|
||||
me.setLeftTop(me.arrowPosX, me.arrowPosY, me.leftX);
|
||||
me.calculateSizeOfContent();
|
||||
|
||||
} else {
|
||||
me.fireEvent('comment:remove', [commentId]);
|
||||
}
|
||||
|
||||
me.fireEvent('comment:closeEditing');
|
||||
|
||||
readdresolves();
|
||||
|
||||
} else if (btn.hasClass('user-reply')) {
|
||||
me.fireEvent('comment:closeEditing');
|
||||
record.set('showReplyInPopover', true);
|
||||
|
||||
me.calculateSizeOfContent();
|
||||
me.setLeftTop(me.arrowPosX, me.arrowPosY, me.leftX);
|
||||
me.calculateSizeOfContent();
|
||||
|
||||
readdresolves();
|
||||
|
||||
this.autoHeightTextBox();
|
||||
me.hookTextBox();
|
||||
|
||||
this.autoScrollToEditButtons();
|
||||
this.setFocusToTextBox();
|
||||
} else if (btn.hasClass('btn-reply', false)) {
|
||||
if (showReplyBox) {
|
||||
this.clearTextBoxBind();
|
||||
|
||||
me.fireEvent('comment:addReply', [commentId, this.getActiveTextBoxVal()]);
|
||||
me.fireEvent('comment:closeEditing');
|
||||
|
||||
readdresolves();
|
||||
}
|
||||
} else if (btn.hasClass('btn-close', false)) {
|
||||
me.fireEvent('comment:closeEditing', [commentId]);
|
||||
me.calculateSizeOfContent();
|
||||
me.fireEvent('comment:show', [commentId]);
|
||||
|
||||
readdresolves();
|
||||
|
||||
} else if (btn.hasClass('btn-inner-edit', false)) {
|
||||
|
||||
if (record.get('dummy')) {
|
||||
var commentVal = this.getActiveTextBoxVal();
|
||||
if (commentVal.length > 0)
|
||||
me.fireEvent('comment:addDummyComment', [commentVal]);
|
||||
else {
|
||||
var text = me.$window.find('textarea:not(.user-message)');
|
||||
if (text && text.length)
|
||||
setTimeout(function () {
|
||||
text.focus();
|
||||
}, 10);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
this.clearTextBoxBind();
|
||||
|
||||
if (!_.isUndefined(this.replyId)) {
|
||||
me.fireEvent('comment:changeReply', [commentId, this.replyId, this.getActiveTextBoxVal()]);
|
||||
this.replyId = undefined;
|
||||
me.fireEvent('comment:closeEditing');
|
||||
} else if (showEditBox) {
|
||||
me.fireEvent('comment:change', [commentId, this.getActiveTextBoxVal()]);
|
||||
me.fireEvent('comment:closeEditing');
|
||||
me.calculateSizeOfContent();
|
||||
}
|
||||
|
||||
readdresolves();
|
||||
|
||||
} else if (btn.hasClass('btn-inner-close', false)) {
|
||||
if (record.get('dummy')) {
|
||||
me.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
if (hideAddReply && this.getActiveTextBoxVal().length > 0) {
|
||||
me.saveText();
|
||||
record.set('hideAddReply', false);
|
||||
this.getTextBox().val(me.textVal);
|
||||
this.autoHeightTextBox();
|
||||
} else {
|
||||
|
||||
this.clearTextBoxBind();
|
||||
|
||||
me.fireEvent('comment:closeEditing', [commentId]);
|
||||
}
|
||||
|
||||
this.replyId = undefined;
|
||||
|
||||
me.calculateSizeOfContent();
|
||||
me.setLeftTop(me.arrowPosX, me.arrowPosY, me.leftX);
|
||||
me.calculateSizeOfContent();
|
||||
|
||||
readdresolves();
|
||||
|
||||
} else if (btn.hasClass('btn-resolve', false)) {
|
||||
var tip = btn.data('bs.tooltip');
|
||||
if (tip) tip.dontShow = true;
|
||||
|
||||
me.fireEvent('comment:resolve', [commentId]);
|
||||
|
||||
readdresolves();
|
||||
} else if (btn.hasClass('btn-resolve-check', false)) {
|
||||
var tip = btn.data('bs.tooltip');
|
||||
if (tip) tip.dontShow = true;
|
||||
|
||||
me.fireEvent('comment:resolve', [commentId]);
|
||||
|
||||
readdresolves();
|
||||
}
|
||||
}
|
||||
});
|
||||
me.on({
|
||||
'show': function () {
|
||||
me.commentsView.autoHeightTextBox();
|
||||
me.$window.find('textarea').keydown(function (event) {
|
||||
if (event.keyCode == Common.UI.Keys.ESC) {
|
||||
me.hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
'animate:before': function () {
|
||||
var text = me.$window.find('textarea');
|
||||
if (text && text.length)
|
||||
text.focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var ReviewPopoverDataView = Common.UI.DataView.extend((function() {
|
||||
|
||||
return {
|
||||
options : {
|
||||
handleSelect: false,
|
||||
scrollable: true,
|
||||
template: _.template('<div class="dataview-ct inner" style="overflow-y: visible;">'+
|
||||
'</div>' +
|
||||
'<div class="lock-area" style="cursor: default;"></div>' +
|
||||
'<div class="lock-author" style="cursor: default;"></div>'
|
||||
)
|
||||
}
|
||||
}
|
||||
})());
|
||||
if (ReviewPopoverDataView) {
|
||||
if (this.reviewChangesView) {
|
||||
this.reviewChangesView.render($('#id-review-popover'));
|
||||
this.reviewChangesView.onResetItems();
|
||||
} else {
|
||||
this.reviewChangesView = new ReviewPopoverDataView({
|
||||
el: $('#id-review-popover'),
|
||||
store: me.reviewStore,
|
||||
itemTemplate: _.template(reviewTemplate)
|
||||
});
|
||||
|
||||
this.reviewChangesView.on('item:click', function (picker, item, record, e) {
|
||||
var btn = $(e.target);
|
||||
if (btn) {
|
||||
if (btn.hasClass('btn-accept')) {
|
||||
me.fireEvent('reviewchange:accept', [record.get('changedata')]);
|
||||
} else if (btn.hasClass('btn-reject')) {
|
||||
me.fireEvent('reviewchange:reject', [record.get('changedata')]);
|
||||
} else if (btn.hasClass('btn-delete')) {
|
||||
me.fireEvent('reviewchange:delete', [record.get('changedata')]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (_.isUndefined(this.scroller)) {
|
||||
this.scroller = new Common.UI.Scroller({
|
||||
el: window.find('#id-popover'),
|
||||
minScrollbarLength : 40,
|
||||
wheelSpeed: 10,
|
||||
alwaysVisibleY: true
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
showComments: function (animate, loadText, focus, showText) {
|
||||
this.options.animate = animate;
|
||||
|
||||
var me = this, textBox = this.commentsView.getTextBox();
|
||||
|
||||
if (loadText && this.textVal) {
|
||||
textBox && textBox.val(this.textVal);
|
||||
}
|
||||
|
||||
if (showText && showText.length) {
|
||||
textBox && textBox.val(showText);
|
||||
}
|
||||
|
||||
this.show(animate);
|
||||
this.hookTextBox();
|
||||
|
||||
this._state.commentsVisible = true;
|
||||
},
|
||||
|
||||
showReview: function (animate, lock, lockuser) {
|
||||
this.show(animate);
|
||||
this.reviewChangesView.cmpEl.find('.lock-area').toggleClass('hidden', !lock);
|
||||
this.reviewChangesView.cmpEl.find('.lock-author').toggleClass('hidden', !lock || _.isEmpty(lockuser)).text(lockuser);
|
||||
this._state.reviewVisible = true;
|
||||
},
|
||||
|
||||
show: function (animate, loadText, focus, showText) {
|
||||
this.options.animate = animate;
|
||||
|
||||
Common.UI.Window.prototype.show.call(this);
|
||||
if (this.scroller) {
|
||||
this.scroller.update({minScrollbarLength: 40, alwaysVisibleY: true});
|
||||
}
|
||||
},
|
||||
|
||||
hideComments: function () {
|
||||
if (this.handlerHide) {
|
||||
this.handlerHide();
|
||||
}
|
||||
this.hideTips();
|
||||
this._state.commentsVisible = false;
|
||||
if (!this._state.reviewVisible)
|
||||
this.hide();
|
||||
else
|
||||
this.calculateSizeOfContent();
|
||||
},
|
||||
|
||||
hideReview: function () {
|
||||
if (this.handlerHide) {
|
||||
this.handlerHide();
|
||||
}
|
||||
this.hideTips();
|
||||
|
||||
this._state.reviewVisible = false;
|
||||
if (!this._state.commentsVisible)
|
||||
this.hide();
|
||||
else
|
||||
this.calculateSizeOfContent();
|
||||
},
|
||||
|
||||
hide: function () {
|
||||
if (this.handlerHide) {
|
||||
this.handlerHide();
|
||||
}
|
||||
|
||||
this.hideTips();
|
||||
|
||||
Common.UI.Window.prototype.hide.call(this);
|
||||
|
||||
if (!_.isUndefined(this.e) && this.e.keyCode == Common.UI.Keys.ESC) {
|
||||
this.e.preventDefault();
|
||||
this.e.stopImmediatePropagation();
|
||||
this.e = undefined;
|
||||
}
|
||||
},
|
||||
|
||||
// CommentsPopover
|
||||
|
||||
update: function (needRender) {
|
||||
if (this.commentsView && needRender)
|
||||
this.commentsView.onResetItems();
|
||||
if (this.scroller) {
|
||||
this.scroller.update({minScrollbarLength: 40, alwaysVisibleY: true});
|
||||
}
|
||||
},
|
||||
|
||||
isVisible: function () {
|
||||
return (this.$window && this.$window.is(':visible'));
|
||||
},
|
||||
setLeftTop: function (posX, posY, leftX, loadInnerValues, retainContent) {
|
||||
if (!this.$window)
|
||||
this.render();
|
||||
|
||||
if (loadInnerValues) {
|
||||
posX = this.arrowPosX;
|
||||
posY = this.arrowPosY;
|
||||
leftX = this.leftX;
|
||||
}
|
||||
|
||||
if (_.isUndefined(posX) && _.isUndefined(posY))
|
||||
return;
|
||||
|
||||
this.arrowPosX = posX;
|
||||
this.arrowPosY = posY;
|
||||
this.leftX = leftX;
|
||||
|
||||
var commentsView = $('#id-popover'),
|
||||
arrowView = $('#id-comments-arrow'),
|
||||
editorView = $('#editor_sdk'),
|
||||
editorBounds = null,
|
||||
sdkBoundsHeight = 0,
|
||||
sdkBoundsTop = 0,
|
||||
sdkBoundsLeft = 0,
|
||||
sdkPanelRight = '',
|
||||
sdkPanelRightWidth = 0,
|
||||
sdkPanelLeft = '',
|
||||
sdkPanelLeftWidth = 0,
|
||||
sdkPanelThumbs = '', // for PE
|
||||
sdkPanelThumbsWidth = 0, // for PE
|
||||
sdkPanelTop = '',
|
||||
sdkPanelHeight = 0,
|
||||
leftPos = 0,
|
||||
windowWidth = 0,
|
||||
outerHeight = 0,
|
||||
topPos = 0,
|
||||
sdkBoundsTopPos = 0;
|
||||
|
||||
if (commentsView && arrowView && editorView && editorView.get(0)) {
|
||||
editorBounds = editorView.get(0).getBoundingClientRect();
|
||||
if (editorBounds) {
|
||||
sdkBoundsHeight = editorBounds.height - this.sdkBounds.padding * 2;
|
||||
|
||||
this.$window.css({maxHeight: sdkBoundsHeight + 'px'});
|
||||
|
||||
this.sdkBounds.width = editorBounds.width;
|
||||
this.sdkBounds.height = editorBounds.height;
|
||||
|
||||
// LEFT CORNER
|
||||
|
||||
if (!_.isUndefined(posX)) {
|
||||
|
||||
sdkPanelRight = $('#id_vertical_scroll');
|
||||
if (sdkPanelRight.length) {
|
||||
sdkPanelRightWidth = (sdkPanelRight.css('display') !== 'none') ? sdkPanelRight.width() : 0;
|
||||
} else {
|
||||
sdkPanelRight = $('#ws-v-scrollbar');
|
||||
if (sdkPanelRight.length) {
|
||||
sdkPanelRightWidth = (sdkPanelRight.css('display') !== 'none') ? sdkPanelRight.width() : 0;
|
||||
}
|
||||
}
|
||||
|
||||
this.sdkBounds.width -= sdkPanelRightWidth;
|
||||
|
||||
sdkPanelLeft = $('#id_panel_left');
|
||||
if (sdkPanelLeft.length) {
|
||||
sdkPanelLeftWidth = (sdkPanelLeft.css('display') !== 'none') ? sdkPanelLeft.width() : 0;
|
||||
}
|
||||
sdkPanelThumbs = $('#id_panel_thumbnails');
|
||||
if (sdkPanelThumbs.length) {
|
||||
sdkPanelThumbsWidth = (sdkPanelThumbs.css('display') !== 'none') ? sdkPanelThumbs.width() : 0;
|
||||
this.sdkBounds.width -= sdkPanelThumbsWidth;
|
||||
}
|
||||
|
||||
leftPos = Math.min(sdkBoundsLeft + posX + this.arrow.width, sdkBoundsLeft + this.sdkBounds.width - this.$window.outerWidth() - 25);
|
||||
leftPos = Math.max(sdkBoundsLeft + sdkPanelLeftWidth + this.arrow.width, leftPos);
|
||||
|
||||
arrowView.removeClass('right').addClass('left');
|
||||
|
||||
if (!_.isUndefined(leftX)) {
|
||||
windowWidth = this.$window.outerWidth();
|
||||
if (windowWidth) {
|
||||
if ((posX + windowWidth > this.sdkBounds.width - this.arrow.width + 5) && (this.leftX > windowWidth)) {
|
||||
leftPos = this.leftX - windowWidth + sdkBoundsLeft - this.arrow.width;
|
||||
arrowView.removeClass('left').addClass('right');
|
||||
} else {
|
||||
leftPos = sdkBoundsLeft + posX + this.arrow.width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.$window.css('left', leftPos + 'px');
|
||||
}
|
||||
|
||||
// TOP CORNER
|
||||
|
||||
if (!_.isUndefined(posY)) {
|
||||
sdkPanelTop = $('#id_panel_top');
|
||||
sdkBoundsTopPos = sdkBoundsTop;
|
||||
if (sdkPanelTop.length) {
|
||||
sdkPanelHeight = (sdkPanelTop.css('display') !== 'none') ? sdkPanelTop.height() : 0;
|
||||
sdkBoundsTopPos += this.sdkBounds.paddingTop;
|
||||
} else {
|
||||
sdkPanelTop = $('#ws-h-scrollbar');
|
||||
if (sdkPanelTop.length) {
|
||||
sdkPanelHeight = (sdkPanelTop.css('display') !== 'none') ? sdkPanelTop.height() : 0;
|
||||
}
|
||||
}
|
||||
|
||||
this.sdkBounds.height -= sdkPanelHeight;
|
||||
|
||||
outerHeight = this.$window.outerHeight();
|
||||
|
||||
topPos = Math.min(sdkBoundsTop + sdkBoundsHeight - outerHeight, this.arrowPosY + sdkBoundsTop - this.arrow.height);
|
||||
topPos = Math.max(topPos, sdkBoundsTopPos);
|
||||
|
||||
this.$window.css('top', topPos + 'px');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!retainContent)
|
||||
this.calculateSizeOfContent();
|
||||
},
|
||||
calculateSizeOfContent: function (testVisible) {
|
||||
if (testVisible && !this.$window.is(':visible'))
|
||||
return;
|
||||
|
||||
this.$window.css({overflow: 'hidden'});
|
||||
|
||||
var arrowView = $('#id-comments-arrow'),
|
||||
commentsView = $('#id-popover'),
|
||||
contentBounds = null,
|
||||
editorView = null,
|
||||
editorBounds = null,
|
||||
sdkBoundsHeight = 0,
|
||||
sdkBoundsTop = 0,
|
||||
sdkBoundsLeft = 0,
|
||||
sdkPanelTop = '',
|
||||
sdkPanelHeight = 0,
|
||||
arrowPosY = 0,
|
||||
windowHeight = 0,
|
||||
outerHeight = 0,
|
||||
topPos = 0,
|
||||
sdkBoundsTopPos = 0;
|
||||
|
||||
if (commentsView && arrowView && commentsView.get(0)) {
|
||||
commentsView.css({height: '100%'});
|
||||
|
||||
contentBounds = commentsView.get(0).getBoundingClientRect();
|
||||
if (contentBounds) {
|
||||
editorView = $('#editor_sdk');
|
||||
if (editorView && editorView.get(0)) {
|
||||
editorBounds = editorView.get(0).getBoundingClientRect();
|
||||
if (editorBounds) {
|
||||
sdkBoundsHeight = editorBounds.height - this.sdkBounds.padding * 2;
|
||||
sdkBoundsTopPos = sdkBoundsTop;
|
||||
windowHeight = this.$window.outerHeight();
|
||||
|
||||
// TOP CORNER
|
||||
|
||||
sdkPanelTop = $('#id_panel_top');
|
||||
if (sdkPanelTop.length) {
|
||||
sdkPanelHeight = (sdkPanelTop.css('display') !== 'none') ? sdkPanelTop.height() : 0;
|
||||
sdkBoundsTopPos += this.sdkBounds.paddingTop;
|
||||
} else {
|
||||
sdkPanelTop = $('#ws-h-scrollbar');
|
||||
if (sdkPanelTop.length) {
|
||||
sdkPanelHeight = (sdkPanelTop.css('display') !== 'none') ? sdkPanelTop.height() : 0;
|
||||
}
|
||||
}
|
||||
|
||||
outerHeight = Math.max(commentsView.outerHeight(), this.$window.outerHeight());
|
||||
|
||||
if (sdkBoundsHeight <= outerHeight) {
|
||||
this.$window.css({
|
||||
maxHeight: sdkBoundsHeight - sdkPanelHeight + 'px',
|
||||
top: sdkBoundsTop + sdkPanelHeight + 'px'
|
||||
});
|
||||
|
||||
commentsView.css({height: sdkBoundsHeight - sdkPanelHeight - 3 + 'px'});
|
||||
|
||||
// arrowPosY = Math.max(this.arrow.margin, this.arrowPosY - sdkPanelHeight - this.arrow.width);
|
||||
arrowPosY = Math.min(arrowPosY, sdkBoundsHeight - (sdkPanelHeight + this.arrow.margin + this.arrow.width));
|
||||
|
||||
arrowView.css({top: arrowPosY + 'px'});
|
||||
} else {
|
||||
|
||||
outerHeight = windowHeight;
|
||||
|
||||
if (outerHeight > 0) {
|
||||
if (contentBounds.top + outerHeight > sdkBoundsHeight + sdkBoundsTop || contentBounds.height === 0) {
|
||||
topPos = Math.min(sdkBoundsTop + sdkBoundsHeight - outerHeight, this.arrowPosY + sdkBoundsTop - this.arrow.height);
|
||||
topPos = Math.max(topPos, sdkBoundsTopPos);
|
||||
|
||||
this.$window.css({top: topPos + 'px'});
|
||||
}
|
||||
}
|
||||
|
||||
arrowPosY = Math.max(this.arrow.margin, this.arrowPosY - (sdkBoundsHeight - outerHeight) - this.arrow.width);
|
||||
arrowPosY = Math.min(arrowPosY, outerHeight - this.arrow.margin - this.arrow.width);
|
||||
|
||||
arrowView.css({top: arrowPosY + 'px'});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.$window.css({overflow: ''});
|
||||
},
|
||||
saveText: function (clear) {
|
||||
if (this.commentsView && this.commentsView.cmpEl.find('.lock-area').length < 1) {
|
||||
this.textVal = undefined;
|
||||
if (!clear) {
|
||||
this.textVal = this.commentsView.getActiveTextBoxVal();
|
||||
} else {
|
||||
this.commentsView.clearTextBoxBind();
|
||||
}
|
||||
}
|
||||
},
|
||||
loadText: function () {
|
||||
if (this.textVal && this.commentsView) {
|
||||
var textBox = this.commentsView.getTextBox();
|
||||
textBox && textBox.val(this.textVal);
|
||||
}
|
||||
},
|
||||
getEditText: function () {
|
||||
if (this.commentsView) {
|
||||
return this.commentsView.getActiveTextBoxVal();
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
|
||||
hookTextBox: function () {
|
||||
var me = this, textBox = this.commentsView.getTextBox();
|
||||
|
||||
textBox && textBox.keydown(function (event) {
|
||||
if ((event.ctrlKey || event.metaKey) && !event.altKey && event.keyCode === Common.UI.Keys.RETURN) {
|
||||
var buttonChangeComment = $('#id-comments-change-popover');
|
||||
if (buttonChangeComment && buttonChangeComment.length) {
|
||||
buttonChangeComment.click();
|
||||
}
|
||||
|
||||
event.stopImmediatePropagation();
|
||||
} else if (event.keyCode === Common.UI.Keys.TAB) {
|
||||
var $this, end, start;
|
||||
start = this.selectionStart;
|
||||
end = this.selectionEnd;
|
||||
$this = $(this);
|
||||
$this.val($this.val().substring(0, start) + '\t' + $this.val().substring(end));
|
||||
this.selectionStart = this.selectionEnd = start + 1;
|
||||
|
||||
event.stopImmediatePropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
me.e = event;
|
||||
});
|
||||
},
|
||||
|
||||
hideTips: function () {
|
||||
if (this.commentsView)
|
||||
_.each(this.commentsView.dataViewItems, function (item) {
|
||||
if (item.tipsArray) {
|
||||
item.tipsArray.forEach(function (item) {
|
||||
item.hide();
|
||||
});
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
|
||||
isCommentsViewMouseOver: function () {
|
||||
return this._isMouseOver;
|
||||
},
|
||||
|
||||
setReviewStore: function(store) {
|
||||
this.reviewStore = store;
|
||||
if (this.reviewChangesView)
|
||||
this.reviewChangesView.setStore(this.reviewStore);
|
||||
},
|
||||
|
||||
setCommentsStore: function(store) {
|
||||
this.commentsStore = store;
|
||||
if (this.commentsView)
|
||||
this.commentsView.setStore(this.commentsStore);
|
||||
},
|
||||
|
||||
getPopover: function(options) {
|
||||
if (!this.popover)
|
||||
this.popover = new Common.Views.ReviewPopover(options);
|
||||
return this.popover;
|
||||
},
|
||||
|
||||
textAddReply : 'Add Reply',
|
||||
textAdd : "Add",
|
||||
textCancel : 'Cancel',
|
||||
textEdit : 'Edit',
|
||||
textReply : 'Reply',
|
||||
textClose : 'Close',
|
||||
textResolve : 'Resolve',
|
||||
textOpenAgain : "Open Again"
|
||||
|
||||
}, Common.Views.ReviewPopover || {}))
|
||||
});
|
|
@ -346,8 +346,13 @@
|
|||
|
||||
.comments-popover {
|
||||
width:100%;
|
||||
height:100%;
|
||||
position: relative;
|
||||
overflow-y: hidden;
|
||||
margin-bottom: 5px;
|
||||
|
||||
.dataview-ct.inner {
|
||||
overflow: visible;
|
||||
}
|
||||
}
|
||||
|
||||
.comments-arrow {
|
||||
|
|
|
@ -271,6 +271,14 @@
|
|||
"Common.Views.ReviewChangesDialog.txtReject": "Reject",
|
||||
"Common.Views.ReviewChangesDialog.txtRejectAll": "Reject All Changes",
|
||||
"Common.Views.ReviewChangesDialog.txtRejectCurrent": "Reject Current Change",
|
||||
"Common.Views.ReviewPopover.textAdd": "Add",
|
||||
"Common.Views.ReviewPopover.textAddReply": "Add Reply",
|
||||
"Common.Views.ReviewPopover.textCancel": "Cancel",
|
||||
"Common.Views.ReviewPopover.textClose": "Close",
|
||||
"Common.Views.ReviewPopover.textEdit": "OK",
|
||||
"Common.Views.ReviewPopover.textOpenAgain": "Open Again",
|
||||
"Common.Views.ReviewPopover.textReply": "Reply",
|
||||
"Common.Views.ReviewPopover.textResolve": "Resolve",
|
||||
"Common.Views.SignDialog.cancelButtonText": "Cancel",
|
||||
"Common.Views.SignDialog.okButtonText": "Ok",
|
||||
"Common.Views.SignDialog.textBold": "Bold",
|
||||
|
|
|
@ -194,6 +194,14 @@
|
|||
"Common.Views.ReviewChanges.txtSpelling": "Spell Checking",
|
||||
"Common.Views.ReviewChanges.txtTurnon": "Track Changes",
|
||||
"Common.Views.ReviewChanges.txtView": "Display Mode",
|
||||
"Common.Views.ReviewPopover.textAdd": "Add",
|
||||
"Common.Views.ReviewPopover.textAddReply": "Add Reply",
|
||||
"Common.Views.ReviewPopover.textCancel": "Cancel",
|
||||
"Common.Views.ReviewPopover.textClose": "Close",
|
||||
"Common.Views.ReviewPopover.textEdit": "OK",
|
||||
"Common.Views.ReviewPopover.textOpenAgain": "Open Again",
|
||||
"Common.Views.ReviewPopover.textReply": "Reply",
|
||||
"Common.Views.ReviewPopover.textResolve": "Resolve",
|
||||
"Common.Views.SignDialog.cancelButtonText": "Cancel",
|
||||
"Common.Views.SignDialog.okButtonText": "Ok",
|
||||
"Common.Views.SignDialog.textBold": "Bold",
|
||||
|
|
|
@ -184,6 +184,14 @@
|
|||
"Common.Views.ReviewChanges.txtSpelling": "Spell Checking",
|
||||
"Common.Views.ReviewChanges.txtTurnon": "Track Changes",
|
||||
"Common.Views.ReviewChanges.txtView": "Display Mode",
|
||||
"Common.Views.ReviewPopover.textAdd": "Add",
|
||||
"Common.Views.ReviewPopover.textAddReply": "Add Reply",
|
||||
"Common.Views.ReviewPopover.textCancel": "Cancel",
|
||||
"Common.Views.ReviewPopover.textClose": "Close",
|
||||
"Common.Views.ReviewPopover.textEdit": "OK",
|
||||
"Common.Views.ReviewPopover.textOpenAgain": "Open Again",
|
||||
"Common.Views.ReviewPopover.textReply": "Reply",
|
||||
"Common.Views.ReviewPopover.textResolve": "Resolve",
|
||||
"Common.Views.SignDialog.cancelButtonText": "Cancel",
|
||||
"Common.Views.SignDialog.okButtonText": "Ok",
|
||||
"Common.Views.SignDialog.textBold": "Bold",
|
||||
|
|
Loading…
Reference in a new issue