feat: topics dashboard details subpage
parent
c57c77030e
commit
e1ed514b10
@ -1,14 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
define('admin/dashboard/topics', ['admin/modules/dashboard-line-graph'], (graph) => {
|
||||
define('admin/dashboard/topics', ['admin/modules/dashboard-line-graph', 'hooks'], (graph, hooks) => {
|
||||
const ACP = {};
|
||||
|
||||
ACP.init = () => {
|
||||
graph.init({
|
||||
set: 'topics',
|
||||
dataset: ajaxify.data.dataset,
|
||||
}).then(() => {
|
||||
hooks.onPage('action:admin.dashboard.updateGraph', ACP.updateTable);
|
||||
});
|
||||
};
|
||||
|
||||
ACP.updateTable = () => {
|
||||
if (window.fetch) {
|
||||
fetch(`${config.relative_path}/api${ajaxify.data.url}${window.location.search}`, { credentials: 'include' }).then((response) => {
|
||||
if (response.ok) {
|
||||
response.json().then(function (payload) {
|
||||
app.parseAndTranslate(ajaxify.data.template.name, 'topics', payload, function (html) {
|
||||
const tbodyEl = document.querySelector('.topics-list tbody');
|
||||
tbodyEl.innerHTML = '';
|
||||
tbodyEl.append(...html.map((idx, el) => el));
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return ACP;
|
||||
});
|
||||
|
@ -1,5 +1,10 @@
|
||||
<div class="row dashboard">
|
||||
<div class="col-xs-12">
|
||||
<a class="btn btn-link" href="{config.relative_path}/admin/dashboard">
|
||||
<i class="fa fa-chevron-left"></i>
|
||||
[[admin/dashboard:back-to-dashboard]]
|
||||
</a>
|
||||
|
||||
<!-- IMPORT admin/partials/dashboard/graph.tpl -->
|
||||
<!-- IMPORT admin/partials/dashboard/stats.tpl -->
|
||||
</div>
|
||||
|
@ -1,6 +1,28 @@
|
||||
<div class="row dashboard">
|
||||
<div class="col-xs-12">
|
||||
<a class="btn btn-link" href="{config.relative_path}/admin/dashboard">
|
||||
<i class="fa fa-chevron-left"></i>
|
||||
[[admin/dashboard:back-to-dashboard]]
|
||||
</a>
|
||||
|
||||
<!-- IMPORT admin/partials/dashboard/graph.tpl -->
|
||||
<!-- IMPORT admin/partials/dashboard/stats.tpl -->
|
||||
|
||||
<table class="table table-striped topics-list">
|
||||
<tbody>
|
||||
{{{ if !topics.length}}}
|
||||
<tr>
|
||||
<td colspan=4" class="text-center"><em>[[admin/dashboard:details.no-topics]]</em></td>
|
||||
</tr>
|
||||
{{{ end }}}
|
||||
{{{ each topics }}}
|
||||
<tr>
|
||||
<td><a href="{config.relative_path}/topics/{../slug}">{../title}</a></td>
|
||||
<td>[[topic:posted_by, {../user.username}]]</td>
|
||||
<td><span class="timeago" data-title="{../timestampISO}"></span></td>
|
||||
</tr>
|
||||
{{{ end }}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
@ -1,23 +1,35 @@
|
||||
<div class="dashboard">
|
||||
<!-- IMPORT admin/partials/dashboard/graph.tpl -->
|
||||
<!-- IMPORT admin/partials/dashboard/stats.tpl -->
|
||||
<div class="col-xs-12">
|
||||
<a class="btn btn-link" href="{config.relative_path}/admin/dashboard">
|
||||
<i class="fa fa-chevron-left"></i>
|
||||
[[admin/dashboard:back-to-dashboard]]
|
||||
</a>
|
||||
|
||||
<table class="table table-striped users-list">
|
||||
<thead>
|
||||
<th class="text-muted">[[admin/manage/users:users.uid]]</th>
|
||||
<th class="text-muted">[[admin/manage/users:users.username]]</th>
|
||||
<th class="text-muted">[[admin/manage/users:users.email]]</th>
|
||||
<th data-sort="joindate">[[admin/manage/users:users.joined]]</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{{ each users }}}
|
||||
<tr>
|
||||
<td>{../uid}</td>
|
||||
<td>{../username}</td>
|
||||
<td>{../email}</td>
|
||||
<td><span class="timeago" title="{../joindateISO}"></span></td>
|
||||
</tr>
|
||||
{{{ end }}}
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- IMPORT admin/partials/dashboard/graph.tpl -->
|
||||
<!-- IMPORT admin/partials/dashboard/stats.tpl -->
|
||||
|
||||
<table class="table table-striped users-list">
|
||||
<thead>
|
||||
<th class="text-muted">[[admin/manage/users:users.uid]]</th>
|
||||
<th class="text-muted">[[admin/manage/users:users.username]]</th>
|
||||
<th class="text-muted">[[admin/manage/users:users.email]]</th>
|
||||
<th data-sort="joindate">[[admin/manage/users:users.joined]]</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{{ if !users.length}}}
|
||||
<tr>
|
||||
<td colspan=4" class="text-center"><em>[[admin/dashboard:details.no-logins]]</em></td>
|
||||
</tr>
|
||||
{{{ end }}}
|
||||
{{{ each users }}}
|
||||
<tr>
|
||||
<td>{../uid}</td>
|
||||
<td>{../username}</td>
|
||||
<td>{../email}</td>
|
||||
<td><span class="timeago" title="{../joindateISO}"></span></td>
|
||||
</tr>
|
||||
{{{ end }}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
@ -1,49 +1,47 @@
|
||||
<div class="row">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th class="text-right">[[admin/dashboard:stats.yesterday]]</th>
|
||||
<th class="text-right">[[admin/dashboard:stats.today]]</th>
|
||||
<th></th>
|
||||
<th class="text-right">[[admin/dashboard:stats.last-week]]</th>
|
||||
<th class="text-right">[[admin/dashboard:stats.this-week]]</th>
|
||||
<th></th>
|
||||
<th class="text-right">[[admin/dashboard:stats.last-month]]</th>
|
||||
<th class="text-right">[[admin/dashboard:stats.this-month]]</th>
|
||||
<th></th>
|
||||
<th class="text-right">[[admin/dashboard:stats.all]]</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- BEGIN stats -->
|
||||
<tr>
|
||||
<td>
|
||||
<strong>
|
||||
{{{ if ../href }}}
|
||||
<a href="{../href}">{../name}</a>
|
||||
{{{ else }}}
|
||||
{../name}
|
||||
{{{ end }}}
|
||||
</strong>
|
||||
</td>
|
||||
<td class="text-right formatted-number">{stats.yesterday}</td>
|
||||
<td class="text-right formatted-number">{stats.today}</td>
|
||||
<td class="{stats.dayTextClass}"><small>{stats.dayIncrease}%</small></td>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th class="text-right">[[admin/dashboard:stats.yesterday]]</th>
|
||||
<th class="text-right">[[admin/dashboard:stats.today]]</th>
|
||||
<th></th>
|
||||
<th class="text-right">[[admin/dashboard:stats.last-week]]</th>
|
||||
<th class="text-right">[[admin/dashboard:stats.this-week]]</th>
|
||||
<th></th>
|
||||
<th class="text-right">[[admin/dashboard:stats.last-month]]</th>
|
||||
<th class="text-right">[[admin/dashboard:stats.this-month]]</th>
|
||||
<th></th>
|
||||
<th class="text-right">[[admin/dashboard:stats.all]]</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- BEGIN stats -->
|
||||
<tr>
|
||||
<td>
|
||||
<strong>
|
||||
{{{ if ../href }}}
|
||||
<a href="{../href}">{../name}</a>
|
||||
{{{ else }}}
|
||||
{../name}
|
||||
{{{ end }}}
|
||||
</strong>
|
||||
</td>
|
||||
<td class="text-right formatted-number">{stats.yesterday}</td>
|
||||
<td class="text-right formatted-number">{stats.today}</td>
|
||||
<td class="{stats.dayTextClass}"><small>{stats.dayIncrease}%</small></td>
|
||||
|
||||
<td class="text-right formatted-number">{stats.lastweek}</td>
|
||||
<td class="text-right formatted-number">{stats.thisweek}</td>
|
||||
<td class="{stats.weekTextClass}"><small>{stats.weekIncrease}%</small></td>
|
||||
<td class="text-right formatted-number">{stats.lastweek}</td>
|
||||
<td class="text-right formatted-number">{stats.thisweek}</td>
|
||||
<td class="{stats.weekTextClass}"><small>{stats.weekIncrease}%</small></td>
|
||||
|
||||
<td class="text-right formatted-number">{stats.lastmonth}</td>
|
||||
<td class="text-right formatted-number">{stats.thismonth}</td>
|
||||
<td class="{stats.monthTextClass}"><small>{stats.monthIncrease}%</small></td>
|
||||
<td class="text-right formatted-number">{stats.lastmonth}</td>
|
||||
<td class="text-right formatted-number">{stats.thismonth}</td>
|
||||
<td class="{stats.monthTextClass}"><small>{stats.monthIncrease}%</small></td>
|
||||
|
||||
<td class="text-right formatted-number">{stats.alltime}</td>
|
||||
</tr>
|
||||
<!-- END stats -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<td class="text-right formatted-number">{stats.alltime}</td>
|
||||
</tr>
|
||||
<!-- END stats -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
Loading…
Reference in New Issue