From 708721a5aa697bf4bee2c3c41c7c38b302f0cef0 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Thu, 18 May 2017 12:47:22 +1200 Subject: [PATCH] FIX Initial visibility of permission fields when editing a document --- javascript/DMSDocumentCMSFields.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/javascript/DMSDocumentCMSFields.js b/javascript/DMSDocumentCMSFields.js index 82b138b..cbf320f 100644 --- a/javascript/DMSDocumentCMSFields.js +++ b/javascript/DMSDocumentCMSFields.js @@ -34,20 +34,21 @@ } } });*/ - $('#CanViewType input, #CanEditType input').entwine({ + $('.permissions input[name="CanViewType"], .permissions input[name="CanEditType"]').entwine({ onchange: function () { - var dropDown = $(this).closest('.field').next(); - if ($(this).val() === 'OnlyTheseUsers') { + if (!this.is(':checked')) { + return; + } + + var dropDown = this.closest('.fieldholder-small').next(); + if (this.val() === 'OnlyTheseUsers') { dropDown.removeClass('hide'); } else { dropDown.addClass('hide'); } }, onadd: function () { - if ($(this).is(':checked') && $(this).val() === 'OnlyTheseUsers') { - var dropDown = $(this).closest('.field').next(); - dropDown.removeClass('hide'); - } + this.trigger('change'); } }); $('#Actions ul li').entwine({ @@ -100,7 +101,7 @@ //add some extra classes to the replace field containers to make it work with drag and drop uploading this.find('.replace').closest('div.fieldgroup-field').addClass('ss-upload').addClass('ss-uploadfield'); - + // add class and hide $('.DMSDocumentActionsPanel .embargo input.date').closest('.fieldholder-small').addClass('embargoDatetime').hide(); $('.DMSDocumentActionsPanel .expiry input.date').closest('.fieldholder-small').addClass('expiryDatetime').hide(); @@ -173,4 +174,4 @@ }); -}(jQuery)); \ No newline at end of file +}(jQuery));