Added library node "searchable" switch

This commit is contained in:
Stefan Zermatten
2023-06-07 14:19:06 +02:00
parent 6e47395327
commit c00e618f85
4 changed files with 25 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ export default function getSlotFillFilter({ slot, libraryIds }) {
if (!libraryIds) throw 'LibraryIds is required for getSlotFillFilter';
let filter = {
fillSlots: true,
removed: { $ne: true },
$and: []
};

View File

@@ -38,6 +38,28 @@
v-if="context.isLibraryForm"
dense
>
<v-col
cols="12"
md="6"
>
<smart-switch
label="Can fill slots"
:value="model.fillSlots"
:error-messages="errors.fillSlots"
@change="(value, ack) => $emit('change', {path: ['fillSlots'], value, ack})"
/>
</v-col>
<v-col
cols="12"
md="6"
>
<smart-switch
label="Searchable from character sheet"
:value="model.searchable"
:error-messages="errors.searchable"
@change="(value, ack) => $emit('change', {path: ['searchable'], value, ack})"
/>
</v-col>
<v-col
cols="12"
md="6"

View File

@@ -24,6 +24,7 @@ const LIBRARY_NODE_TREE_FIELDS = {
slotFillerType: 1,
slotFillerConditionNote: 1,
slotFillerCondition: 1,
fillSlots: 1,
searchable: 1,
slotFillImage: 1,
// Effect

View File

@@ -65,13 +65,12 @@ Meteor.publish('searchLibraryNodes', function (creatureId) {
let filter = {
'ancestors.id': { $in: libraryIds },
removed: { $ne: true },
tags: { $ne: [] }, // Only tagged library nodes are considered
searchable: true //library nodes must opt-in
};
if (type) {
filter.$or = [{
type,
}, {
type: 'slotFiller',
slotFillerType: type,
}];
}