[DE mobile] Comments (add sort comments in collaboration, fix animation when open add comment)

This commit is contained in:
JuliaSvinareva 2020-04-07 13:36:38 +03:00
parent baf8ae6074
commit 37007d9005
3 changed files with 29 additions and 22 deletions

View file

@ -220,9 +220,10 @@ define([
if ($('#no-comments').length > 0) {
$('#no-comments').remove();
}
var sortComments = _.sortBy(comments, 'time').reverse();
var $listComments = $('#comments-list'),
items = [];
_.each(comments, function (comment) {
_.each(sortComments, function (comment) {
var itemTemplate = [
'<li class="comment item-content" data-uid="<%= item.uid %>">',
'<div class="item-inner">',

View file

@ -126,11 +126,15 @@ define([
},
hideMenu: function () {
$('#' + _anchorId)
.css('left', -1000)
.css('top', -1000);
if ($('.document-menu').length > 0) {
$('#' + _anchorId)
.css('left', -1000)
.css('top', -1000);
uiApp.closeModal('.document-menu.modal-in');
uiApp.closeModal('.document-menu.modal-in');
} else if ($('.actions-modal').length > 0) {
uiApp.closeModal('.actions-modal.modal-in');
}
}
}
})());

View file

@ -149,23 +149,25 @@ define([
},
renderComment: function(comment) {
var $commentInfo = $('#comment-info');
var template = [
'<% if (android) { %><div class="header-comment"><div class="initials-comment" style="background-color: <%= comment.usercolor %>;"><%= comment.userInitials %></div><div><% } %>',
'<div class="user-name"><%= comment.username %></div>',
'<div class="comment-date"><%= comment.date %></div>',
'<% if (android) { %></div></div><% } %>',
'<div class="wrap-textarea"><textarea id="comment-text" class="comment-textarea" autofocus></textarea></div>'
].join('');
var insert = _.template(template)({
android: Framework7.prototype.device.android,
comment: comment
});
$commentInfo.html(insert);
_.defer(function () {
var $textarea = $('.comment-textarea')[0];
$textarea.focus();
});
_.delay(function () {
var $commentInfo = $('#comment-info');
var template = [
'<% if (android) { %><div class="header-comment"><div class="initials-comment" style="background-color: <%= comment.usercolor %>;"><%= comment.userInitials %></div><div><% } %>',
'<div class="user-name"><%= comment.username %></div>',
'<div class="comment-date"><%= comment.date %></div>',
'<% if (android) { %></div></div><% } %>',
'<div class="wrap-textarea"><textarea id="comment-text" class="comment-textarea" autofocus></textarea></div>'
].join('');
var insert = _.template(template)({
android: Framework7.prototype.device.android,
comment: comment
});
$commentInfo.html(insert);
_.defer(function () {
var $textarea = $('.comment-textarea')[0];
$textarea.focus();
});
}, 100);
},
renderNumFormat: function (dataFormat, selectFormat) {