Skip to content

Commit

Permalink
Add created_at column
Browse files Browse the repository at this point in the history
  • Loading branch information
hongquan committed Sep 8, 2023
1 parent 88dbb3e commit 33a238e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
13 changes: 11 additions & 2 deletions admin/src/components/BlogPostRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
{{ post.slug }}
</td>
<td :class='CELL_CLASSES'>
{{ CategoriesDisplay }}
{{ categoriesDisplay }}
</td>
<td :class='CELL_CLASSES'>
{{ createDateDisplay }}
</td>
<td>
<div class='flex items-center space-x-4'>
Expand Down Expand Up @@ -86,13 +89,19 @@ const classNames = computed(() => [
'dark:border-gray-700',
])
const CategoriesDisplay = computed(() => {
const categoriesDisplay = computed(() => {
if (!props.post.categories) {
return ''
}
return props.post.categories.map(c => c.title).join(', ')
})
const createDateDisplay = computed(() => props.post.created_at.toLocaleDateString('en-US', {
year: 'numeric',
month: 'short',
day: 'numeric',
}))
const editUrl = computed(() => ({
name: 'post.edit',
params: { postId: props.post.id },
Expand Down
8 changes: 7 additions & 1 deletion admin/src/views/BlogPostList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
v-model='search'
name='q'
placeholder='Search'
class='w-64'
class='w-40 sm:w-64'
size='sm'
>
<template #prefix>
Expand Down Expand Up @@ -73,6 +73,12 @@
>
Categories
</th>
<th
scope='col'
:class='CELL_CLASSES'
>
Created
</th>
<th
scope='col'
:class='CELL_CLASSES'
Expand Down

0 comments on commit 33a238e

Please sign in to comment.