Skip to content

Commit

Permalink
Set the border of text fields to red, if it should be filled but is not.
Browse files Browse the repository at this point in the history
  • Loading branch information
YiranDuan721 committed Nov 27, 2023
1 parent f61c02b commit e94f526
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions web/template/admin/admin_tabs/create-course.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
<h2>Manually enter Infos:</h2>
<div class="flex space-x-1">
<label for="name" class="hidden">Course Title</label>
<input class="w-4/5 tl-input !ml-0" id="name" name="name" type="text"
<input class="w-4/5 tl-input border !ml-0" id="name" name="name" type="text"
autocomplete="off"
placeholder="Einführung in die Informatik (IN0001)"
x-model="title"
required
:class="title === '' ? 'border-red-500 focus:border-red-500' : ''"/>
<label for="slug" class="hidden">Slug</label>
<input class="w-1/5 tl-input" id="slug" name="slug" type="text" x-ref="slug"
<input class="w-1/5 tl-input border" id="slug" name="slug" type="text" x-ref="slug"
autocomplete="off"
x-model="slug"
required
Expand Down
12 changes: 9 additions & 3 deletions web/template/partial/course/manage/semester-selection.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,21 @@
<option value="Sommersemester">Sommersemester</option>
</select>
<label for="year" class="hidden">teachingTermYear</label>

<div class="flex">
<input id="year" x-model="year" name="year" class="w-32 tl-input"
:class="year === '' ? 'border-red-500 focus:border-red-500' : ''" placeholder="2022" type="number">
<input id="year" x-model="year" x-data="{initialYear: 2022}" name="year" class="w-32 tl-input border"
:class="year === '' ? 'border-red-500 focus:border-red-500' : ''"
:placeholder="year === '' ? initialYear : ''"
type="number"
@focus="if (year === '') year = initialYear">
<template x-if="semester === 'Wintersemester'">
<div class="flex">
<span class="mx-2 my-auto text-3">/</span>
<label for="yearW" class="hidden">teachingTermYearW</label>
<input id="yearW" x-model="yearW" name="yearW" class="w-16 tl-input"
:class="yearW === '' ? 'border-red-500 focus:border-red-500' : ''" placeholder="23" type="text" readonly disabled>
:class="yearW === '' ? 'border-red-500 focus:border-red-500' : ''"
:placeholder="year === '' ? '23' : ''"
type="text" readonly disabled>
</div>
</template>
</div>
Expand Down

0 comments on commit e94f526

Please sign in to comment.