jedna kategoria dla listy

This commit is contained in:
Mateusz Gruszczyński
2025-08-13 22:36:16 +02:00
parent ee40ee101c
commit 82c84b5ce6
6 changed files with 31 additions and 19 deletions

View File

@@ -78,6 +78,6 @@ class Config:
"Spożywcze,Budowlane,Zabawki,Chemia,Inne,Elektronika,Odzież i obuwie,"
"Artykuły biurowe,Kosmetyki i higiena,Motoryzacja,Ogród i rośliny,"
"Zwierzęta,Sprzęt sportowy,Książki i prasa,Narzędzia i majsterkowanie,"
"RTV / AGD,Apteka i suplementy,Artykuły dekoracyjne,Gry i hobby,Usługi,Pieczywo"
"RTV / AGD,Apteka i suplementy,Artykuły dekoracyjne,Gry i hobby,Usługi,Pieczywo,Różne"
).split(",") if c.strip()
]

View File

@@ -319,17 +319,6 @@ input.form-control {
}
}
.ts-control {
background-color: #212529 !important;
color: #fff !important;
border: 1px solid #495057 !important;
}
.ts-dropdown {
background-color: #212529 !important;
color: #fff !important;
z-index: 9999 !important;
}
.ts-dropdown .active {
background-color: #495057 !important;
@@ -348,7 +337,7 @@ input.form-control {
}
.pagination-dark .page-item.active .page-link {
background-color: #0d6efd; /* primary */
background-color: #0d6efd;
border-color: #0d6efd;
color: #fff;
}
@@ -358,3 +347,22 @@ input.form-control {
border-color: #495057;
color: #6c757d;
}
.tom-dark .ts-control {
background-color: #212529 !important;
color: #fff !important;
border: 1px solid #495057 !important;
}
.ts-dropdown {
background-color: #212529 !important;
color: #fff !important;
z-index: 9999 !important;
}
.tom-dark .ts-control .item {
background-color: #343a40 !important;
color: #fff !important;
border-radius: 0.25rem;
padding: 2px 8px;
}

View File

@@ -1,8 +1,8 @@
document.addEventListener("DOMContentLoaded", function () {
new TomSelect("#categories", {
plugins: ['remove_button'],
maxItems: 4,
placeholder: 'Wybierz kategorie...',
maxItems: 1,
placeholder: 'Wybierz jedną kategorie...',
create: false,
sortField: {
field: "text",

View File

@@ -81,7 +81,9 @@
<div class="mb-4">
<label class="form-label">Kategorie</label>
<select id="categories" name="categories" multiple>
<select id="categories" name="categories"
class="form-select tom-dark bg-dark text-white border-secondary rounded">
<option value=""> brak </option>
{% for cat in categories %}
<option value="{{ cat.id }}" {% if cat.id in selected_categories %}selected{% endif %}>
{{ cat.name }}

View File

@@ -32,7 +32,7 @@
<td>{{ lst.created_at.strftime('%Y-%m-%d') }}</td>
<td style="min-width: 220px;">
<select name="categories_{{ lst.id }}" multiple
class="form-select bg-dark text-white border-secondary">
class="form-select tom-dark bg-dark text-white border-secondary rounded">
{% for cat in categories %}
<option value="{{ cat.id }}" {% if cat in lst.categories %}selected{% endif %}>
{{ cat.name }}

View File

@@ -64,8 +64,10 @@
<label class="form-check-label" for="is_archived">Zarchiwizowana</label>
</div>
<label for="title" class="form-label">Kategorie</label>
<select id="categories" name="categories" multiple>
<label for="title" class="form-label">Kategoria</label>
<select id="categories" name="categories"
class="form-select tom-dark bg-dark text-white border-secondary rounded">
<option value=""> brak </option>
{% for cat in categories %}
<option value="{{ cat.id }}" {% if cat.id in selected_categories %}selected{% endif %}>
{{ cat.name }}