Fix Bug 35626.
This commit is contained in:
parent
9412d9bf12
commit
1843040605
|
@ -60,6 +60,15 @@ define([
|
||||||
return count;
|
return count;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getEditingCount: function() {
|
||||||
|
var count = 0;
|
||||||
|
this.each(function(user){
|
||||||
|
user.get('online') && !user.get('view') && ++count;
|
||||||
|
});
|
||||||
|
|
||||||
|
return count;
|
||||||
|
},
|
||||||
|
|
||||||
findUser: function(id) {
|
findUser: function(id) {
|
||||||
return this.find(
|
return this.find(
|
||||||
function(model){
|
function(model){
|
||||||
|
|
|
@ -120,7 +120,7 @@ define([
|
||||||
$userList.scroller && $userList.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true});
|
$userList.scroller && $userList.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
applyUsers( collection.getOnlineCount() );
|
applyUsers( collection.getEditingCount() );
|
||||||
};
|
};
|
||||||
|
|
||||||
function onUsersChanged(model, collection) {
|
function onUsersChanged(model, collection) {
|
||||||
|
@ -129,13 +129,13 @@ define([
|
||||||
$userList.scroller && $userList.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true});
|
$userList.scroller && $userList.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
applyUsers(model.collection.getOnlineCount());
|
applyUsers(model.collection.getEditingCount());
|
||||||
};
|
};
|
||||||
|
|
||||||
function onResetUsers(collection, opts) {
|
function onResetUsers(collection, opts) {
|
||||||
var usercount = collection.getOnlineCount();
|
var usercount = collection.getEditingCount();
|
||||||
if ( $userList ) {
|
if ( $userList ) {
|
||||||
if ( usercount > 1 ) {
|
if ( usercount > 1 || usercount > 0 && !appConfig.isEdit) {
|
||||||
$userList.html(templateUserList({
|
$userList.html(templateUserList({
|
||||||
users: collection.models,
|
users: collection.models,
|
||||||
usertpl: _.template(templateUserItem),
|
usertpl: _.template(templateUserItem),
|
||||||
|
@ -157,7 +157,7 @@ define([
|
||||||
};
|
};
|
||||||
|
|
||||||
function applyUsers(count) {
|
function applyUsers(count) {
|
||||||
if ( count > 1 ) {
|
if ( count > 1 || count > 0 && !appConfig.isEdit) {
|
||||||
$btnUsers
|
$btnUsers
|
||||||
.attr('data-toggle', 'dropdown')
|
.attr('data-toggle', 'dropdown')
|
||||||
.addClass('dropdown-toggle')
|
.addClass('dropdown-toggle')
|
||||||
|
@ -174,13 +174,13 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
$btnUsers.find('.caption')
|
$btnUsers.find('.caption')
|
||||||
.css({'font-size': (count > 1 ? '12px' : '14px'),
|
.css({'font-size': ((count > 1 || count > 0 && !appConfig.isEdit) ? '12px' : '14px'),
|
||||||
'margin-top': (count > 1 ? '0' : '-1px')})
|
'margin-top': ((count > 1 || count > 0 && !appConfig.isEdit) ? '0' : '-1px')})
|
||||||
.html(count > 1 ? count : '+');
|
.html((count > 1 || count > 0 && !appConfig.isEdit) ? count : '+');
|
||||||
|
|
||||||
var usertip = $btnUsers.data('bs.tooltip');
|
var usertip = $btnUsers.data('bs.tooltip');
|
||||||
if ( usertip ) {
|
if ( usertip ) {
|
||||||
usertip.options.title = count > 1 ? usertip.options.titleExt : usertip.options.titleNorm;
|
usertip.options.title = (count > 1 || count > 0 && !appConfig.isEdit) ? usertip.options.titleExt : usertip.options.titleNorm;
|
||||||
usertip.setContent();
|
usertip.setContent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -227,8 +227,9 @@ define([
|
||||||
$panelUsers.find('.cousers-menu')
|
$panelUsers.find('.cousers-menu')
|
||||||
.on('click', function(e) { return false; });
|
.on('click', function(e) { return false; });
|
||||||
|
|
||||||
|
var editingUsers = storeUsers.getEditingCount();
|
||||||
$btnUsers.tooltip({
|
$btnUsers.tooltip({
|
||||||
title: 'Manage document access rights',
|
title: (editingUsers > 1 || editingUsers>0 && !appConfig.isEdit) ? me.tipViewUsers : me.tipAccessRights,
|
||||||
titleNorm: me.tipAccessRights,
|
titleNorm: me.tipAccessRights,
|
||||||
titleExt: me.tipViewUsers,
|
titleExt: me.tipViewUsers,
|
||||||
placement: 'bottom',
|
placement: 'bottom',
|
||||||
|
@ -241,7 +242,7 @@ define([
|
||||||
$labelChangeRights.on('click', onUsersClick.bind(me));
|
$labelChangeRights.on('click', onUsersClick.bind(me));
|
||||||
|
|
||||||
$labelChangeRights[(!mode.isOffline && !mode.isReviewOnly && mode.sharingSettingsUrl && mode.sharingSettingsUrl.length)?'show':'hide']();
|
$labelChangeRights[(!mode.isOffline && !mode.isReviewOnly && mode.sharingSettingsUrl && mode.sharingSettingsUrl.length)?'show':'hide']();
|
||||||
$panelUsers[(storeUsers.size() > 1 || !mode.isOffline && !mode.isReviewOnly && mode.sharingSettingsUrl && mode.sharingSettingsUrl.length) ? 'show' : 'hide']();
|
$panelUsers[(editingUsers > 1 || editingUsers > 0 && !appConfig.isEdit || !mode.isOffline && !mode.isReviewOnly && mode.sharingSettingsUrl && mode.sharingSettingsUrl.length) ? 'show' : 'hide']();
|
||||||
|
|
||||||
if ( $saveStatus ) {
|
if ( $saveStatus ) {
|
||||||
$saveStatus.attr('data-width', me.textSaveExpander);
|
$saveStatus.attr('data-width', me.textSaveExpander);
|
||||||
|
|
Loading…
Reference in a new issue