diff --git a/apps/common/mobile/lib/controller/Collaboration.js b/apps/common/mobile/lib/controller/Collaboration.js
index efd3be179..4c53dd461 100644
--- a/apps/common/mobile/lib/controller/Collaboration.js
+++ b/apps/common/mobile/lib/controller/Collaboration.js
@@ -223,7 +223,7 @@ define([
editUsers = users;
},
- initEditUsers: function() {
+ getUsersInfo: function() {
var usersArray = [];
_.each(editUsers, function(item){
var fio = item.asc_getUserName().split(' ');
@@ -248,6 +248,11 @@ define([
}
});
var userSort = _.chain(usersArray).groupBy('idOriginal').value();
+ return userSort;
+ },
+
+ initEditUsers: function() {
+ var users = this.getUsersInfo();
var templateUserItem = _.template([
'<% _.each(users, function (user) { %>',
'
' +
@@ -263,7 +268,7 @@ define([
this.textEditUser +
'' +
'' +
- templateUserItem({users: userSort}) +
+ templateUserItem({users: users}) +
'
');
$('#user-list').html(templateUserList());
},
@@ -680,6 +685,14 @@ define([
},
//Comments
+ getInitials: function(name) {
+ var fio = name.split(' ');
+ var initials = fio[0].substring(0, 1).toUpperCase();
+ if (fio.length > 1) {
+ initials += fio[fio.length - 1].substring(0, 1).toUpperCase();
+ }
+ return initials;
+ },
findComment: function(uid) {
var comment;
@@ -738,14 +751,14 @@ define([
'' +
- '' +
+ '
' +
@@ -781,25 +794,46 @@ define([
$swipeContainer.single('touchstart', _.bind(function(e){
var touchobj = e.changedTouches[0];
me.swipeStart = parseInt(touchobj.clientY);
+ me.swipeChange = parseInt(touchobj.clientY);
+ me.swipeHeight = parseInt($('.container-view-comment').css('height'));
+ e.preventDefault();
+ }, me));
+ $swipeContainer.single('touchmove', _.bind(function(e){
+ var touchobj = e.changedTouches[0];
+ var dist = parseInt(touchobj.clientY) - me.swipeStart;
+ var newHeight;
+ if (dist < 0) {
+ newHeight = '100%';
+ me.swipeFull = true;
+ me.closeCommentPicker = false;
+ $('.container-view-comment').css('opacity', '1');
+ } else if (dist < 100) {
+ newHeight = '50%';
+ me.swipeFull = false;
+ me.closeCommentPicker = false;
+ $('.container-view-comment').css('opacity', '1');
+ } else {
+ me.closeCommentPicker = true;
+ $('.container-view-comment').css('opacity', '0.6');
+ }
+ $('.container-view-comment').css('height', newHeight);
+ me.swipeHeight = newHeight;
e.preventDefault();
}, me));
$swipeContainer.single('touchend', _.bind(function (e) {
var touchobj = e.changedTouches[0];
var swipeEnd = parseInt(touchobj.clientY);
var dist = swipeEnd - me.swipeStart;
- if (dist > 20) {
- if (me.swipeFull) {
+ if (me.closeCommentPicker) {
+ uiApp.closeModal();
+ } else if (me.swipeFull) {
+ if (dist > 20) {
$('.container-view-comment').css('height', '50%');
- me.swipeFull = false;
- } else {
- uiApp.closeModal();
}
- } else if (dist < 0) {
- $('.container-view-comment').css('height', '100%');
- me.swipeFull = true;
- } else {
- $('.container-view-comment').css('height', '50%');
}
+ me.swipeHeight = undefined;
+ me.swipeChange = undefined;
+ me.closeCommentPicker = undefined;
}, me));
$('.prev-comment').single('click', _.bind(me.onViewPrevComment, me));
@@ -808,6 +842,21 @@ define([
$('.add-reply').single('click', _.bind(me.onClickAddReply, me));
$('.reply-menu').single('click', _.bind(me.initReplyMenu, me));
$('.comment-resolve').single('click', _.bind(me.onClickResolveComment, me));
+
+ me.updateDisabledCommentArrow();
+ },
+
+ updateDisabledCommentArrow: function() {
+ if (this.indexCurrentComment === 0) {
+ $('.prev-comment').addClass('disabled');
+ } else {
+ $('.prev-comment').removeClass('disabled');
+ }
+ if (this.indexCurrentComment + 1 === this.showComments.length) {
+ $('.next-comment').addClass('disabled');
+ } else {
+ $('.next-comment').removeClass('disabled');
+ }
},
onViewPrevComment: function() {
@@ -817,6 +866,7 @@ define([
$('.comment-menu').single('click', _.bind(this.initMenuComments, this));
$('.reply-menu').single('click', _.bind(this.initReplyMenu, this));
$('.comment-resolve').single('click', _.bind(this.onClickResolveComment, this));
+ this.updateDisabledCommentArrow();
}
},
@@ -827,11 +877,13 @@ define([
$('.comment-menu').single('click', _.bind(this.initMenuComments, this));
$('.reply-menu').single('click', _.bind(this.initReplyMenu, this));
$('.comment-resolve').single('click', _.bind(this.onClickResolveComment, this));
+ this.updateDisabledCommentArrow();
}
},
onClickAddReply: function() {
var me = this;
+ var isAndroid = Framework7.prototype.device.android === true;
if (this.indexCurrentComment > -1 && this.indexCurrentComment < this.showComments.length) {
var addReplyView,
comment = this.showComments[this.indexCurrentComment];
@@ -840,16 +892,24 @@ define([
''
);
$('.popup').css('z-index', '20000');
@@ -953,25 +1013,28 @@ define([
date: me.dateToLocaleTimeString(date),
userid: _userId,
username: me.currentUser.asc_getUserName(),
- usercolor: me.currentUser.asc_getColor()
+ usercolor: me.currentUser.asc_getColor(),
+ userInitials: me.getInitials(me.currentUser.asc_getUserName())
};
if (Common.SharedSettings.get('phone')) {
- modalView = $$(uiApp.pickerModal(
- '