Broke out the table column templates into individual template files
This commit is contained in:
@@ -14,4 +14,5 @@ Fixes/tweaks a few "issues" with the default UserFrosting installation, includin
|
||||
- Added 'hasRole' twig function to check if a user has a role (if a role doesn't exist, always returns false)
|
||||
- Added 'Auditer' role and split the activities permission away from site-admins (exclusive only) and everyone else
|
||||
- Made the input elements on the account settings page more in line with the other inputs (including the "hidden" and "disabled" mechanisms)
|
||||
- Updated all* forms to use partial form elements.
|
||||
- Updated all* forms to use partial form elements
|
||||
- Broke the table column templates into seperate files and re-factored the table templates
|
||||
44
templates/tables/activities.html.twig
Normal file
44
templates/tables/activities.html.twig
Normal file
@@ -0,0 +1,44 @@
|
||||
{# This partial template renders a table of user activities, to be populated with rows via an AJAX request.
|
||||
# This extends a generic template for paginated tables.
|
||||
#
|
||||
# Note that this template contains a "skeleton" table with an empty table body, and then a block of Handlebars templates which are used
|
||||
# to render the table cells with the data from the AJAX request.
|
||||
#}
|
||||
|
||||
{% extends "tables/table-paginated.html.twig" %}
|
||||
|
||||
{% block table %}
|
||||
<table id="{{table.id}}" class="tablesorter table table-bordered table-hover table-striped" data-sortlist="[[0, 1]]">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="sorter-metanum" data-column-name="occurred_at" data-column-template="#{{table.id}}-column-occurred-at" data-priority="1">{{translate('ACTIVITY.TIME')}} <i class="fas fa-sort"></i></th>
|
||||
{% if 'user' in table.columns %}
|
||||
<th class="sorter-metatext" data-column-name="user" data-column-template="#{{table.id}}-column-user" data-priority="1">{{translate('USER')}} <i class="fas fa-sort"></i></th>
|
||||
{% endif %}
|
||||
<th class="sorter-metatext" data-column-name="description" data-column-template="#{{table.id}}-column-description" data-priority="1">{{translate("DESCRIPTION")}} <i class="fas fa-sort"></i></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
||||
|
||||
{% block table_cell_templates %}
|
||||
{# This contains a series of <script> blocks, each of which is a client-side Handlebars template.
|
||||
# Note that these are NOT Twig templates, although the syntax is similar. We wrap them in the `verbatim` tag,
|
||||
# so that Twig will output them directly into the DOM instead of trying to treat them like Twig templates.
|
||||
#
|
||||
# These templates require handlebars-helpers.js, moment.js
|
||||
#}
|
||||
{% block table_activities_column_occurred_at %}
|
||||
{% include "tables/columns/activities-occurred_at.html.twig" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block table_activities_column_user %}
|
||||
{% include "tables/columns/activities-user.html.twig" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block table_activities_column_description %}
|
||||
{% include "tables/columns/activities-description.html.twig" %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
7
templates/tables/columns/abstract/description.html.twig
Normal file
7
templates/tables/columns/abstract/description.html.twig
Normal file
@@ -0,0 +1,7 @@
|
||||
<script id="{{table.id}}-column-description" type="text/x-handlebars-template">
|
||||
{% verbatim %}
|
||||
<td>
|
||||
{{row.description}}
|
||||
</td>
|
||||
{% endverbatim %}
|
||||
</script>
|
||||
12
templates/tables/columns/activities-description.html.twig
Normal file
12
templates/tables/columns/activities-description.html.twig
Normal file
@@ -0,0 +1,12 @@
|
||||
<script id="{{table.id}}-column-description" type="text/x-handlebars-template">
|
||||
{% verbatim %}
|
||||
<td>
|
||||
<div>
|
||||
{{row.ip_address}}
|
||||
</div>
|
||||
<div>
|
||||
<i>{{row.description}}</i>
|
||||
</div>
|
||||
</td>
|
||||
{% endverbatim %}
|
||||
</script>
|
||||
14
templates/tables/columns/activities-ocurred_at.html
Normal file
14
templates/tables/columns/activities-ocurred_at.html
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
<script id="{{table.id}}-column-occurred-at" type="text/x-handlebars-template">
|
||||
{% verbatim %}
|
||||
{{#if row.occurred_at }}
|
||||
<td data-num="{{dateFormat row.occurred_at format='x'}}">
|
||||
{{dateFormat row.occurred_at format="dddd"}}<br>{{dateFormat row.occurred_at format="MMM Do, YYYY h:mm a"}}
|
||||
</td>
|
||||
{{ else }}
|
||||
<td data-num="0">
|
||||
<i>{% endverbatim %}{{translate("UNKNOWN")}}{% verbatim %}</i>
|
||||
</td>
|
||||
{{/if }}
|
||||
{% endverbatim %}
|
||||
</script>
|
||||
17
templates/tables/columns/activities-user.html.twig
Normal file
17
templates/tables/columns/activities-user.html.twig
Normal file
@@ -0,0 +1,17 @@
|
||||
<script id="{{table.id}}-column-user" type="text/x-handlebars-template">
|
||||
{% verbatim %}
|
||||
<td data-text="{{row.user.last_name}}">
|
||||
{{#if row.user }}
|
||||
<strong>
|
||||
<a href="{{site.uri.public}}/users/u/{{row.user.user_name}}">{{row.user.first_name}} {{row.user.last_name}} ({{row.user.user_name}})</a>
|
||||
</strong>
|
||||
<div class="js-copy-container">
|
||||
<span class="js-copy-target">{{row.user.email}}</span>
|
||||
<button class="btn btn-xs uf-copy-trigger js-copy-trigger"><i class="fas fa-copy"></i></button>
|
||||
</div>
|
||||
{{ else }}
|
||||
<i>{% endverbatim %}{{translate("USER.DELETED")}}{% verbatim %}</i>
|
||||
{{/if }}
|
||||
</td>
|
||||
{% endverbatim %}
|
||||
</script>
|
||||
24
templates/tables/columns/groups-actions.html.twig
Normal file
24
templates/tables/columns/groups-actions.html.twig
Normal file
@@ -0,0 +1,24 @@
|
||||
<script id="{{table.id}}-column-actions" type="text/x-handlebars-template">
|
||||
{% verbatim %}
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
|
||||
{% endverbatim %}{{translate("ACTIONS")}}{% verbatim %}
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-right" role="menu">
|
||||
<li>
|
||||
<a href="#" data-slug="{{row.slug}}" class="js-group-edit">
|
||||
<i class="fas fa-edit"></i> {% endverbatim %}{{translate("GROUP.EDIT")}}{% verbatim %}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" data-slug="{{row.slug}}" class="js-group-delete">
|
||||
<i class="fas fa-trash-alt"></i> {% endverbatim %}{{translate("GROUP.DELETE")}}{% verbatim %}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
{% endverbatim %}
|
||||
</script>
|
||||
1
templates/tables/columns/groups-description.html.twig
Normal file
1
templates/tables/columns/groups-description.html.twig
Normal file
@@ -0,0 +1 @@
|
||||
{% include "tables/columns/abstract-description.html.twig" %}
|
||||
9
templates/tables/columns/groups-info.html.twig
Normal file
9
templates/tables/columns/groups-info.html.twig
Normal file
@@ -0,0 +1,9 @@
|
||||
<script id="{{table.id}}-column-info" type="text/x-handlebars-template">
|
||||
{% verbatim %}
|
||||
<td data-text="{{row.name}}">
|
||||
<strong>
|
||||
<i class="{{row.icon}} fa-fw"></i> <a href="{{site.uri.public}}/groups/g/{{row.slug}}">{{row.name}}</a>
|
||||
</strong>
|
||||
</td>
|
||||
{% endverbatim %}
|
||||
</script>
|
||||
11
templates/tables/columns/permissions-name.html.twig
Normal file
11
templates/tables/columns/permissions-name.html.twig
Normal file
@@ -0,0 +1,11 @@
|
||||
<script id="{{table.id}}-column-name" type="text/x-handlebars-template">
|
||||
{% verbatim %}
|
||||
<td data-text="{{row.name}}">
|
||||
<div>
|
||||
<strong>
|
||||
<a href="{{site.uri.public}}/permissions/p/{{row.id}}">{{row.name}}</a>
|
||||
</strong>
|
||||
</div>
|
||||
</td>
|
||||
{% endverbatim %}
|
||||
</script>
|
||||
15
templates/tables/columns/permissions-properties.html.twig
Normal file
15
templates/tables/columns/permissions-properties.html.twig
Normal file
@@ -0,0 +1,15 @@
|
||||
<script id="{{table.id}}-column-properties" type="text/x-handlebars-template">
|
||||
{% verbatim %}
|
||||
<td>
|
||||
<div>
|
||||
<code>{{row.slug}}</code>
|
||||
</div>
|
||||
<div>
|
||||
↳ <code>{{row.conditions}}</code>
|
||||
</div>
|
||||
<div>
|
||||
<i>{{row.description}}</i>
|
||||
</div>
|
||||
</td>
|
||||
{% endverbatim %}
|
||||
</script>
|
||||
9
templates/tables/columns/permissions-via_roles.html.twig
Normal file
9
templates/tables/columns/permissions-via_roles.html.twig
Normal file
@@ -0,0 +1,9 @@
|
||||
<script id="{{table.id}}-column-via-roles" type="text/x-handlebars-template">
|
||||
{% verbatim %}
|
||||
<td>
|
||||
{{#each row.roles_via }}
|
||||
<a href="{% endverbatim %}{# Handlebars can't access variables in the global scope, so we have to use Twig to insert the base url #}{{site.uri.public}}{% verbatim %}/roles/r/{{this.slug}}" class="label label-primary" title="{{this.description}}">{{this.name}}</a>
|
||||
{{/each}}
|
||||
</td>
|
||||
{% endverbatim %}
|
||||
</script>
|
||||
35
templates/tables/columns/roles-actions.html.twig
Normal file
35
templates/tables/columns/roles-actions.html.twig
Normal file
@@ -0,0 +1,35 @@
|
||||
<script id="{{table.id}}-column-actions" type="text/x-handlebars-template">
|
||||
{% verbatim %}
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
|
||||
{% endverbatim %}{{translate("ACTIONS")}}{% verbatim %}
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-right" role="menu">
|
||||
{% endverbatim %}{% if (checkAccess('update_role_permissions')) %}{% verbatim %}
|
||||
<li>
|
||||
<a href="#" data-slug="{{row.slug}}" class="js-role-permissions">
|
||||
<i class="fas fa-key"></i> {% endverbatim %}{{translate("PERMISSION.MANAGE")}}{% verbatim %}
|
||||
</a>
|
||||
</li>
|
||||
{% endverbatim %}{% endif %}{% verbatim %}
|
||||
|
||||
<li>
|
||||
<a href="#" data-slug="{{row.slug}}" class="js-role-edit">
|
||||
<i class="fas fa-edit"></i> {% endverbatim %}{{translate("ROLE.EDIT")}}{% verbatim %}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
{% endverbatim %}{% if (checkAccess('delete_role')) %}{% verbatim %}
|
||||
<li>
|
||||
<a href="#" data-slug="{{row.slug}}" class="js-role-delete">
|
||||
<i class="fas fa-trash-alt"></i> {% endverbatim %}{{translate("ROLE.DELETE")}}{% verbatim %}
|
||||
</a>
|
||||
</li>
|
||||
{% endverbatim %}{% endif %}{% verbatim %}
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
{% endverbatim %}
|
||||
</script>
|
||||
1
templates/tables/columns/roles-description.html.twig
Normal file
1
templates/tables/columns/roles-description.html.twig
Normal file
@@ -0,0 +1 @@
|
||||
{% include "tables/columns/abstract-description.html.twig" %}
|
||||
9
templates/tables/columns/roles-info.html.twig
Normal file
9
templates/tables/columns/roles-info.html.twig
Normal file
@@ -0,0 +1,9 @@
|
||||
<script id="{{table.id}}-column-info" type="text/x-handlebars-template">
|
||||
{% verbatim %}
|
||||
<td data-text="{{row.name}}">
|
||||
<strong>
|
||||
<a href="{{site.uri.public}}/roles/r/{{row.slug}}">{{row.name}}</a>
|
||||
</strong>
|
||||
</td>
|
||||
{% endverbatim %}
|
||||
</script>
|
||||
56
templates/tables/columns/users-actions.html.twig
Normal file
56
templates/tables/columns/users-actions.html.twig
Normal file
@@ -0,0 +1,56 @@
|
||||
<script id="{{table.id}}-column-actions" type="text/x-handlebars-template">
|
||||
{% verbatim %}
|
||||
<td class="uf-table-fit-width">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">{% endverbatim %}{{translate("ACTIONS")}}{% verbatim %}<span class="caret"></span></button>
|
||||
<ul class="dropdown-menu dropdown-menu-right-responsive" role="menu">
|
||||
{{#ifx row.flag_verified '==' 0 }}
|
||||
<li>
|
||||
<a href="#" data-user_name="{{row.user_name}}" class="js-user-activate">
|
||||
<i class="fas fa-bolt"></i> {% endverbatim %}{{translate("USER.ACTIVATE")}}{% verbatim %}
|
||||
</a>
|
||||
</li>
|
||||
{{/ifx }}
|
||||
|
||||
<li>
|
||||
<a href="#" data-user_name="{{row.user_name}}" class="js-user-edit">
|
||||
<i class="fas fa-edit"></i> {% endverbatim %}{{translate("USER.EDIT")}}{% verbatim %}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
{% endverbatim %}{% if checkAccess('uri_roles') %}{% verbatim %}
|
||||
<li>
|
||||
<a href="#" data-user_name="{{row.user_name}}" class="js-user-roles">
|
||||
<i class="fas fa-id-card"></i> {% endverbatim %}{{translate("ROLE.MANAGE")}}{% verbatim %}
|
||||
</a>
|
||||
</li>
|
||||
{% endverbatim %}{% endif %}{% verbatim %}
|
||||
|
||||
<li>
|
||||
<a href="#" data-user_name="{{row.user_name}}" class="js-user-password">
|
||||
<i class="fas fa-key"></i> {% endverbatim %}{{translate("USER.ADMIN.CHANGE_PASSWORD")}}{% verbatim %}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
{{#ifx row.flag_enabled '==' 1 }}
|
||||
<a href="#" data-user_name="{{row.user_name}}" class="js-user-disable">
|
||||
<i class="fas fa-minus-circle"></i> {% endverbatim %}{{translate("USER.DISABLE")}}{% verbatim %}
|
||||
</a>
|
||||
{{ else }}
|
||||
<a href="#" data-user_name="{{row.user_name}}" class="js-user-enable">
|
||||
<i class="fas fa-plus-circle"></i> {% endverbatim %}{{translate("USER.ENABLE")}}{% verbatim %}
|
||||
</a>
|
||||
{{/ifx }}
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#" data-user_name="{{row.user_name}}" class="js-user-delete">
|
||||
<i class="fas fa-trash-alt"></i> {% endverbatim %}{{translate("USER.DELETE")}}{% verbatim %}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
{% endverbatim %}
|
||||
</script>
|
||||
13
templates/tables/columns/users-info.html.twig
Normal file
13
templates/tables/columns/users-info.html.twig
Normal file
@@ -0,0 +1,13 @@
|
||||
<script id="{{table.id}}-column-info" type="text/x-handlebars-template">
|
||||
{% verbatim %}
|
||||
<td data-text="{{row.last_name}}">
|
||||
<strong>
|
||||
<a href="{{site.uri.public}}/users/u/{{row.user_name}}">{{row.first_name}} {{row.last_name}} ({{row.user_name}})</a>
|
||||
</strong>
|
||||
<div class="js-copy-container">
|
||||
<span class="js-copy-target">{{row.email}}</span>
|
||||
<button class="btn btn-xs uf-copy-trigger js-copy-trigger"><i class="fas fa-copy"></i></button>
|
||||
</div>
|
||||
</td>
|
||||
{% endverbatim %}
|
||||
</script>
|
||||
16
templates/tables/columns/users-last_activity.html.twig
Normal file
16
templates/tables/columns/users-last_activity.html.twig
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
<script id="{{table.id}}-column-last-activity" type="text/x-handlebars-template">
|
||||
{% verbatim %}
|
||||
{{#if row.last_activity }}
|
||||
<td data-num="{{dateFormat row.last_activity.occurred_at format='x'}}">
|
||||
{{dateFormat row.last_activity.occurred_at format="dddd"}}<br>{{dateFormat row.last_activity.occurred_at format="MMM Do, YYYY h:mm a"}}
|
||||
<br>
|
||||
<i>{{row.last_activity.description}}</i>
|
||||
</td>
|
||||
{{ else }}
|
||||
<td data-num="0">
|
||||
<i>{% endverbatim %}{{translate("UNKNOWN")}}{% verbatim %}</i>
|
||||
</td>
|
||||
{{/if }}
|
||||
{% endverbatim %}
|
||||
</script>
|
||||
31
templates/tables/columns/users-status.html.twig
Normal file
31
templates/tables/columns/users-status.html.twig
Normal file
@@ -0,0 +1,31 @@
|
||||
<script id="{{table.id}}-column-status" type="text/x-handlebars-template">
|
||||
{% verbatim %}
|
||||
<td
|
||||
{{#ifx row.flag_enabled '==' 0 }}
|
||||
data-text="disabled"
|
||||
{{ else }}
|
||||
{{#ifx row.flag_verified '==' 0 }}
|
||||
data-text="unactivated"
|
||||
{{ else }}
|
||||
data-text="active"
|
||||
{{/ifx }}
|
||||
{{/ifx }}
|
||||
>
|
||||
{{#ifx row.flag_enabled '==' 0 }}
|
||||
<span class="text-muted">
|
||||
{% endverbatim %}{{translate("DISABLED")}}{% verbatim %}
|
||||
</span>
|
||||
{{ else }}
|
||||
{{#ifx row.flag_verified '==' 0 }}
|
||||
<span class="text-yellow">
|
||||
{% endverbatim %}{{translate("UNACTIVATED")}}{% verbatim %}
|
||||
</span>
|
||||
{{ else }}
|
||||
<span>
|
||||
{% endverbatim %}{{translate("ACTIVE")}}{% verbatim %}
|
||||
</span>
|
||||
{{/ifx }}
|
||||
{{/ifx }}
|
||||
</td>
|
||||
{% endverbatim %}
|
||||
</script>
|
||||
9
templates/tables/columns/users-via_roles.html.twig
Normal file
9
templates/tables/columns/users-via_roles.html.twig
Normal file
@@ -0,0 +1,9 @@
|
||||
<script id="{{table.id}}-column-via-roles" type="text/x-handlebars-template">
|
||||
{% verbatim %}
|
||||
<td>
|
||||
{{#each row.roles_via }}
|
||||
<a href="{% endverbatim %}{# Handlebars can't access variables in the global scope, so we have to use Twig to insert the base url #}{{site.uri.public}}{% verbatim %}/roles/r/{{this.slug}}" class="label label-primary" title="{{this.description}}">{{this.name}}</a>
|
||||
{{/each}}
|
||||
</td>
|
||||
{% endverbatim %}
|
||||
</script>
|
||||
42
templates/tables/groups.html.twig
Normal file
42
templates/tables/groups.html.twig
Normal file
@@ -0,0 +1,42 @@
|
||||
{# This partial template renders a table of groups, to be populated with rows via an AJAX request.
|
||||
# This extends a generic template for paginated tables.
|
||||
#
|
||||
# Note that this template contains a "skeleton" table with an empty table body, and then a block of Handlebars templates which are used
|
||||
# to render the table cells with the data from the AJAX request.
|
||||
#}
|
||||
|
||||
{% extends "tables/table-paginated.html.twig" %}
|
||||
|
||||
{% block table %}
|
||||
<table id="{{table.id}}" class="tablesorter table table-bordered table-hover table-striped" data-sortlist="{{table.sortlist}}">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="sorter-metatext" data-column-name="name" data-column-template="#{{table.id}}-column-info" data-priority="1">{{translate('GROUP')}} <i class="fas fa-sort"></i></th>
|
||||
<th class="sorter-metatext" data-column-name="description" data-column-template="#{{table.id}}-column-description" data-priority="2">{{translate("DESCRIPTION")}} <i class="fas fa-sort"></i></th>
|
||||
<th data-column-template="#{{table.id}}-column-actions" data-sorter="false" data-filter="false" data-priority="1">{{translate("ACTIONS")}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
||||
|
||||
{% block table_cell_templates %}
|
||||
{# This contains a series of <script> blocks, each of which is a client-side Handlebars template.
|
||||
# Note that these are NOT Twig templates, although the syntax is similar. We wrap them in the `verbatim` tag,
|
||||
# so that Twig will output them directly into the DOM instead of trying to treat them like Twig templates.
|
||||
#
|
||||
# These templates require handlebars-helpers.js, moment.js
|
||||
#}
|
||||
{% block table_groups_column_info %}
|
||||
{% include "tables/columns/groups-info.html.twig" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block table_groups_column_description %}
|
||||
{% include "tables/columns/groups-description.html.twig" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block table_groups_column_actions %}
|
||||
{% include "tables/columns/groups-actions.html.twig" %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
44
templates/tables/permissions.html.twig
Normal file
44
templates/tables/permissions.html.twig
Normal file
@@ -0,0 +1,44 @@
|
||||
{# This partial template renders a table of permissions, to be populated with rows via an AJAX request.
|
||||
# This extends a generic template for paginated tables.
|
||||
#
|
||||
# Note that this template contains a "skeleton" table with an empty table body, and then a block of Handlebars templates which are used
|
||||
# to render the table cells with the data from the AJAX request.
|
||||
#}
|
||||
|
||||
{% extends "tables/table-paginated.html.twig" %}
|
||||
|
||||
{% block table %}
|
||||
<table id="{{table.id}}" class="tablesorter table table-bordered table-hover table-striped" data-sortlist="{{table.sortlist}}">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="sorter-metatext" data-column-name="name" data-column-template="#{{table.id}}-column-name" data-priority="1">{{translate('PERMISSION')}} <i class="fas fa-sort"></i></th>
|
||||
<th class="sorter-metatext" data-column-name="properties" data-column-template="#{{table.id}}-column-properties" data-priority="1">{{translate('SLUG_CONDITION')}} <i class="fas fa-sort"></i></th>
|
||||
{% if 'via_roles' in table.columns %}
|
||||
<th data-column-template="#{{table.id}}-column-via-roles" data-sorter="false" data-filter="false" data-priority="2">{{translate('PERMISSION.VIA_ROLES')}}</th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
||||
|
||||
{% block table_cell_templates %}
|
||||
{# This contains a series of <script> blocks, each of which is a client-side Handlebars template.
|
||||
# Note that these are NOT Twig templates, although the syntax is similar. We wrap them in the `verbatim` tag,
|
||||
# so that Twig will output them directly into the DOM instead of trying to treat them like Twig templates.
|
||||
#
|
||||
# These templates require handlebars-helpers.js, moment.js
|
||||
#}
|
||||
{% block table_permissions_column_name %}
|
||||
{% include "tables/columns/permissions-name.html.twig" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block table_permissions_column_properties %}
|
||||
{% include "tables/columns/permissions-properties.html.twig" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block table_permissions_column_via_roles %}
|
||||
{% include "tables/columns/permissions-via_roles.html.twig" %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
@@ -11,9 +11,9 @@
|
||||
<table id="{{table.id}}" class="tablesorter table table-bordered table-hover table-striped" data-sortlist="{{table.sortlist}}">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="sorter-metatext" data-column-name="name" data-column-template="#role-table-column-info" data-priority="1">{{translate('ROLE')}} <i class="fas fa-sort"></i></th>
|
||||
<th class="sorter-metatext" data-column-name="description" data-column-template="#role-table-column-description" data-priority="2">{{translate('DESCRIPTION')}} <i class="fas fa-sort"></i></th>
|
||||
<th data-column-template="#role-table-column-actions" data-sorter="false" data-filter="false" data-priority="1">{{translate('ACTIONS')}}</th>
|
||||
<th class="sorter-metatext" data-column-name="name" data-column-template="#{{table.id}}-column-info" data-priority="1">{{translate('ROLE')}} <i class="fas fa-sort"></i></th>
|
||||
<th class="sorter-metatext" data-column-name="description" data-column-template="#{{table.id}}-column-description" data-priority="2">{{translate('DESCRIPTION')}} <i class="fas fa-sort"></i></th>
|
||||
<th data-column-template="#{{table.id}}-column-actions" data-sorter="false" data-filter="false" data-priority="1">{{translate('ACTIONS')}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -28,53 +28,15 @@
|
||||
#
|
||||
# These templates require handlebars-helpers.js, moment.js
|
||||
#}
|
||||
{% verbatim %}
|
||||
<script id="role-table-column-info" type="text/x-handlebars-template">
|
||||
<td data-text="{{row.name}}">
|
||||
<strong>
|
||||
<a href="{{site.uri.public}}/roles/r/{{row.slug}}">{{row.name}}</a>
|
||||
</strong>
|
||||
</td>
|
||||
</script>
|
||||
|
||||
<script id="role-table-column-description" type="text/x-handlebars-template">
|
||||
<td>
|
||||
{{row.description}}
|
||||
</td>
|
||||
</script>
|
||||
|
||||
<script id="role-table-column-actions" type="text/x-handlebars-template">
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
|
||||
{% endverbatim %}{{translate("ACTIONS")}}{% verbatim %}
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-right" role="menu">
|
||||
{% endverbatim %}{% if (checkAccess('update_role_permissions')) %}{% verbatim %}
|
||||
<li>
|
||||
<a href="#" data-slug="{{row.slug}}" class="js-role-permissions">
|
||||
<i class="fas fa-key"></i> {% endverbatim %}{{translate("PERMISSION.MANAGE")}}{% verbatim %}
|
||||
</a>
|
||||
</li>
|
||||
{% endverbatim %}{% endif %}{% verbatim %}
|
||||
|
||||
<li>
|
||||
<a href="#" data-slug="{{row.slug}}" class="js-role-edit">
|
||||
<i class="fas fa-edit"></i> {% endverbatim %}{{translate("ROLE.EDIT")}}{% verbatim %}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
{% endverbatim %}{% if (checkAccess('delete_role')) %}{% verbatim %}
|
||||
<li>
|
||||
<a href="#" data-slug="{{row.slug}}" class="js-role-delete">
|
||||
<i class="fas fa-trash-alt"></i> {% endverbatim %}{{translate("ROLE.DELETE")}}{% verbatim %}
|
||||
</a>
|
||||
</li>
|
||||
{% endverbatim %}{% endif %}{% verbatim %}
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</script>
|
||||
{% endverbatim %}
|
||||
{% block table_roles_column_info %}
|
||||
{% include "tables/columns/roles-info.html.twig" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block table_roles_column_description %}
|
||||
{% include "tables/columns/roles-description.html.twig" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block table_roles_column_actions %}
|
||||
{% include "tables/columns/roles-actions.html.twig" %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -11,15 +11,15 @@
|
||||
<table id="{{table.id}}" class="tablesorter table table-bordered table-hover table-striped" data-sortlist="{{table.sortlist}}">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="sorter-metatext" data-column-name="name" data-column-template="#user-table-column-info" data-priority="1">{{translate('USER')}} <i class="fas fa-sort"></i></th>
|
||||
<th class="sorter-metatext" data-column-name="name" data-column-template="#{{table.id}}-column-info" data-priority="1">{{translate('USER')}} <i class="fas fa-sort"></i></th>
|
||||
{% if 'last_activity' in table.columns %}
|
||||
<th class="sorter-metanum" data-column-name="last_activity" data-column-template="#user-table-column-last-activity" data-priority="3">{{translate("ACTIVITY.LAST")}} <i class="fas fa-sort"></i></th>
|
||||
<th class="sorter-metanum" data-column-name="last_activity" data-column-template="#{{table.id}}-column-last-activity" data-priority="3">{{translate("ACTIVITY.LAST")}} <i class="fas fa-sort"></i></th>
|
||||
{% endif %}
|
||||
{% if 'via_roles' in table.columns %}
|
||||
<th data-column-template="#user-table-column-via-roles" data-sorter="false" data-filter="false" data-priority="1">{{translate('PERMISSION.VIA_ROLES')}}</th>
|
||||
<th data-column-template="#{{table.id}}-column-via-roles" data-sorter="false" data-filter="false" data-priority="1">{{translate('PERMISSION.VIA_ROLES')}}</th>
|
||||
{% endif %}
|
||||
<th class="filter-select filter-metatext" data-column-name="status" data-column-template="#user-table-column-status" data-priority="2">{{translate("STATUS")}} <i class="fas fa-sort"></i></th>
|
||||
<th data-column-name="actions" data-column-template="#user-table-column-actions" data-sorter="false" data-filter="false" data-priority="1">{{translate("ACTIONS")}}</th>
|
||||
<th class="filter-select filter-metatext" data-column-name="status" data-column-template="#{{table.id}}-column-status" data-priority="2">{{translate("STATUS")}} <i class="fas fa-sort"></i></th>
|
||||
<th data-column-name="actions" data-column-template="#{{table.id}}-column-actions" data-sorter="false" data-filter="false" data-priority="1">{{translate("ACTIONS")}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -34,123 +34,23 @@
|
||||
#
|
||||
# These templates require handlebars-helpers.js, moment.js
|
||||
#}
|
||||
{% verbatim %}
|
||||
<script id="user-table-column-info" type="text/x-handlebars-template">
|
||||
<td data-text="{{row.last_name}}">
|
||||
<strong>
|
||||
<a href="{{site.uri.public}}/users/u/{{row.user_name}}">{{row.first_name}} {{row.last_name}} ({{row.user_name}})</a>
|
||||
</strong>
|
||||
<div class="js-copy-container">
|
||||
<span class="js-copy-target">{{row.email}}</span>
|
||||
<button class="btn btn-xs uf-copy-trigger js-copy-trigger"><i class="fas fa-copy"></i></button>
|
||||
</div>
|
||||
</td>
|
||||
</script>
|
||||
|
||||
<script id="user-table-column-last-activity" type="text/x-handlebars-template">
|
||||
{{#if row.last_activity }}
|
||||
<td data-num="{{dateFormat row.last_activity.occurred_at format='x'}}">
|
||||
{{dateFormat row.last_activity.occurred_at format="dddd"}}<br>{{dateFormat row.last_activity.occurred_at format="MMM Do, YYYY h:mm a"}}
|
||||
<br>
|
||||
<i>{{row.last_activity.description}}</i>
|
||||
</td>
|
||||
{{ else }}
|
||||
<td data-num="0">
|
||||
<i>{% endverbatim %}{{translate("UNKNOWN")}}{% verbatim %}</i>
|
||||
</td>
|
||||
{{/if }}
|
||||
</script>
|
||||
|
||||
<script id="user-table-column-status" type="text/x-handlebars-template">
|
||||
<td
|
||||
{{#ifx row.flag_enabled '==' 0 }}
|
||||
data-text="disabled"
|
||||
{{ else }}
|
||||
{{#ifx row.flag_verified '==' 0 }}
|
||||
data-text="unactivated"
|
||||
{{ else }}
|
||||
data-text="active"
|
||||
{{/ifx }}
|
||||
{{/ifx }}
|
||||
>
|
||||
{{#ifx row.flag_enabled '==' 0 }}
|
||||
<span class="text-muted">
|
||||
{% endverbatim %}{{translate("DISABLED")}}{% verbatim %}
|
||||
</span>
|
||||
{{ else }}
|
||||
{{#ifx row.flag_verified '==' 0 }}
|
||||
<span class="text-yellow">
|
||||
{% endverbatim %}{{translate("UNACTIVATED")}}{% verbatim %}
|
||||
</span>
|
||||
{{ else }}
|
||||
<span>
|
||||
{% endverbatim %}{{translate("ACTIVE")}}{% verbatim %}
|
||||
</span>
|
||||
{{/ifx }}
|
||||
{{/ifx }}
|
||||
</td>
|
||||
</script>
|
||||
<script id="user-table-column-actions" type="text/x-handlebars-template">
|
||||
<td class="uf-table-fit-width">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">{% endverbatim %}{{translate("ACTIONS")}}{% verbatim %}<span class="caret"></span></button>
|
||||
<ul class="dropdown-menu dropdown-menu-right-responsive" role="menu">
|
||||
{{#ifx row.flag_verified '==' 0 }}
|
||||
<li>
|
||||
<a href="#" data-user_name="{{row.user_name}}" class="js-user-activate">
|
||||
<i class="fas fa-bolt"></i> {% endverbatim %}{{translate("USER.ACTIVATE")}}{% verbatim %}
|
||||
</a>
|
||||
</li>
|
||||
{{/ifx }}
|
||||
|
||||
<li>
|
||||
<a href="#" data-user_name="{{row.user_name}}" class="js-user-edit">
|
||||
<i class="fas fa-edit"></i> {% endverbatim %}{{translate("USER.EDIT")}}{% verbatim %}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
{% endverbatim %}{% if checkAccess('uri_roles') %}{% verbatim %}
|
||||
<li>
|
||||
<a href="#" data-user_name="{{row.user_name}}" class="js-user-roles">
|
||||
<i class="fas fa-id-card"></i> {% endverbatim %}{{translate("ROLE.MANAGE")}}{% verbatim %}
|
||||
</a>
|
||||
</li>
|
||||
{% endverbatim %}{% endif %}{% verbatim %}
|
||||
|
||||
<li>
|
||||
<a href="#" data-user_name="{{row.user_name}}" class="js-user-password">
|
||||
<i class="fas fa-key"></i> {% endverbatim %}{{translate("USER.ADMIN.CHANGE_PASSWORD")}}{% verbatim %}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
{{#ifx row.flag_enabled '==' 1 }}
|
||||
<a href="#" data-user_name="{{row.user_name}}" class="js-user-disable">
|
||||
<i class="fas fa-minus-circle"></i> {% endverbatim %}{{translate("USER.DISABLE")}}{% verbatim %}
|
||||
</a>
|
||||
{{ else }}
|
||||
<a href="#" data-user_name="{{row.user_name}}" class="js-user-enable">
|
||||
<i class="fas fa-plus-circle"></i> {% endverbatim %}{{translate("USER.ENABLE")}}{% verbatim %}
|
||||
</a>
|
||||
{{/ifx }}
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#" data-user_name="{{row.user_name}}" class="js-user-delete">
|
||||
<i class="fas fa-trash-alt"></i> {% endverbatim %}{{translate("USER.DELETE")}}{% verbatim %}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</script>
|
||||
|
||||
<script id="user-table-column-via-roles" type="text/x-handlebars-template">
|
||||
<td>
|
||||
{{#each row.roles_via }}
|
||||
<a href="{% endverbatim %}{# Handlebars can't access variables in the global scope, so we have to use Twig to insert the base url #}{{site.uri.public}}{% verbatim %}/roles/r/{{this.slug}}" class="label label-primary" title="{{this.description}}">{{this.name}}</a>
|
||||
{{/each}}
|
||||
</td>
|
||||
</script>
|
||||
{% endverbatim %}
|
||||
{% block table_users_column_info %}
|
||||
{% include "tables/columns/users-info.html.twig" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block table_users_column_last_activity %}
|
||||
{% include "tables/columns/users-last_activity.html.twig" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block table_users_column_status %}
|
||||
{% include "tables/columns/users-status.html.twig" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block table_users_column_actions %}
|
||||
{% include "tables/columns/users-actions.html.twig" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block table_users_column_via_roles %}
|
||||
{% include "tables/columns/users-via_roles.html.twig" %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user