-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EZP-28493: Interface improvements when assigning roles to user / groups #170
Conversation
@micszo we need very careful QA on this one, including DB entires. |
@webhdx could you attach screenshot? |
restInfo: {token, siteaccess} | ||
}), udwContainer); | ||
}; | ||
const toggleDisableState = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toggleDisabledState
restInfo: {token, siteaccess} | ||
}), udwContainer); | ||
}; | ||
const toggleDisableState = () => { | ||
limitationsRadio.forEach(radio => { | ||
const disableNode = doc.querySelector(radio.dataset.disableSelector); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have to query the whole document?
btns.forEach(btn => btn.addEventListener('click', openUDW, false)); | ||
})(); | ||
doc.querySelector('.ez-btn--select-subtree').addEventListener('click', selectSubtree, false); | ||
limitationsRadio.forEach(radio => radio.addEventListener('change', toggleDisableState, false)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure the use case here. If you're clicking on a specific radio button then I would expect to change the state of a clicked button. The toggleDisabledState
function tries to toggle the state of all radio buttons. It looks quite suboptimal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The event change is fired only on radio which gets the checked=true. I have to loop over every to set disable state on other buttons
{{ form_widget(form.locations.select_content, {'attr': {'class': 'btn btn-secondary btn--open-udw'}}) }} | ||
{% do form.locations.setRendered %} | ||
<div class="card-body ez-limitations"> | ||
<div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need the div
wrapper here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for the frontend part
Tool version : PHP CS Fixer 2.7.1 Sandy Pool by Fabien Potencier and Dariusz Ruminski diff --git a/src/lib/Form/Type/Role/RoleAssignmentCreateType.php b/src/lib/Form/Type/Role/RoleAssignmentCreateType.php
index 2fe85b7..44cf5b2 100644
--- a/src/lib/Form/Type/Role/RoleAssignmentCreateType.php
+++ b/src/lib/Form/Type/Role/RoleAssignmentCreateType.php
@@ -61,12 +61,9 @@ class RoleAssignmentCreateType extends AbstractType
'multiple' => false,
'expanded' => true,
'choices' => [
- RoleAssignmentCreateData::LIMITATION_TYPE_NONE
- => RoleAssignmentCreateData::LIMITATION_TYPE_NONE,
- RoleAssignmentCreateData::LIMITATION_TYPE_SECTION
- => RoleAssignmentCreateData::LIMITATION_TYPE_SECTION,
- RoleAssignmentCreateData::LIMITATION_TYPE_LOCATION
- => RoleAssignmentCreateData::LIMITATION_TYPE_LOCATION,
+ RoleAssignmentCreateData::LIMITATION_TYPE_NONE => RoleAssignmentCreateData::LIMITATION_TYPE_NONE,
+ RoleAssignmentCreateData::LIMITATION_TYPE_SECTION => RoleAssignmentCreateData::LIMITATION_TYPE_SECTION,
+ RoleAssignmentCreateData::LIMITATION_TYPE_LOCATION => RoleAssignmentCreateData::LIMITATION_TYPE_LOCATION,
],
'choice_name' => function ($value) {
return $value; |
1 similar comment
Tool version : PHP CS Fixer 2.7.1 Sandy Pool by Fabien Potencier and Dariusz Ruminski diff --git a/src/lib/Form/Type/Role/RoleAssignmentCreateType.php b/src/lib/Form/Type/Role/RoleAssignmentCreateType.php
index 2fe85b7..44cf5b2 100644
--- a/src/lib/Form/Type/Role/RoleAssignmentCreateType.php
+++ b/src/lib/Form/Type/Role/RoleAssignmentCreateType.php
@@ -61,12 +61,9 @@ class RoleAssignmentCreateType extends AbstractType
'multiple' => false,
'expanded' => true,
'choices' => [
- RoleAssignmentCreateData::LIMITATION_TYPE_NONE
- => RoleAssignmentCreateData::LIMITATION_TYPE_NONE,
- RoleAssignmentCreateData::LIMITATION_TYPE_SECTION
- => RoleAssignmentCreateData::LIMITATION_TYPE_SECTION,
- RoleAssignmentCreateData::LIMITATION_TYPE_LOCATION
- => RoleAssignmentCreateData::LIMITATION_TYPE_LOCATION,
+ RoleAssignmentCreateData::LIMITATION_TYPE_NONE => RoleAssignmentCreateData::LIMITATION_TYPE_NONE,
+ RoleAssignmentCreateData::LIMITATION_TYPE_SECTION => RoleAssignmentCreateData::LIMITATION_TYPE_SECTION,
+ RoleAssignmentCreateData::LIMITATION_TYPE_LOCATION => RoleAssignmentCreateData::LIMITATION_TYPE_LOCATION,
],
'choice_name' => function ($value) {
return $value; |
@webhdx it looks like you need to run cs-fixer here |
Tool version : PHP CS Fixer 2.7.1 Sandy Pool by Fabien Potencier and Dariusz Ruminski diff --git a/src/lib/Form/Type/Role/RoleAssignmentCreateType.php b/src/lib/Form/Type/Role/RoleAssignmentCreateType.php
index 2fe85b7..44cf5b2 100644
--- a/src/lib/Form/Type/Role/RoleAssignmentCreateType.php
+++ b/src/lib/Form/Type/Role/RoleAssignmentCreateType.php
@@ -61,12 +61,9 @@ class RoleAssignmentCreateType extends AbstractType
'multiple' => false,
'expanded' => true,
'choices' => [
- RoleAssignmentCreateData::LIMITATION_TYPE_NONE
- => RoleAssignmentCreateData::LIMITATION_TYPE_NONE,
- RoleAssignmentCreateData::LIMITATION_TYPE_SECTION
- => RoleAssignmentCreateData::LIMITATION_TYPE_SECTION,
- RoleAssignmentCreateData::LIMITATION_TYPE_LOCATION
- => RoleAssignmentCreateData::LIMITATION_TYPE_LOCATION,
+ RoleAssignmentCreateData::LIMITATION_TYPE_NONE => RoleAssignmentCreateData::LIMITATION_TYPE_NONE,
+ RoleAssignmentCreateData::LIMITATION_TYPE_SECTION => RoleAssignmentCreateData::LIMITATION_TYPE_SECTION,
+ RoleAssignmentCreateData::LIMITATION_TYPE_LOCATION => RoleAssignmentCreateData::LIMITATION_TYPE_LOCATION,
],
'choice_name' => function ($value) {
return $value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! UI looks good, database entries look the same as in v1.
I've added 3 tickets:
https://jira.ez.no/browse/EZP-28534 (behaviour already present in v1)
https://jira.ez.no/browse/EZP-28533 (possible improvement)
https://jira.ez.no/browse/EZP-28524 (not related only to this ticket)
Screenshot:
Checklist:
$ composer fix-cs
)