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

View file

@ -126,11 +126,15 @@ define([
}, },
hideMenu: function () { hideMenu: function () {
$('#' + _anchorId) if ($('.document-menu').length > 0) {
.css('left', -1000) $('#' + _anchorId)
.css('top', -1000); .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) { renderComment: function(comment) {
var $commentInfo = $('#comment-info'); _.delay(function () {
var template = [ var $commentInfo = $('#comment-info');
'<% if (android) { %><div class="header-comment"><div class="initials-comment" style="background-color: <%= comment.usercolor %>;"><%= comment.userInitials %></div><div><% } %>', var template = [
'<div class="user-name"><%= comment.username %></div>', '<% if (android) { %><div class="header-comment"><div class="initials-comment" style="background-color: <%= comment.usercolor %>;"><%= comment.userInitials %></div><div><% } %>',
'<div class="comment-date"><%= comment.date %></div>', '<div class="user-name"><%= comment.username %></div>',
'<% if (android) { %></div></div><% } %>', '<div class="comment-date"><%= comment.date %></div>',
'<div class="wrap-textarea"><textarea id="comment-text" class="comment-textarea" autofocus></textarea></div>' '<% if (android) { %></div></div><% } %>',
].join(''); '<div class="wrap-textarea"><textarea id="comment-text" class="comment-textarea" autofocus></textarea></div>'
var insert = _.template(template)({ ].join('');
android: Framework7.prototype.device.android, var insert = _.template(template)({
comment: comment android: Framework7.prototype.device.android,
}); comment: comment
$commentInfo.html(insert); });
_.defer(function () { $commentInfo.html(insert);
var $textarea = $('.comment-textarea')[0]; _.defer(function () {
$textarea.focus(); var $textarea = $('.comment-textarea')[0];
}); $textarea.focus();
});
}, 100);
}, },
renderNumFormat: function (dataFormat, selectFormat) { renderNumFormat: function (dataFormat, selectFormat) {