add code to convert datetime into localtime into file list and add access quarys
This commit is contained in:
@@ -227,13 +227,17 @@
|
||||
</td>
|
||||
<td>{{ file.note }}</td>
|
||||
<td><span class="badge">{{ file.file_size }}</span></td>
|
||||
<td><time datetime="{{ file.uploaded_at }}">{{ file.uploaded_at }}</time></td>
|
||||
<td><time datetime="{{ file.expires_at }}">{{ file.expires_at }}</time></td>
|
||||
<td><time datetime="{{ file.uploaded_at }}" class="local-time"></time></td>
|
||||
<td><time datetime="{{ file.expires_at }}" class="local-time"></time></td>
|
||||
<td class="cell--right">
|
||||
<div class="actions">
|
||||
<button class="icon-btn" title="Info" data-action="info" aria-label="Info for {{ file.file_name }}">ℹ️ <span class="sr-only">Info</span></button>
|
||||
<button class="icon-btn" data-variant="primary" title="Edit" data-action="edit" aria-label="Edit {{ file.file_name }}">✏️ <span class="sr-only">Edit</span></button>
|
||||
<button class="icon-btn" data-variant="ghost" title="Copy link" data-action="copy" aria-label="Copy link to {{ file.file_name }}">📋 <span class="sr-only">Copy</span></button>
|
||||
<button class="icon-btn" title="Info">
|
||||
<a href="{{ url_for('side_main.file_info', file_id=file.file_id) }}">ℹ️ <span class="sr-only">Info</span></a>
|
||||
</button>
|
||||
<button class="icon-btn" title="Edit">
|
||||
<a href="{{ url_for('side_main.file_edit', file_id=file.file_id) }}">✏️ <span class="sr-only">Edit</span></a>
|
||||
</button>
|
||||
<button class="icon-btn" title="Copy link" data-action="copy">📋 <span class="sr-only">Copy</span></button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -245,7 +249,6 @@
|
||||
</main>
|
||||
|
||||
<script>
|
||||
// Minimal progressive enhancement for "Copy" action
|
||||
document.addEventListener('click', (e) => {
|
||||
const btn = e.target.closest('button[data-action="copy"]');
|
||||
if(!btn) return;
|
||||
@@ -261,20 +264,22 @@
|
||||
});
|
||||
});
|
||||
|
||||
// Optional: placeholder handlers for info/edit hooks
|
||||
document.addEventListener('click', (e) => {
|
||||
const info = e.target.closest('button[data-action="info"]');
|
||||
const edit = e.target.closest('button[data-action="edit"]');
|
||||
if(info){
|
||||
const name = info.closest('tr')?.querySelector('.cell--name a')?.textContent?.trim();
|
||||
// Hook into your modal/toast here
|
||||
console.log('Info for:', name);
|
||||
}
|
||||
if(edit){
|
||||
const id = edit.closest('tr')?.querySelector('.cell--name a')?.getAttribute('href');
|
||||
// Navigate or open editor route
|
||||
if(id) window.location.href = id + '/edit';
|
||||
}
|
||||
document.querySelectorAll("time.local-time").forEach(timeEl => {
|
||||
const datetime = timeEl.getAttribute("datetime");
|
||||
if (!datetime) return;
|
||||
|
||||
const date = new Date(datetime);
|
||||
|
||||
timeEl.title = date.toISOString();
|
||||
timeEl.textContent = date.toLocaleString(undefined, {
|
||||
year: "numeric",
|
||||
month: "short",
|
||||
day: "numeric",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
second: undefined,
|
||||
hour12: false,
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user