From 37007d900573df1e00f601d1ad09f4f20af31913 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Tue, 7 Apr 2020 13:36:38 +0300 Subject: [PATCH] [DE mobile] Comments (add sort comments in collaboration, fix animation when open add comment) --- apps/common/mobile/lib/view/Collaboration.js | 3 +- .../mobile/app/view/DocumentHolder.js | 12 ++++--- .../mobile/app/view/add/AddOther.js | 36 ++++++++++--------- 3 files changed, 29 insertions(+), 22 deletions(-) diff --git a/apps/common/mobile/lib/view/Collaboration.js b/apps/common/mobile/lib/view/Collaboration.js index e0c42b43b..98cf76b97 100644 --- a/apps/common/mobile/lib/view/Collaboration.js +++ b/apps/common/mobile/lib/view/Collaboration.js @@ -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 = [ '
  • ', '
    ', diff --git a/apps/documenteditor/mobile/app/view/DocumentHolder.js b/apps/documenteditor/mobile/app/view/DocumentHolder.js index c9637f358..a51381327 100644 --- a/apps/documenteditor/mobile/app/view/DocumentHolder.js +++ b/apps/documenteditor/mobile/app/view/DocumentHolder.js @@ -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'); + } } } })()); diff --git a/apps/documenteditor/mobile/app/view/add/AddOther.js b/apps/documenteditor/mobile/app/view/add/AddOther.js index 8e030be93..023bdbc99 100644 --- a/apps/documenteditor/mobile/app/view/add/AddOther.js +++ b/apps/documenteditor/mobile/app/view/add/AddOther.js @@ -149,23 +149,25 @@ define([ }, renderComment: function(comment) { - var $commentInfo = $('#comment-info'); - var template = [ - '<% if (android) { %>
    <%= comment.userInitials %>
    <% } %>', - '
    <%= comment.username %>
    ', - '
    <%= comment.date %>
    ', - '<% if (android) { %>
    <% } %>', - '
    ' - ].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) { %>
    <%= comment.userInitials %>
    <% } %>', + '
    <%= comment.username %>
    ', + '
    <%= comment.date %>
    ', + '<% if (android) { %>
    <% } %>', + '
    ' + ].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) {