Skip to content

Commit

Permalink
Make decisionName a text input field
Browse files Browse the repository at this point in the history
Addresses RISDEV-212
  • Loading branch information
zechmeister committed Jan 5, 2024
1 parent bada131 commit 0c27a30
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
15 changes: 14 additions & 1 deletion frontend/src/components/DocumentUnitTexts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { computed } from "vue"
import { Texts } from "../domain/documentUnit"
import TextEditor from "../shared/components/input/TextEditor.vue"
import { texts as textsFields } from "@/fields/caselaw"
import TextAreaInput from "@/shared/components/input/TextAreaInput.vue"
import TextInput from "@/shared/components/input/TextInput.vue"
const props = defineProps<{ texts: Texts }>()
Expand All @@ -18,6 +20,7 @@ const data = computed(() =>
label: item.label,
aria: item.label,
value: props.texts[item.name as keyof Texts],
fieldType: item.fieldType,
}
}),
)
Expand All @@ -34,13 +37,23 @@ const data = computed(() =>
}}</label>

<TextEditor
v-if="item.fieldType == TextAreaInput"
:id="item.id"
:aria-label="item.aria"
class="outline outline-2 outline-blue-900"
class="ml-2 pl-2 outline outline-2 outline-blue-900"
editable
:value="item.value"
@update-value="emit('updateValue', [item.id, $event])"
/>

<TextInput
v-if="item.fieldType == TextInput"
:id="item.id"
:aria-label="item.aria"
:model-value="item.value"
size="medium"
@update:model-value="emit('updateValue', [item.id, $event as string])"
/>
</div>
</div>
</div>
Expand Down
27 changes: 17 additions & 10 deletions frontend/src/fields/caselaw/textFields.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
function defineTextEntry(name: string, label: string) {
return { name, label }
import TextAreaInput from "@/shared/components/input/TextAreaInput.vue"
import TextInput from "@/shared/components/input/TextInput.vue"

function defineTextEntry(
name: string,
label: string,
fieldType: typeof TextInput | typeof TextAreaInput,
) {
return { name, label, fieldType }
}
export const texts = [
defineTextEntry("decisionName", "Entscheidungsname"),
defineTextEntry("headline", "Titelzeile"),
defineTextEntry("guidingPrinciple", "Leitsatz"),
defineTextEntry("headnote", "Orientierungssatz"),
defineTextEntry("tenor", "Tenor"),
defineTextEntry("reasons", "Gründe"),
defineTextEntry("caseFacts", "Tatbestand"),
defineTextEntry("decisionReasons", "Entscheidungsgründe"),
defineTextEntry("decisionName", "Entscheidungsname", TextInput),
defineTextEntry("headline", "Titelzeile", TextAreaInput),
defineTextEntry("guidingPrinciple", "Leitsatz", TextAreaInput),
defineTextEntry("headnote", "Orientierungssatz", TextAreaInput),
defineTextEntry("tenor", "Tenor", TextAreaInput),
defineTextEntry("reasons", "Gründe", TextAreaInput),
defineTextEntry("caseFacts", "Tatbestand", TextAreaInput),
defineTextEntry("decisionReasons", "Entscheidungsgründe", TextAreaInput),
]

0 comments on commit 0c27a30

Please sign in to comment.