summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMaximilian Wende <dasisdormax@secure.mailbox.org>2018-02-15 22:41:09 +0100
committerMaximilian Wende <dasisdormax@secure.mailbox.org>2018-02-15 22:41:09 +0100
commit602f50b2d4781cd9a874e7354b44315d6c0debb5 (patch)
treeb7803fb1dbf973dbbbd273c894bbfada5a9aec97 /core
parentd4238a52b29033716e5836b426f2c6b91d11e11c (diff)
downloadnextcloud-server-602f50b2d4781cd9a874e7354b44315d6c0debb5.tar.gz
nextcloud-server-602f50b2d4781cd9a874e7354b44315d6c0debb5.zip
Fix indeterminate checkbox state not showing correctly
Also, the checkbox is updated to the correct state while a permission change is in progress. should fix issue #8371 Signed-off-by: Maximilian Wende <dasisdormax@secure.mailbox.org>
Diffstat (limited to 'core')
-rw-r--r--core/js/sharedialogshareelistview.js19
1 files changed, 11 insertions, 8 deletions
diff --git a/core/js/sharedialogshareelistview.js b/core/js/sharedialogshareelistview.js
index c4b56627093..41eed751afb 100644
--- a/core/js/sharedialogshareelistview.js
+++ b/core/js/sharedialogshareelistview.js
@@ -30,7 +30,7 @@
'<span class="sharingOptionsGroup">' +
'{{#if editPermissionPossible}}' +
'<span class="shareOption">' +
- '<input id="canEdit-{{cid}}-{{shareWith}}" type="checkbox" name="edit" class="permissions checkbox" {{#if editPermissionState}}{{editPermissionState}}="{{editPermissionState}}"{{/if}} />' +
+ '<input id="canEdit-{{cid}}-{{shareWith}}" type="checkbox" name="edit" class="permissions checkbox" />' +
'<label for="canEdit-{{cid}}-{{shareWith}}">{{canEditLabel}}</label>' +
'</span>' +
'{{/if}}' +
@@ -379,17 +379,18 @@
$.extend(sharee, this.getShareProperties());
var $li = this.$('li[data-share-id=' + permissionChangeShareId + ']');
$li.find('.sharingOptionsGroup .popovermenu').replaceWith(this.popoverMenuTemplate(sharee));
+ }
- var checkBoxId = 'canEdit-' + this.cid + '-' + sharee.shareWith;
+ var _this = this;
+ this.getShareeList().forEach(function(sharee) {
+ var checkBoxId = 'canEdit-' + _this.cid + '-' + sharee.shareWith;
checkBoxId = '#' + checkBoxId.replace( /(:|\.|\[|\]|,|=|@)/g, "\\$1");
- var $edit = $li.parent().find(checkBoxId);
+ var $edit = _this.$(checkBoxId);
if($edit.length === 1) {
$edit.prop('checked', sharee.editPermissionState === 'checked');
$edit.prop('indeterminate', sharee.editPermissionState === 'indeterminate');
}
- }
-
- var _this = this;
+ });
this.$('.popovermenu').on('afterHide', function() {
_this._menuOpen = false;
});
@@ -628,8 +629,10 @@
}
} else {
var numberChecked = $checkboxes.filter(':checked').length;
- checked = numberChecked > 0;
- $('input[name="edit"]', $li).prop('checked', checked);
+ checked = numberChecked === $checkboxes.length;
+ var $editCb = $('input[name="edit"]', $li);
+ $editCb.prop('checked', checked);
+ $editCb.prop('indeterminate', !checked && numberChecked > 0);
}
} else {
if ($element.attr('name') === 'edit' && $element.is(':checked')) {