aboutsummaryrefslogtreecommitdiffstats
path: root/templates/web
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2016-05-20 14:33:37 +0100
committerMatthew Somerville <matthew@mysociety.org>2016-05-20 14:33:37 +0100
commite039a7e191d1f352b5d24bf5f965f2efeb5dc3de (patch)
tree13c8a9642cafb65de444287f46eb298fb0885011 /templates/web
parent173abd37716cb49cde3d4836a9cf51a285bd3b79 (diff)
Add search boxes to admin index page, move stats.
Move most index page statistics to their own pages.
Diffstat (limited to 'templates/web')
-rw-r--r--templates/web/base/admin/index.html57
-rw-r--r--templates/web/base/admin/stats.html7
-rw-r--r--templates/web/base/admin/stats_by_state.html24
-rw-r--r--templates/web/base/admin/stats_fix_rate.html10
-rw-r--r--templates/web/base/status/stats.html2
5 files changed, 67 insertions, 33 deletions
diff --git a/templates/web/base/admin/index.html b/templates/web/base/admin/index.html
index 4c4a7b388..66d986aaf 100644
--- a/templates/web/base/admin/index.html
+++ b/templates/web/base/admin/index.html
@@ -12,7 +12,7 @@ or get in touch</a> to let us know about your use of the FixMyStreet Platform,
and to receive notices of updates.
</div>
-[% IF total_bodies == 0 %]
+[% IF bodies.size == 0 %]
<p class="fms-admin-info">
[% loc('Currently no bodies have been created.') %]
<br>
@@ -20,14 +20,31 @@ and to receive notices of updates.
</p>
[% END %]
-[%- BLOCK states -%]
-[%- FOREACH state IN list %]
-[%- '<ul>' IF loop.first %]
- <li>[% object.$state %] [% state_pretty.$state %]</li>
-[%- "\n</ul>" IF loop.last %]
-[%- END %]
-[% END -%]
+<form method="get" action="[% c.uri_for('reports') %]" accept-charset="utf-8">
+ <p><label for="search_reports">[% loc('Search Reports') %]</label>
+ <input type="text" name="search" size="30" id="search_reports" value="[% searched | html %]">
+</form>
+
+<form method="get" action="[% c.uri_for('users') %]" accept-charset="utf-8">
+ <p><label for="search_users">[% loc('Search Users') %]</label>
+ <input type="text" name="search" size="30" id="search_users" value="[% searched | html %]">
+</form>
+
+<form method="get" action="[% c.uri_for('bodies') %]">
+<label for="search_body">[% loc('Edit body details') %]</label>
+<select id="search_body" name="body">
+[% FOREACH body IN bodies %]
+ [%- SET id = body.id %]
+ <option[% IF body.deleted %] class="adminhidden"[% END %] value="[% body.id %]">
+ [% body.name | html %]
+ [%- IF body.parent %], [% body.parent.name | html %][% END -%]
+ </option>
+[% END %]
+</select>
+<input type="submit" value="[% loc('Go') %]">
+</form>
+<h2>[% loc('Stats') %]</h2>
[% INCLUDE 'status/stats.html' admin_include_users=1 %]
[% IF c.cobrand.admin_show_creation_graph -%]
@@ -36,28 +53,4 @@ and to receive notices of updates.
</p>
[% END -%]
-<h2>[% loc('Problem breakdown by state') %]</h2>
-[% FOREACH group IN state_groups %]
-[%- '<ul>' IF loop.first %]
- <li><strong>[% group.0 %]</strong>
- [% PROCESS states object=problems list=group.1 %]
- </li>
-[%- "\n</ul>" IF loop.last %]
-[%- END %]
-
-<h2>[% loc('Update breakdown by state') %]</h2>
-[% PROCESS states object=comments list=comments.keys.sort %]
-
-[% IF categories.size %]
- <h2 id="category-fix-rate">[% loc('Category fix rate for problems > 4 weeks old') %]</h2>
- <table>
- <tr><th>[% loc('Category') %]</th><th>[% loc('Total') %]</th><th>[% loc('Fixed') %]</th></tr>
-[% FOREACH category IN categories %]
- <tr><td>[% category.key %]</td><td>[% category.value.total %]</td><td>[% category.value.fixed / category.value.total * 100 | format('%.1f') %]%</td></tr>
-[% END %]
- </table>
-[% ELSE %]
-<p><a href="?show_categories=1#category-fix-rate">[% loc('Category fix rate for problems > 4 weeks old') %]</a></p>
-[% END %]
-
[% INCLUDE 'admin/footer.html' %]
diff --git a/templates/web/base/admin/stats.html b/templates/web/base/admin/stats.html
index d143d9f28..5aaf59068 100644
--- a/templates/web/base/admin/stats.html
+++ b/templates/web/base/admin/stats.html
@@ -51,6 +51,13 @@
<small>[% loc( 'Note that when including unconfirmed reports we use the date the report was created which may not be in the same month the report was confirmed so the numbers may jump about a little' ) %]</small>
</p>
[% END %]
+[% ELSE %]
+<ul>
+<li><a href="stats/questionnaire">[% loc('Survey Results') %]</a></li>
+<li><a href="stats/state">[% loc('Problem breakdown by state') %]</a></li>
+<li><a href="stats/fix-rate">[% loc('Category fix rate for problems > 4 weeks old') %]</a></li>
+</ul>
+
[% END %]
[% IF errors %]
diff --git a/templates/web/base/admin/stats_by_state.html b/templates/web/base/admin/stats_by_state.html
new file mode 100644
index 000000000..b003d934e
--- /dev/null
+++ b/templates/web/base/admin/stats_by_state.html
@@ -0,0 +1,24 @@
+[% INCLUDE 'admin/header.html' title=loc('Stats') -%]
+[% PROCESS 'admin/report_blocks.html' %]
+
+[%- BLOCK states -%]
+[%- FOREACH state IN list %]
+[%- '<ul>' IF loop.first %]
+ <li>[% object.$state %] [% state_pretty.$state %]</li>
+[%- "\n</ul>" IF loop.last %]
+[%- END %]
+[% END -%]
+
+<h2>[% loc('Problem breakdown by state') %]</h2>
+[% FOREACH group IN state_groups %]
+[%- '<ul>' IF loop.first %]
+ <li><strong>[% group.0 %]</strong>
+ [% PROCESS states object=problems list=group.1 %]
+ </li>
+[%- "\n</ul>" IF loop.last %]
+[%- END %]
+
+<h2>[% loc('Update breakdown by state') %]</h2>
+[% PROCESS states object=comments list=comments.keys.sort %]
+
+[% INCLUDE 'admin/footer.html' %]
diff --git a/templates/web/base/admin/stats_fix_rate.html b/templates/web/base/admin/stats_fix_rate.html
new file mode 100644
index 000000000..fb88a1c06
--- /dev/null
+++ b/templates/web/base/admin/stats_fix_rate.html
@@ -0,0 +1,10 @@
+[% INCLUDE 'admin/header.html' title=loc('Category fix rate for problems > 4 weeks old') -%]
+
+<table>
+ <tr><th>[% loc('Category') %]</th><th>[% loc('Total') %]</th><th>[% loc('Fixed') %]</th></tr>
+[% FOREACH category IN categories %]
+ <tr><td>[% category.key %]</td><td>[% category.value.total %]</td><td>[% category.value.fixed / category.value.total * 100 | format('%.1f') %]%</td></tr>
+[% END %]
+</table>
+
+[% INCLUDE 'admin/footer.html' %]
diff --git a/templates/web/base/status/stats.html b/templates/web/base/status/stats.html
index f847db2ef..0f201920d 100644
--- a/templates/web/base/status/stats.html
+++ b/templates/web/base/status/stats.html
@@ -8,7 +8,7 @@
alerts_0 = alerts.0 | format_number;
questionnaires_total = questionnaires.total | format_number;
questionnaires_1 = questionnaires.1 | format_number;
- total_bodies = total_bodies | format_number;
+ total_bodies = bodies.size | format_number;
contacts_total = contacts.total | format_number;
contacts_1 = contacts.1 | format_number;
contacts_0 = contacts.0 | format_number;