Skip to content
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

Merged
merged 1 commit into from
Dec 14, 2017

Conversation

webhdx
Copy link
Contributor

@webhdx webhdx commented Dec 13, 2017

Question Answer
Tickets https://jira.ez.no/browse/EZP-28493
Bug fix? no
New feature? no
BC breaks? no
Tests pass? yes
Doc needed? no
License GPL-2.0

Screenshot:

roles

Checklist:

  • Coding standards ($ composer fix-cs)
  • Ready for Code Review

@lserwatka
Copy link
Member

@micszo we need very careful QA on this one, including DB entires.

@barbaragr barbaragr self-assigned this Dec 13, 2017
@lserwatka
Copy link
Member

@webhdx could you attach screenshot?

@barbaragr barbaragr removed their assignment Dec 13, 2017
@micszo micszo requested a review from mnocon December 13, 2017 13:57
@mnocon mnocon self-assigned this Dec 13, 2017
restInfo: {token, siteaccess}
}), udwContainer);
};
const toggleDisableState = () => {
Copy link
Contributor

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);
Copy link
Contributor

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));
Copy link
Contributor

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.

Copy link
Member

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>
Copy link
Contributor

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?

Copy link
Contributor

@sunpietro sunpietro left a 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

@ezrobot
Copy link

ezrobot commented Dec 13, 2017

Tool version : PHP CS Fixer 2.7.1 Sandy Pool by Fabien Potencier and Dariusz Ruminski
Command executed php-cs-fixer --dry-run -v fix
This Pull Request does not respect PSR-2 Coding Standards, please, see the suggested diff below:

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
@ezrobot
Copy link

ezrobot commented Dec 13, 2017

Tool version : PHP CS Fixer 2.7.1 Sandy Pool by Fabien Potencier and Dariusz Ruminski
Command executed php-cs-fixer --dry-run -v fix
This Pull Request does not respect PSR-2 Coding Standards, please, see the suggested diff below:

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;

@lserwatka
Copy link
Member

lserwatka commented Dec 14, 2017

@webhdx it looks like you need to run cs-fixer here

@ezrobot
Copy link

ezrobot commented Dec 14, 2017

Tool version : PHP CS Fixer 2.7.1 Sandy Pool by Fabien Potencier and Dariusz Ruminski
Command executed php-cs-fixer --dry-run -v fix
This Pull Request does not respect PSR-2 Coding Standards, please, see the suggested diff below:

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;

Copy link
Member

@mnocon mnocon left a 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)

@lserwatka lserwatka merged commit 275f083 into ezsystems:master Dec 14, 2017
@webhdx webhdx deleted the update-roles branch March 7, 2018 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

7 participants