Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Adds the ability to edit/delete category (#5385)
- Loading branch information
Showing
17 changed files
with
667 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 123 additions & 0 deletions
123
app/javascript/dashboard/routes/dashboard/helpcenter/pages/categories/CategoryListItem.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
<template> | ||
<div> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th scope="col"> | ||
{{ $t('HELP_CENTER.PORTAL.EDIT.CATEGORIES.TABLE.NAME') }} | ||
</th> | ||
<th scope="col"> | ||
{{ $t('HELP_CENTER.PORTAL.EDIT.CATEGORIES.TABLE.DESCRIPTION') }} | ||
</th> | ||
<th scope="col"> | ||
{{ $t('HELP_CENTER.PORTAL.EDIT.CATEGORIES.TABLE.LOCALE') }} | ||
</th> | ||
<th scope="col"> | ||
{{ $t('HELP_CENTER.PORTAL.EDIT.CATEGORIES.TABLE.ARTICLE_COUNT') }} | ||
</th> | ||
<th scope="col" /> | ||
</tr> | ||
</thead> | ||
<tr> | ||
<td colspan="100%" class="horizontal-line" /> | ||
</tr> | ||
<tbody> | ||
<tr v-for="category in categories" :key="category.id"> | ||
<td> | ||
<span>{{ category.name }}</span> | ||
</td> | ||
<td> | ||
<span>{{ category.description }}</span> | ||
</td> | ||
<td> | ||
<span>{{ category.locale }}</span> | ||
</td> | ||
<td> | ||
<span>{{ category.meta.articles_count }}</span> | ||
</td> | ||
<td> | ||
<woot-button | ||
v-tooltip.top-end=" | ||
$t( | ||
'HELP_CENTER.PORTAL.EDIT.CATEGORIES.TABLE.ACTION_BUTTON.EDIT' | ||
) | ||
" | ||
size="tiny" | ||
variant="smooth" | ||
icon="edit" | ||
color-scheme="secondary" | ||
@click="editCategory(category)" | ||
/> | ||
<woot-button | ||
v-tooltip.top-end=" | ||
$t( | ||
'HELP_CENTER.PORTAL.EDIT.CATEGORIES.TABLE.ACTION_BUTTON.DELETE' | ||
) | ||
" | ||
size="tiny" | ||
variant="smooth" | ||
icon="delete" | ||
color-scheme="alert" | ||
@click="deleteCategory(category.id)" | ||
/> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<p v-if="categories.length === 0" class="empty-text"> | ||
{{ $t('HELP_CENTER.PORTAL.EDIT.CATEGORIES.TABLE.EMPTY_TEXT') }} | ||
</p> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
categories: { | ||
type: Array, | ||
default: () => [], | ||
}, | ||
}, | ||
methods: { | ||
editCategory(category) { | ||
this.$emit('edit', category); | ||
}, | ||
deleteCategory(categoryId) { | ||
this.$emit('delete', categoryId); | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
table { | ||
thead tr th { | ||
font-size: var(--font-size-small); | ||
font-weight: var(--font-weight-medium); | ||
text-transform: none; | ||
color: var(--s-600); | ||
padding-left: 0; | ||
padding-top: 0; | ||
} | ||
tbody tr { | ||
border-bottom: 0; | ||
td { | ||
font-size: var(--font-size-small); | ||
padding-left: 0; | ||
} | ||
} | ||
} | ||
.horizontal-line { | ||
border-bottom: 1px solid var(--color-border); | ||
} | ||
.empty-text { | ||
display: flex; | ||
justify-content: center; | ||
color: var(--s-500); | ||
font-size: var(--font-size-default); | ||
margin-top: var(--space-three); | ||
} | ||
</style> |
Oops, something went wrong.