Bug 38201: Add 'radio' support to filters

In the context of the Preservation module, some changes expected here
however

Before:
Filter by: o All  o Closed  o Sent  o Received

After:
All: o  Closed: o  Sent: o  Received: o
(cherry picked from commit c2bc61ba7daa70eebe158b327b9fef0b6be44507)
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2025-04-08 16:42:33 +02:00 committed by Lucas Gass
parent a7b66a877c
commit 7c6ab84405
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 25 additions and 4 deletions

View File

@ -15,7 +15,7 @@
:required="attr.required ? true : false"
/>
</template>
<template v-if="attr.type == 'text'">
<template v-else-if="attr.type == 'text'">
<input
:id="getElementId"
v-model="resource[attr.name]"
@ -41,6 +41,16 @@
@change="attr.onChange && attr.onChange(resource)"
/>
</template>
<template v-else-if="attr.type == 'radio'">
<input
type="radio"
:name="attr.name"
:id="getElementId"
:value="attr.value"
v-model="resource[attr.name]"
@change="attr.onChange && attr.onChange(resource)"
/>
</template>
<template v-else-if="attr.type == 'boolean'">
<label class="radio" :for="getElementId + '_yes'"
>{{ $__("Yes") }}:
@ -146,6 +156,11 @@
@additional-fields-changed="additionalFieldsChanged"
></AdditionalFieldsEntry>
</template>
<template v-else>
<span>{{
$__("Programming error: unknown type %s").format(attr.type)
}}</span>
</template>
<ToolTip v-if="attr.toolTip" :toolTip="attr.toolTip"></ToolTip>
<span v-if="attr.required" class="required">{{ $__("Required") }}</span>
</template>
@ -171,9 +186,11 @@ export default {
},
computed: {
getElementId() {
return this.attr.indexRequired
? `${this.attr.name}_${this.index}`
: this.attr.name;
return this.attr.id
? this.attr.id
: this.attr.indexRequired
? `${this.attr.name}_${this.index}`
: this.attr.name;
},
requiredComponent() {
const component = this.identifyAndImportComponent(this.attr);
@ -238,4 +255,8 @@ input::-webkit-inner-spin-button {
input[type="number"] {
-moz-appearance: textfield;
}
.filters > input[type="radio"] {
min-width: 0 !important;
}
</style>