Make can edit checkbox work for file shares
This commit is contained in:
parent
7533fcb977
commit
5cda383460
2 changed files with 22 additions and 12 deletions
|
@ -296,20 +296,27 @@
|
||||||
var $li = $element.closest('li[data-share-id]');
|
var $li = $element.closest('li[data-share-id]');
|
||||||
var shareId = $li.data('share-id');
|
var shareId = $li.data('share-id');
|
||||||
|
|
||||||
// adjust checkbox states
|
var permissions = OC.PERMISSION_READ;
|
||||||
var $checkboxes = $('.permissions', $li).not('input[name="edit"]').not('input[name="share"]');
|
|
||||||
var checked;
|
if (this.model.isFolder()) {
|
||||||
if ($element.attr('name') === 'edit') {
|
// adjust checkbox states
|
||||||
checked = $element.is(':checked');
|
var $checkboxes = $('.permissions', $li).not('input[name="edit"]').not('input[name="share"]');
|
||||||
// Check/uncheck Create, Update, and Delete checkboxes if Edit is checked/unck
|
var checked;
|
||||||
$($checkboxes).prop('checked', checked);
|
if ($element.attr('name') === 'edit') {
|
||||||
|
checked = $element.is(':checked');
|
||||||
|
// Check/uncheck Create, Update, and Delete checkboxes if Edit is checked/unck
|
||||||
|
$($checkboxes).prop('checked', checked);
|
||||||
|
} else {
|
||||||
|
var numberChecked = $checkboxes.filter(':checked').length;
|
||||||
|
checked = numberChecked > 0;
|
||||||
|
$('input[name="edit"]', $li).prop('checked', checked);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
var numberChecked = $checkboxes.filter(':checked').length;
|
if ($element.attr('name') === 'edit' && $element.is(':checked')) {
|
||||||
checked = numberChecked > 0;
|
permissions |= OC.PERMISSION_UPDATE;
|
||||||
$('input[name="edit"]', $li).prop('checked', checked);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var permissions = OC.PERMISSION_READ;
|
|
||||||
$('.permissions', $li).not('input[name="edit"]').filter(':checked').each(function(index, checkbox) {
|
$('.permissions', $li).not('input[name="edit"]').filter(':checked').each(function(index, checkbox) {
|
||||||
permissions |= $(checkbox).data('permissions');
|
permissions |= $(checkbox).data('permissions');
|
||||||
});
|
});
|
||||||
|
|
|
@ -102,6 +102,7 @@ describe('OC.Share.ShareDialogShareeListView', function () {
|
||||||
share_with: 'user1',
|
share_with: 'user1',
|
||||||
share_with_displayname: 'User One'
|
share_with_displayname: 'User One'
|
||||||
}]);
|
}]);
|
||||||
|
shareModel.set('itemType', 'folder');
|
||||||
listView.render();
|
listView.render();
|
||||||
listView.$el.find("input[name='edit']").click();
|
listView.$el.find("input[name='edit']").click();
|
||||||
expect(listView.$el.find("input[name='update']").is(':checked')).toEqual(true);
|
expect(listView.$el.find("input[name='update']").is(':checked')).toEqual(true);
|
||||||
|
@ -115,8 +116,10 @@ describe('OC.Share.ShareDialogShareeListView', function () {
|
||||||
permissions: 1,
|
permissions: 1,
|
||||||
share_type: OC.Share.SHARE_TYPE_USER,
|
share_type: OC.Share.SHARE_TYPE_USER,
|
||||||
share_with: 'user1',
|
share_with: 'user1',
|
||||||
share_with_displayname: 'User One'
|
share_with_displayname: 'User One',
|
||||||
|
itemType: 'folder'
|
||||||
}]);
|
}]);
|
||||||
|
shareModel.set('itemType', 'folder');
|
||||||
listView.render();
|
listView.render();
|
||||||
listView.$el.find("input[name='update']").click();
|
listView.$el.find("input[name='update']").click();
|
||||||
expect(listView.$el.find("input[name='edit']").is(':checked')).toEqual(true);
|
expect(listView.$el.find("input[name='edit']").is(':checked')).toEqual(true);
|
||||||
|
|
Loading…
Reference in a new issue