Files
notifications-admin/app/templates/views/dashboard/dashboard.html
Alexey Bezhan 29bed8ba55 Add Service.get_templates method with filters by type and folder
With the addition of template folders we need to filter templates
based on a combination of type and parent folder ID.

This replaces the existing `templates_by_type` method with
`get_templates`, which supports both type and parent folder filters,
avoiding a need to create specific methods for each use case.

We still need the templates property to exist in some way in order
to cache it, but it needs to be clear that it's different from
`.get_templates`. One option was to make it "private" (i.e. `_templates`),
and always use `.get_templates` in the rest of the code, but this requires
adding "include all folders" to `.get_templates`, which doesn't have an
obvious interface since `parent_folder_id=None` already means "top-level
only".

This will probably come up again when we need to look into adding
templates from nested folders into the page for live search, but
for now renaming `Service.templates` to `.all_templates` makes it
clear what the property contains.
2018-11-06 13:13:13 +00:00

55 lines
1.7 KiB
HTML

{% extends "withnav_template.html" %}
{% from "components/big-number.html" import big_number, big_number_with_status %}
{% from "components/show-more.html" import show_more %}
{% from "components/message-count-label.html" import message_count_label %}
{% from "components/table.html" import list_table, field, right_aligned_field_heading, hidden_field_heading %}
{% from "components/ajax-block.html" import ajax_block %}
{% block service_page_title %}
Dashboard
{% endblock %}
{% block maincolumn_content %}
<div class="dashboard">
<h1 class="visuallyhidden">Dashboard</h1>
{% if current_user.has_permissions('manage_templates') and not current_service.all_templates %}
{% include 'views/dashboard/write-first-messages.html' %}
{% endif %}
{{ ajax_block(partials, updates_url, 'upcoming', interval=5) }}
<h2 class="heading-medium">
In the last 7 days
</h2>
{{ ajax_block(partials, updates_url, 'inbox', interval=5) }}
{{ ajax_block(partials, updates_url, 'totals', interval=5) }}
{{ show_more(
url_for('.monthly', service_id=current_service.id),
'See messages sent per month'
) }}
{% if partials['has_template_statistics'] %}
{{ ajax_block(partials, updates_url, 'template-statistics', interval=5) }}
{{ show_more(
url_for('.template_usage', service_id=current_service.id),
'See templates used by month'
) }}
{% endif %}
{% if partials['has_jobs'] %}
{{ ajax_block(partials, updates_url, 'jobs', interval=5) }}
{{ show_more(
url_for('.view_jobs', service_id=current_service.id),
'See all uploaded files'
) }}
{% endif %}
</div>
{% endblock %}