only show template-dropdown when templates available
authorPhiTux <redacted>
Mon, 6 Oct 2025 17:14:37 +0000 (19:14 +0200)
committerPhiTux <redacted>
Mon, 6 Oct 2025 17:14:37 +0000 (19:14 +0200)
frontend/src/lib/TemplateDropdown.svelte

index 9763edbf13085aa839550b15738c796d19215249..5e623a258ce8737647c6eaad2c053260cf8b98c2 100644 (file)
@@ -5,18 +5,20 @@
        const { t } = getTranslate();
 </script>
 
-<select
-       bind:value={$insertTemplate}
-       class="form-select form-select-sm"
-       aria-label="Select template"
->
-       <option value="" disabled>{$t('template.dropdown_insert')}</option>
-       {#each $templates as template}
-               <option value={template.text}>
-                       {template.name}
-               </option>
-       {/each}
-</select>
+{#if $templates.length > 0}
+       <select
+               bind:value={$insertTemplate}
+               class="form-select form-select-sm"
+               aria-label="Select template"
+       >
+               <option value="" disabled>{$t('template.dropdown_insert')}</option>
+               {#each $templates as template}
+                       <option value={template.text}>
+                               {template.name}
+                       </option>
+               {/each}
+       </select>
+{/if}
 
 <style>
        .form-select {
git clone https://git.99rst.org/PROJECT