diff --git a/ordr2/templates/admin/admin_section.jinja2 b/ordr2/templates/admin/admin_section.jinja2 index 9ac9d70..68f1635 100644 --- a/ordr2/templates/admin/admin_section.jinja2 +++ b/ordr2/templates/admin/admin_section.jinja2 @@ -17,13 +17,13 @@
{{ macros.flash_messages() }}
- +

Mangage Users

- +

Manage Consumables

diff --git a/ordr2/templates/admin/user_list.jinja2 b/ordr2/templates/admin/user_list.jinja2 new file mode 100644 index 0000000..5582222 --- /dev/null +++ b/ordr2/templates/admin/user_list.jinja2 @@ -0,0 +1,90 @@ +{% extends "ordr2:templates/layout.jinja2" %} +{% import 'ordr2:templates/macros.jinja2' as macros with context %} + +{% block subtitle %} Admin | Users {% endblock subtitle %} + +{% block content %} +
+{% endblock content %} diff --git a/ordr2/templates/macros.jinja2 b/ordr2/templates/macros.jinja2 index 7fb24ba..95f5943 100644 --- a/ordr2/templates/macros.jinja2 +++ b/ordr2/templates/macros.jinja2 @@ -14,3 +14,61 @@ {% endfor %} {% endfor %} {%- endmacro %} + + +{% macro filter_box(title, query_key, items) -%} + +{%- endmacro %} + + +{% macro sortable_table_header(title, sort_by) -%} + + {% set new_direction = 'desc' if context.sorting.direction == 'asc' else 'asc' %} + {% set new_sort = sort_by + '.' + new_direction %} + {{ title }} + +{%- endmacro %} + + +{% macro pagination_helper(page, text=None, css_class='') -%} + {% set is_active = 'active' if page == context.pages.current %} + {% set is_disabled = 'disabled' if not page %} + {% set url = context.url( (context.query_key_current_page, page) ) if page %} +
  • + {{ text if text else page }} +
  • +{%- endmacro %}} + +{% macro pagination() -%} + {% if context.pages and context.pages.last > 1 %} + + {% endif %} +{%- endmacro %} + + diff --git a/ordr2/views/admin.py b/ordr2/views/admin.py index 8f7749f..93b4a04 100644 --- a/ordr2/views/admin.py +++ b/ordr2/views/admin.py @@ -29,3 +29,15 @@ def admin_section(context, request): processed.'''.format(request.resource_url(context, 'users')) ) return {} + + +@view_config( + context='ordr2:resources.UserList', + permission='view', + renderer='ordr2:templates/admin/user_list.jinja2' + ) +def user_list(context, request): + ''' display the user list ''' + users = context.items() + roles = [(role.name, role.value.capitalize()) for role in Role] + return {'users':users, 'roles':roles}