[mobile] Comments (fix bugs)
This commit is contained in:
parent
582c1ab6ce
commit
43c5300cdc
|
@ -804,8 +804,8 @@ define([
|
|||
|
||||
updateViewComment: function() {
|
||||
this.view.renderViewComments(this.showComments, this.indexCurrentComment);
|
||||
$('.comment-menu').single('click', _.bind(this.initMenuComments, this));
|
||||
$('.reply-menu').single('click', _.bind(this.initReplyMenu, this));
|
||||
$('.comment-menu').single('click', _.buffered(this.initMenuComments, 100, this));
|
||||
$('.reply-menu').single('click', _.buffered(this.initReplyMenu, 100, this));
|
||||
$('.comment-resolve').single('click', _.bind(this.onClickResolveComment, this, false));
|
||||
if (this.showComments.length === 1) {
|
||||
$('.prev-comment, .next-comment').addClass('disabled');
|
||||
|
@ -860,9 +860,9 @@ define([
|
|||
me.getView('Common.Views.Collaboration').renderViewComments(me.showComments, me.indexCurrentComment);
|
||||
$('.prev-comment').single('click', _.bind(me.onViewPrevComment, me));
|
||||
$('.next-comment').single('click', _.bind(me.onViewNextComment, me));
|
||||
$('.comment-menu').single('click', _.bind(me.initMenuComments, me));
|
||||
$('.comment-menu').single('click', _.buffered(me.initMenuComments, 100, me));
|
||||
$('.add-reply').single('click', _.bind(me.onClickAddReply, me, false));
|
||||
$('.reply-menu').single('click', _.bind(me.initReplyMenu, me));
|
||||
$('.reply-menu').single('click', _.buffered(me.initReplyMenu, 100, me));
|
||||
$('.comment-resolve').single('click', _.bind(me.onClickResolveComment, me, false));
|
||||
|
||||
if (me.showComments.length === 1) {
|
||||
|
@ -951,8 +951,8 @@ define([
|
|||
this.view.renderViewComments(this.showComments, this.indexCurrentComment);
|
||||
var me = this;
|
||||
_.defer(function () {
|
||||
$('.comment-menu').single('click', _.bind(me.initMenuComments, me));
|
||||
$('.reply-menu').single('click', _.bind(me.initReplyMenu, me));
|
||||
$('.comment-menu').single('click', _.buffered(me.initMenuComments, 100, me));
|
||||
$('.reply-menu').single('click', _.buffered(me.initReplyMenu, 100, me));
|
||||
$('.comment-resolve').single('click', _.bind(me.onClickResolveComment, me, false));
|
||||
});
|
||||
}
|
||||
|
@ -968,8 +968,8 @@ define([
|
|||
this.view.renderViewComments(this.showComments, this.indexCurrentComment);
|
||||
var me = this;
|
||||
_.defer(function () {
|
||||
$('.comment-menu').single('click', _.bind(me.initMenuComments, me));
|
||||
$('.reply-menu').single('click', _.bind(me.initReplyMenu, me));
|
||||
$('.comment-menu').single('click', _.buffered(me.initMenuComments, 100, me));
|
||||
$('.reply-menu').single('click', _.buffered(me.initReplyMenu, 100, me));
|
||||
$('.comment-resolve').single('click', _.bind(me.onClickResolveComment, me, false));
|
||||
});
|
||||
}
|
||||
|
@ -1014,7 +1014,19 @@ define([
|
|||
}
|
||||
_.defer(function () {
|
||||
var $textarea = $('.reply-textarea')[0];
|
||||
var $btnAddReply = $('#add-new-reply');
|
||||
$textarea.focus();
|
||||
$btnAddReply.addClass('disabled');
|
||||
$textarea.oninput = function () {
|
||||
if ($textarea.value.length < 1) {
|
||||
if (!$btnAddReply.hasClass('disabled'))
|
||||
$btnAddReply.addClass('disabled');
|
||||
} else {
|
||||
if ($btnAddReply.hasClass('disabled')) {
|
||||
$btnAddReply.removeClass('disabled');
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
$('#add-new-reply').single('click', _.bind(me.onDoneAddNewReply, me, comment.uid));
|
||||
$('.cancel-reply').single('click', _.bind(me.onCancelAddNewReply, me));
|
||||
|
@ -1050,7 +1062,7 @@ define([
|
|||
if ($viewComment.find('.block-reply').length > 0) {
|
||||
$viewComment.find('.block-reply').remove();
|
||||
}
|
||||
$viewComment.find('a#add-new-reply, a.cancel-reply').css('display', 'none');
|
||||
$viewComment.find('a#add-new-reply, a.cancel-reply').remove();
|
||||
$viewComment.find('a.prev-comment, a.next-comment, a.add-reply').css('display', 'flex');
|
||||
this.disabledViewComments(false);
|
||||
},
|
||||
|
@ -1112,6 +1124,9 @@ define([
|
|||
}
|
||||
}
|
||||
]]);
|
||||
$$(me.menuComments).on('close', function () {
|
||||
me.disabledViewComments(false);
|
||||
});
|
||||
}, 100);
|
||||
}
|
||||
this.disabledViewComments(true);
|
||||
|
@ -1143,7 +1158,7 @@ define([
|
|||
me.onCommentMenuClick(item.event, idComment, ind);
|
||||
}
|
||||
});
|
||||
uiApp.actions([_menuItems, [
|
||||
me.menuReply = uiApp.actions([_menuItems, [
|
||||
{
|
||||
text: me.textCancel,
|
||||
bold: true,
|
||||
|
@ -1152,6 +1167,9 @@ define([
|
|||
}
|
||||
}
|
||||
]]);
|
||||
$$(me.menuReply).on('close', function () {
|
||||
me.disabledViewComments(false);
|
||||
});
|
||||
}, 100);
|
||||
this.disabledViewComments(true);
|
||||
}
|
||||
|
@ -1434,8 +1452,8 @@ define([
|
|||
|
||||
initComments: function() {
|
||||
this.getView('Common.Views.Collaboration').renderComments((this.groupCollectionFilter.length !== 0) ? this.groupCollectionFilter : (this.collectionComments.length !== 0) ? this.collectionComments : false);
|
||||
$('.comment-menu').single('click', _.bind(this.initMenuComments, this));
|
||||
$('.reply-menu').single('click', _.bind(this.initReplyMenu, this));
|
||||
$('.comment-menu').single('click', _.buffered(this.initMenuComments, 100, this));
|
||||
$('.reply-menu').single('click', _.buffered(this.initReplyMenu, 100, this));
|
||||
$('.comment-resolve').single('click', _.bind(this.onClickResolveComment, this, false));
|
||||
$('.comment-quote').single('click', _.bind(this.onSelectComment, this));
|
||||
},
|
||||
|
|
|
@ -151,6 +151,15 @@ define([
|
|||
|
||||
//Comments
|
||||
|
||||
sliceQuote: function(text) {
|
||||
var sliced = text.slice(0,100);
|
||||
if (sliced.length < text.length) {
|
||||
sliced += '...';
|
||||
return sliced;
|
||||
}
|
||||
return text;
|
||||
},
|
||||
|
||||
renderViewComments: function(comments, indCurComment) {
|
||||
var isAndroid = Framework7.prototype.device.android === true;
|
||||
var me = this;
|
||||
|
@ -180,7 +189,7 @@ define([
|
|||
}
|
||||
template += '</div>';
|
||||
|
||||
if (comment.quote) template += '<p class="comment-quote" data-ind="' + comment.uid + '">' + comment.quote + '</p>';
|
||||
if (comment.quote) template += '<p class="comment-quote" data-ind="' + comment.uid + '">' + me.sliceQuote(comment.quote) + '</p>';
|
||||
template += '<div class="comment-text"><span>' + comment.comment + '</span></div>';
|
||||
if (comment.replys.length > 0) {
|
||||
template += '<ul class="list-reply">';
|
||||
|
@ -250,7 +259,7 @@ define([
|
|||
'<% } %>',
|
||||
'</div>',
|
||||
'<% if(item.quote) {%>',
|
||||
'<p class="comment-quote" data-id="<%= item.uid %>"><%= item.quote %></p>',
|
||||
'<p class="comment-quote" data-id="<%= item.uid %>"><%= quote %></p>',
|
||||
'<% } %>',
|
||||
'<p class="comment-text"><span><%= item.comment %></span></p>',
|
||||
'<% if(replys > 0) {%>',
|
||||
|
@ -280,7 +289,8 @@ define([
|
|||
android: Framework7.prototype.device.android,
|
||||
item: comment,
|
||||
replys: comment.replys.length,
|
||||
viewmode: me.viewmode
|
||||
viewmode: me.viewmode,
|
||||
quote: me.sliceQuote(comment.quote)
|
||||
}));
|
||||
});
|
||||
$listComments.html(items.join(''));
|
||||
|
|
|
@ -171,6 +171,7 @@
|
|||
color: @themeColor;
|
||||
border-left: 1px solid @themeColor;
|
||||
padding-left: 10px;
|
||||
padding-right: 16px;
|
||||
margin: 5px 0;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
|
|
@ -152,6 +152,7 @@
|
|||
color: @themeColor;
|
||||
border-left: 1px solid @themeColor;
|
||||
padding-left: 10px;
|
||||
padding-right: 16px;
|
||||
margin: 5px 0;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
|
|
@ -173,7 +173,19 @@ define([
|
|||
$commentInfo.html(insert);
|
||||
_.defer(function () {
|
||||
var $textarea = $('.comment-textarea')[0];
|
||||
var $btnAddComment = $('#done-comment');
|
||||
$btnAddComment.addClass('disabled');
|
||||
$textarea.focus();
|
||||
$textarea.oninput = function () {
|
||||
if ($textarea.value.length < 1) {
|
||||
if (!$btnAddComment.hasClass('disabled'))
|
||||
$btnAddComment.addClass('disabled');
|
||||
} else {
|
||||
if ($btnAddComment.hasClass('disabled')) {
|
||||
$btnAddComment.removeClass('disabled');
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
}, 100);
|
||||
},
|
||||
|
|
|
@ -6690,6 +6690,7 @@ html.pixel-ratio-3 .document-menu .list-block li:last-child li .item-inner:after
|
|||
color: #446995;
|
||||
border-left: 1px solid #446995;
|
||||
padding-left: 10px;
|
||||
padding-right: 16px;
|
||||
margin: 5px 0;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
|
|
@ -6244,6 +6244,7 @@ html.phone .document-menu .list-block .item-link {
|
|||
color: #446995;
|
||||
border-left: 1px solid #446995;
|
||||
padding-left: 10px;
|
||||
padding-right: 16px;
|
||||
margin: 5px 0;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
|
|
@ -143,7 +143,19 @@ define([
|
|||
$commentInfo.html(insert);
|
||||
_.defer(function () {
|
||||
var $textarea = $('.comment-textarea')[0];
|
||||
var $btnAddComment = $('#done-comment');
|
||||
$btnAddComment.addClass('disabled');
|
||||
$textarea.focus();
|
||||
$textarea.oninput = function () {
|
||||
if ($textarea.value.length < 1) {
|
||||
if (!$btnAddComment.hasClass('disabled'))
|
||||
$btnAddComment.addClass('disabled');
|
||||
} else {
|
||||
if ($btnAddComment.hasClass('disabled')) {
|
||||
$btnAddComment.removeClass('disabled');
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
}, 100);
|
||||
},
|
||||
|
|
|
@ -6690,6 +6690,7 @@ html.pixel-ratio-3 .document-menu .list-block li:last-child li .item-inner:after
|
|||
color: #aa5252;
|
||||
border-left: 1px solid #aa5252;
|
||||
padding-left: 10px;
|
||||
padding-right: 16px;
|
||||
margin: 5px 0;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
|
|
@ -6244,6 +6244,7 @@ html.phone .document-menu .list-block .item-link {
|
|||
color: #aa5252;
|
||||
border-left: 1px solid #aa5252;
|
||||
padding-left: 10px;
|
||||
padding-right: 16px;
|
||||
margin: 5px 0;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
|
|
@ -228,7 +228,19 @@ define([
|
|||
$commentInfo.html(insert);
|
||||
_.defer(function () {
|
||||
var $textarea = $('.comment-textarea')[0];
|
||||
var $btnAddComment = $('#done-comment');
|
||||
$btnAddComment.addClass('disabled');
|
||||
$textarea.focus();
|
||||
$textarea.oninput = function () {
|
||||
if ($textarea.value.length < 1) {
|
||||
if (!$btnAddComment.hasClass('disabled'))
|
||||
$btnAddComment.addClass('disabled');
|
||||
} else {
|
||||
if ($btnAddComment.hasClass('disabled')) {
|
||||
$btnAddComment.removeClass('disabled');
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
}, 100);
|
||||
},
|
||||
|
|
|
@ -6683,6 +6683,7 @@ html.pixel-ratio-3 .document-menu .list-block li:last-child li .item-inner:after
|
|||
color: #40865c;
|
||||
border-left: 1px solid #40865c;
|
||||
padding-left: 10px;
|
||||
padding-right: 16px;
|
||||
margin: 5px 0;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
|
|
@ -6254,6 +6254,7 @@ html.phone .document-menu .list-block .item-link {
|
|||
color: #40865c;
|
||||
border-left: 1px solid #40865c;
|
||||
padding-left: 10px;
|
||||
padding-right: 16px;
|
||||
margin: 5px 0;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue