Skip to content

Commit

Permalink
fix object settings type
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBrax committed Nov 8, 2023
1 parent 95b7a8b commit 8aa4f16
Showing 1 changed file with 39 additions and 26 deletions.
65 changes: 39 additions & 26 deletions client-vue/src/components/forms/SettingsForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,33 +68,46 @@
v-model="formData.config[key]"
class="input"
:name="key"
:data-is-array="data.choices && Array.isArray(data.choices)"
:data-is-array="true"
>
<template v-if="data.choices && Array.isArray(data.choices)">
<option
v-for="(item, ix) in data.choices"
:key="ix"
:selected="
(formData.config[key] !== undefined && formData.config[key] === item) ||
(formData.config[key] === undefined && item === data.default)
"
>
{{ item }}
</option>
</template>
<template v-else>
<option
v-for="(item, ix) in data.choices"
:key="ix"
:value="ix"
:selected="
(formData.config[key] !== undefined && formData.config[key] === item) ||
(formData.config[key] === undefined && ix === data.default)
"
>
{{ item }}
</option>
</template>
<option
v-for="(item, ix) in data.choices"
:key="ix"
:selected="
(formData.config[key] !== undefined && formData.config[key] === item) ||
(formData.config[key] === undefined && item === data.default)
"
>
{{ item }}
</option>
</select>
<span v-else class="is-error">No choices defined</span>
</div>
</div>

<!-- object -->
<div v-if="data.type == 'object'" class="control">
<!--<input class="input" :name="key" :id="key" :value="settings[key]" />-->
<div class="select">
<select
v-if="data.choices"
:id="`input_${key}`"
v-model="formData.config[key]"
class="input"
:name="key"
:data-is-array="false"
>
<option
v-for="(item, ix) in data.choices"
:key="ix"
:value="ix"
:selected="
(formData.config[key] !== undefined && formData.config[key] === item) ||
(formData.config[key] === undefined && ix === data.default)
"
>
{{ item }}
</option>
</select>
<span v-else class="is-error">No choices defined</span>
</div>
Expand Down

0 comments on commit 8aa4f16

Please sign in to comment.