-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #170 from dew326/update-roles
EZP-28493: Interface improvements when assigning roles to user / groups
- Loading branch information
Showing
14 changed files
with
320 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 28 additions & 15 deletions
43
src/bundle/Resources/public/js/scripts/admin.role_assignment.add.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,38 @@ | ||
(function () { | ||
const btns = document.querySelectorAll('.btn--open-udw'); | ||
const udwContainer = document.getElementById('react-udw'); | ||
const token = document.querySelector('meta[name="CSRF-Token"]').content; | ||
const siteaccess = document.querySelector('meta[name="SiteAccess"]').content; | ||
(function (global, doc) { | ||
const udwContainer = doc.getElementById('react-udw'); | ||
const limitationsRadio = [...doc.querySelectorAll('.ez-limitations__radio')]; | ||
const token = doc.querySelector('meta[name="CSRF-Token"]').content; | ||
const siteaccess = doc.querySelector('meta[name="SiteAccess"]').content; | ||
const closeUDW = () => udwContainer.innerHTML = ''; | ||
const onConfirm = (form, content) => { | ||
const field = form.querySelector('#role_assignment_locations_value'); | ||
field.value = content.map(item => item.ContentInfo.Content._id).join(); | ||
const selectSubtreeConfirm = (data) => { | ||
const selectedItems = data.reduce((total, item) => total + `<li>${item.ContentInfo.Content.Name}</li>`, ''); | ||
|
||
doc.querySelector('#role_assignment_create_locations').value = data.map(item => item.id).join(); | ||
doc.querySelector('.ez-limitations__selected-subtree').innerHTML = selectedItems; | ||
|
||
closeUDW(); | ||
}; | ||
const onCancel = () => closeUDW(); | ||
const openUDW = (event) => { | ||
const selectSubtree = (event) => { | ||
event.preventDefault(); | ||
|
||
const form = event.target.closest('form[name=role_assignment]'); | ||
ReactDOM.render(React.createElement(eZ.modules.UniversalDiscovery, { | ||
onConfirm: onConfirm.bind(this, form), | ||
onCancel: onCancel, | ||
onConfirm: selectSubtreeConfirm.bind(this), | ||
onCancel: closeUDW, | ||
multiple: true, | ||
restInfo: {token, siteaccess} | ||
}), udwContainer); | ||
}; | ||
const toggleDisabledState = () => { | ||
limitationsRadio.forEach(radio => { | ||
const disableNode = doc.querySelector(radio.dataset.disableSelector); | ||
const methodName = radio.checked ? 'removeAttribute' : 'setAttribute'; | ||
|
||
if (disableNode) { | ||
disableNode[methodName]('disabled', 'disabled'); | ||
} | ||
}); | ||
}; | ||
|
||
btns.forEach(btn => btn.addEventListener('click', openUDW, false)); | ||
})(); | ||
doc.querySelector('.ez-btn--select-subtree').addEventListener('click', selectSubtree, false); | ||
limitationsRadio.forEach(radio => radio.addEventListener('change', toggleDisabledState, false)); | ||
})(window, document); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2"> | ||
<file source-language="en" target-language="en" datatype="plaintext" original="not.available"> | ||
<header> | ||
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/> | ||
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note> | ||
</header> | ||
<body> | ||
<trans-unit id="f52d0870dd7bdbff2c2728c2b6ec708aa5cb240b" resname="validator.define_subtree_or_section_limitation"> | ||
<source>Define a Subtree or Section limitation</source> | ||
<target state="new">Define a Subtree or Section limitation</target> | ||
<note>key: validator.define_subtree_or_section_limitation</note> | ||
</trans-unit> | ||
</body> | ||
</file> | ||
</xliff> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.