Skip to content

Commit

Permalink
The setting of slug on the create-course page: ensure that the input …
Browse files Browse the repository at this point in the history
…is url-safe
  • Loading branch information
YiranDuan721 committed Nov 27, 2023
1 parent e94f526 commit 2b5bca6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions web/template/admin/admin_tabs/create-course.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
<h2 class="mb-0">Find your course from TUMOnline</h2>
<form id="createCourseForm" aria-haspopup="listbox" class="grid gap-3 mt-3">
<div class="flex space-x-1">
<input class="w-full box-border rounded px-4 py-3 mt-3 focus:outline-none border-0 bg-gray-50 w-full dark:bg-gray-600 dark:text-white"
type="search" autocomplete="off" placeholder="Search" x-model="searchQuery"
<label for="search-course" class="hidden">Search Course</label>
<input class="w-full box-border rounded px-4 py-3 mt-3 focus:outline-none border-0 bg-gray-50 dark:bg-gray-600 dark:text-white"
id="search-course" type="search" autocomplete="off" placeholder="Search" x-model="searchQuery"
@change="fetch('/api/searchCourse?q='+searchQuery).then(r=>r.json()).then(r => searchResults=r)"
@keyup="fetch('/api/searchCourse?q='+searchQuery).then(r=>r.json()).then(r => searchResults=r)"
@focus="isSearchResultVisible = true"
Expand Down Expand Up @@ -47,7 +48,8 @@
x-model="slug"
required
placeholder="eidi"
:class="slug === '' ? 'border-red-500 focus:border-red-500' : ''"/>
:class="slug === '' ? 'border-red-500 focus:border-red-500' : ''"
@input="slug = slug.replace(/[^A-Za-z0-9\-_.+()~]/g, '')"/>
</div>
{{template "semester-selection"}}
</form>
Expand Down

0 comments on commit 2b5bca6

Please sign in to comment.