Skip to content

Instantly share code, notes, and snippets.

@riscos
Created December 5, 2013 07:47
Show Gist options
  • Save riscos/7801616 to your computer and use it in GitHub Desktop.
Save riscos/7801616 to your computer and use it in GitHub Desktop.
My partial for creatinga list of roles by account that a user has.
{namespace ro=Vendor\Package\ViewHelpers}
<section id="tab-user-2" class="tabPane">
<div class="fieldContainer">
<div class="accounts">
<f:for each="{user.accounts}" as="account">
<div class="account">
<p class="fieldRowLabel">{account.accountIdentifier}</p>
<div class="rolesContainer">
<table class="roles" cellspacing="0">
<tbody>
<f:for each="{roles}" as="role">
<tr>
<td class="labelCheckbox">
<span class="checkboxBox checkboxBox-icons">
<f:if condition="{ro:account.hasRole(account: account, role: role)}">
<f:then>
<f:form.checkbox property="account.roles" class="hiddenInput formField" checked="1" value="{role -> f:format.identifier()}" />
<span class="checkbox selected"><span>&nbsp;</span></span>
</f:then>
<f:else>
<f:form.checkbox property="accounts.roles" class="hiddenInput formField" value="{role -> f:format.identifier()}" />
<span class="checkbox"><span>&nbsp;</span></span>
</f:else>
</f:if>
</span><!-- /checkboxBox -->
</td>
<td class="label">{role.name}</td>
</tr>
</f:for>
</tbody>
</table>
</div>
</div>
</f:for>
</div>
</div><!-- /fieldContainer -->
</section><!-- /tab-user-2 -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment