diff options
author | marvin-borner@live.com | 2018-04-16 21:09:05 +0200 |
---|---|---|
committer | marvin-borner@live.com | 2018-04-16 21:09:05 +0200 |
commit | cf14306c2b3f82a81f8d56669a71633b4d4b5fce (patch) | |
tree | 86700651aa180026e89a66064b0364b1e4346f3f /main/app/sprinkles/admin/templates/tables | |
parent | 619b01b3615458c4ed78bfaeabb6b1a47cc8ad8b (diff) |
Main merge to user management system - files are now at /main/public/
Diffstat (limited to 'main/app/sprinkles/admin/templates/tables')
5 files changed, 431 insertions, 0 deletions
diff --git a/main/app/sprinkles/admin/templates/tables/activities.html.twig b/main/app/sprinkles/admin/templates/tables/activities.html.twig new file mode 100755 index 0000000..d70541b --- /dev/null +++ b/main/app/sprinkles/admin/templates/tables/activities.html.twig @@ -0,0 +1,73 @@ +{# 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="#activity-table-column-occurred-at" data-priority="1">{{translate('ACTIVITY.TIME')}} <i class="fa fa-sort"></i></th> + {% if 'user' in table.columns %} + <th class="sorter-metatext" data-column-name="user" data-column-template="#activity-table-column-user" data-priority="1">{{translate('USER')}} <i class="fa fa-sort"></i></th> + {% endif %} + <th class="sorter-metatext" data-column-name="description" data-column-template="#activity-table-column-description" data-priority="1">{{translate("DESCRIPTION")}} <i class="fa 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 + #} + {% verbatim %} + <script id="activity-table-column-occurred-at" type="text/x-handlebars-template"> + {{#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 }} + </script> + + <script id="activity-table-column-user" type="text/x-handlebars-template"> + <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="fa fa-copy"></i></button> + </div> + {{ else }} + <i>{% endverbatim %}{{translate("USER.DELETED")}}{% verbatim %}</i> + {{/if }} + </td> + </script> + + <script id="activity-table-column-description" type="text/x-handlebars-template"> + <td> + <div> + {{row.ip_address}} + </div> + <div> + <i>{{row.description}}</i> + </div> + </td> + </script> + {% endverbatim %} +{% endblock %} diff --git a/main/app/sprinkles/admin/templates/tables/groups.html.twig b/main/app/sprinkles/admin/templates/tables/groups.html.twig new file mode 100755 index 0000000..2c5a84a --- /dev/null +++ b/main/app/sprinkles/admin/templates/tables/groups.html.twig @@ -0,0 +1,69 @@ +{# 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="#group-table-column-info" data-priority="1">{{translate('GROUP')}} <i class="fa fa-sort"></i></th> + <th class="sorter-metatext" data-column-name="description" data-column-template="#group-table-column-description" data-priority="2">{{translate("DESCRIPTION")}} <i class="fa fa-sort"></i></th> + <th data-column-template="#group-table-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 + #} + {% verbatim %} + <script id="group-table-column-info" type="text/x-handlebars-template"> + <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> + </script> + + <script id="group-table-column-description" type="text/x-handlebars-template"> + <td> + {{row.description}} + </td> + </script> + + <script id="group-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"> + <li> + <a href="#" data-slug="{{row.slug}}" class="js-group-edit"> + <i class="fa fa-edit"></i> {% endverbatim %}{{translate("GROUP.EDIT")}}{% verbatim %} + </a> + </li> + <li> + <a href="#" data-slug="{{row.slug}}" class="js-group-delete"> + <i class="fa fa-trash-o"></i> {% endverbatim %}{{translate("GROUP.DELETE")}}{% verbatim %} + </a> + </li> + </ul> + </div> + </td> + </script> + {% endverbatim %} +{% endblock %} diff --git a/main/app/sprinkles/admin/templates/tables/permissions.html.twig b/main/app/sprinkles/admin/templates/tables/permissions.html.twig new file mode 100755 index 0000000..92e236a --- /dev/null +++ b/main/app/sprinkles/admin/templates/tables/permissions.html.twig @@ -0,0 +1,66 @@ +{# 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="#permission-table-column-name" data-priority="1">{{translate('PERMISSION')}} <i class="fa fa-sort"></i></th> + <th class="sorter-metatext" data-column-name="properties" data-column-template="#permission-table-column-properties" data-priority="1">{{translate('SLUG_CONDITION')}} <i class="fa fa-sort"></i></th> + {% if 'via_roles' in table.columns %} + <th data-column-template="#permission-table-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 + #} + {% verbatim %} + <script id="permission-table-column-name" type="text/x-handlebars-template"> + <td data-text="{{row.name}}"> + <div> + <strong> + <a href="{{site.uri.public}}/permissions/p/{{row.id}}">{{row.name}}</a> + </strong> + </div> + </td> + </script> + + <script id="permission-table-column-properties" type="text/x-handlebars-template"> + <td> + <div> + <code>{{row.slug}}</code> + </div> + <div> + ↳ <code>{{row.conditions}}</code> + </div> + <div> + <i>{{row.description}}</i> + </div> + </td> + </script> + + <script id="permission-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 %} +{% endblock %} diff --git a/main/app/sprinkles/admin/templates/tables/roles.html.twig b/main/app/sprinkles/admin/templates/tables/roles.html.twig new file mode 100755 index 0000000..dbdb49e --- /dev/null +++ b/main/app/sprinkles/admin/templates/tables/roles.html.twig @@ -0,0 +1,74 @@ +{# This partial template renders a table of roles, 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="#role-table-column-info" data-priority="1">{{translate('ROLE')}} <i class="fa 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="fa fa-sort"></i></th> + <th data-column-template="#role-table-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 + #} + {% 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"> + <li> + <a href="#" data-slug="{{row.slug}}" class="js-role-permissions"> + <i class="fa fa-key"></i> {% endverbatim %}{{translate("PERMISSION.MANAGE")}}{% verbatim %} + </a> + </li> + <li> + <a href="#" data-slug="{{row.slug}}" class="js-role-edit"> + <i class="fa fa-edit"></i> {% endverbatim %}{{translate("ROLE.EDIT")}}{% verbatim %} + </a> + </li> + <li> + <a href="#" data-slug="{{row.slug}}" class="js-role-delete"> + <i class="fa fa-trash-o"></i> {% endverbatim %}{{translate("ROLE.DELETE")}}{% verbatim %} + </a> + </li> + </ul> + </div> + </td> + </script> + {% endverbatim %} +{% endblock %} diff --git a/main/app/sprinkles/admin/templates/tables/users.html.twig b/main/app/sprinkles/admin/templates/tables/users.html.twig new file mode 100755 index 0000000..1cebb47 --- /dev/null +++ b/main/app/sprinkles/admin/templates/tables/users.html.twig @@ -0,0 +1,149 @@ +{# This partial template renders a table of users, 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="#user-table-column-info" data-priority="1">{{translate('USER')}} <i class="fa 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="fa 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> + {% 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="fa 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> + </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 + #} + {% 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="fa 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="fa 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="fa fa-edit"></i> {% endverbatim %}{{translate("USER.EDIT")}}{% verbatim %} + </a> + </li> + <li> + <a href="#" data-user_name="{{row.user_name}}" class="js-user-roles"> + <i class="fa fa-drivers-license"></i> {% endverbatim %}{{translate("ROLE.MANAGE")}}{% verbatim %} + </a> + </li> + <li> + <a href="#" data-user_name="{{row.user_name}}" class="js-user-password"> + <i class="fa 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="fa 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="fa 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="fa fa-trash-o"></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 %} +{% endblock %} |