Skip to content

Commit 99c34eb

Browse files
committed
Fix edit category suggestions by sharing datalist across modals
1 parent 420eb15 commit 99c34eb

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

frontend/src/app/components/resources/resources.component.html

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -234,16 +234,9 @@ <h2 class="text-lg sm:text-xl font-bold text-white">Add a resource</h2>
234234
<div class="grid gap-3 sm:gap-4 md:grid-cols-2">
235235
<input [(ngModel)]="title" type="text" placeholder="Resource title"
236236
class="w-full rounded-lg border border-gray-700 bg-[#0B0E14] px-3 py-2.5 text-sm focus:outline-none focus:border-indigo-500" />
237-
<input [(ngModel)]="category" type="text" list="resource-category-add-list" placeholder="Choose category"
237+
<input [(ngModel)]="category" type="text" list="resource-category-options" placeholder="Choose category"
238238
class="w-full rounded-lg border border-gray-700 bg-[#0B0E14] px-3 py-2.5 text-sm focus:outline-none focus:border-indigo-500" />
239239
</div>
240-
<datalist id="resource-category-add-list">
241-
@for (categoryOption of categoryOptions(); track categoryOption) {
242-
@if (categoryOption !== 'all') {
243-
<option [value]="categoryOption"></option>
244-
}
245-
}
246-
</datalist>
247240

248241
@if (contributionMode === 'link') {
249242
<input [(ngModel)]="url" type="url" placeholder="https://..."
@@ -297,7 +290,7 @@ <h2 class="text-lg sm:text-xl font-bold text-white">Edit resource</h2>
297290
<div class="grid gap-3 sm:gap-4 md:grid-cols-2">
298291
<input [(ngModel)]="editTitle" type="text" placeholder="Resource title"
299292
class="w-full rounded-lg border border-gray-700 bg-[#0B0E14] px-3 py-2.5 text-sm focus:outline-none focus:border-indigo-500" />
300-
<input [(ngModel)]="editCategory" type="text" list="resource-category-add-list" placeholder="Choose category"
293+
<input [(ngModel)]="editCategory" type="text" list="resource-category-options" placeholder="Choose category"
301294
class="w-full rounded-lg border border-gray-700 bg-[#0B0E14] px-3 py-2.5 text-sm focus:outline-none focus:border-indigo-500" />
302295
</div>
303296

@@ -324,4 +317,12 @@ <h2 class="text-lg sm:text-xl font-bold text-white">Edit resource</h2>
324317
</div>
325318
</div>
326319
}
320+
<datalist id="resource-category-options">
321+
@for (categoryOption of categoryOptions(); track categoryOption) {
322+
@if (categoryOption !== 'all') {
323+
<option [value]="categoryOption"></option>
324+
}
325+
}
326+
</datalist>
327+
327328
</div>

0 commit comments

Comments
 (0)