Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/torrent/TorrentActionCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

<div class="flex flex-col p-6 stats bg-base-100 rounded-2xl">
<div class="flex flex-col text-sm text-base-content/60">
<div class="flex flex-row py-2 pt-0">
<div v-if="torrent.category !== null" class="flex flex-row py-2 pt-0">
<div class="flex flex-row w-1/2">
<TagIcon class="w-4 mr-2" />
<span>Category</span>
Expand Down
30 changes: 19 additions & 11 deletions pages/torrent/edit/[infoHash].vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,17 @@
</select>
</div>
</template>
<div>
<label for="tags" class="px-2">Tags</label>
<TorrustSelect
v-model:selected="form.tags"
:options="tags.map(entry => ({ name: entry.name, value: entry.tag_id }))"
:multiple="true"
search
/>
</div>
<template v-if="tags?.length > 0">
<div>
<label for="tags" class="px-2">Tags</label>
<TorrustSelect
v-model:selected="form.tags"
:options="tags.map(entry => ({ name: entry.name, value: entry.tag_id }))"
:multiple="true"
search
/>
</div>
</template>
<template v-if="user?.username">
<button
class="btn btn-primary"
Expand Down Expand Up @@ -131,7 +133,13 @@ function getTorrentFromApi (infoHash: string) {

form.value.title = data.title;
form.value.description = data.description;
form.value.category = data.category.category_id;

if (data.category === null) {
form.value.category = null;
} else {
form.value.category = data.category.category_id;
}

form.value.tags = data.tags.map((tag) => {
if (typeof tag === "object" && "tag_id" in tag) {
return tag.tag_id;
Expand All @@ -148,7 +156,7 @@ function getTorrentFromApi (infoHash: string) {
}

function formValid () {
return form.value.title && (form.value.title + form.value.description) !== (torrent.value.title + torrent.value.description + torrent.value.category.name);
return form.value.title && form.value.description;
}

function submitForm () {
Expand Down