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