-
-
Notifications
You must be signed in to change notification settings - Fork 484
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
Check for form attribute before rendering role matrix #1553
Conversation
1b39762
to
f9b4cdd
Compare
@@ -9,7 +9,7 @@ file that was distributed with this source code. | |||
|
|||
#} | |||
{% for role, attributes in roles|sort %} | |||
<li>{{ form_widget(attributes.form, {label: attributes.role_translated, value: attributes.role}) }}</li> | |||
<li>{{ attributes.form is defined ? form_widget(attributes.form, {label: attributes.role_translated, value: attributes.role}) }}</li> |
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.
Shouldnt the whole li be hidden if the form is not defined ?
(Also are you able to add a functionnal test for this bug ?)
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 updated the code to surround the <li>
element. I think it will take me some time to properly setup for creating tests. I don't know if you should wait on me for that though.
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 wont be able to patch this before sunday/monday anyway since I currently doesnt have a computer.
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.
No worries. I was able to add an initial functional test.
56dcd61
to
1217105
Compare
1217105
to
56f2345
Compare
@wluijt-endertech Can you take a look at the psalm and phpstan failures. |
56f2345
to
11c7cd3
Compare
I added the phpstan-ignore and psalm-suppress comments. |
@@ -9,7 +9,7 @@ file that was distributed with this source code. | |||
|
|||
#} | |||
{% for role, attributes in roles|sort %} | |||
<li>{{ form_widget(attributes.form, {label: attributes.role_translated, value: attributes.role}) }}</li> | |||
{% if attributes.form is defined %}<li>{{ form_widget(attributes.form, {label: attributes.role_translated, value: attributes.role}) }}</li>{% endif %} | |||
{% if not attributes.is_granted %} |
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 this if need to be updated too? what happens If I exclude a role for which I have is_granted = false. It will try to print a script that will fail because there is no form, right?
Maybe something like:
{% if attributes.form is defined %}
<li>{{ form_widget(attributes.form, {label: attributes.role_translated, value: attributes.role}) }}</li>
{% if not attributes.is_granted %}
<script>
$('input[value="{{ role }}"]').iCheck('disable');
$('form').on('submit', function() {
$('input[value="{{ role }}"]').iCheck('enable');
});
</script>
{% endif %}
{% endif %}
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 updated the template to surround the content with the form attribute check (with a minimal change, though).
11c7cd3
to
d1f1ddd
Compare
Thanks @wluijt-endertech |
Subject
I am targeting this branch, because it appears that a recent change in the same branch might need additional logic.
Closes #1552.
Changelog