- history/mine table column 'Language' -> 'Type' (data-sort key 'type') - /api/public and /api/mine rows gain a 'type' field: file extension for attachment pastes, stored language otherwise (default 'text') - paste page stats label 'Language' -> 'Type'; summary line uses the same label; get-paste JSON gains 'type' - store list queries LEFT JOIN attachments to expose the filename - table.js sorting accepts the 'type' key
21 lines
1.2 KiB
JavaScript
21 lines
1.2 KiB
JavaScript
// #139: public history table + 30s auto-refresh.
|
|
const t = PaletteTable.init({
|
|
endpoint: '/api/public',
|
|
perPage: 25,
|
|
hasPager: true,
|
|
rowHtml: it =>
|
|
`<tr class="row" data-href="/${t.esc(it.id)}"><td>` +
|
|
(it.title
|
|
? `${t.esc(it.title)}${it.is_can ? ' <span class="badge" title="Can — bundle of items">can</span>' : ''}`
|
|
: `<a class="slug paste-name" href="/${t.esc(it.id)}">${t.esc(it.id)}</a>${it.is_can ? ' <span class="badge" title="Can — bundle of items">can</span>' : ''}`) +
|
|
`</td>` +
|
|
`<td><span class="badge">${t.esc(it.type || it.language || 'text')}</span></td>` +
|
|
`<td class="dim">${t.fmtSize(it.size)}</td><td class="dim">${it.view_count}</td><td class="dim" data-ts="${it.created_at}">${t.ago(it.created_at)}</td>` +
|
|
(it.custom_slug ? `<td><a class="slug url-link" href="/${t.esc(it.custom_slug)}">/${t.esc(it.custom_slug)}</a></td>` : `<td class="dim">none</td>`) +
|
|
`<td class="dim"><a class="id-link" href="/${t.esc(it.id)}">${t.esc(it.id)}</a></td></tr>`,
|
|
emptyFiltered: 'No pastes match your search.',
|
|
emptyAll: 'No pastes yet. Create the first one.',
|
|
});
|
|
t.load();
|
|
setInterval(t.load, 30000); // auto-refresh history every 30s
|