Strict tags option & css changes
This commit is contained in:
parent
2364277c1a
commit
a482be8883
@ -55,6 +55,10 @@ class TicketListApiView(generics.ListAPIView):
|
||||
ordering_fields = ["create_timestamp", "edit_timestamp"]
|
||||
|
||||
def get_queryset(self):
|
||||
strict_tags = self.request.query_params.get("strict-tags")
|
||||
if not strict_tags:
|
||||
return self.queryset
|
||||
|
||||
tag_uuids = self.request.query_params.getlist("tags", [])
|
||||
queryset = self.queryset
|
||||
|
||||
|
@ -26,7 +26,7 @@ class TicketAdmin(admin.ModelAdmin):
|
||||
|
||||
class TicketPriorityAdmin(admin.ModelAdmin):
|
||||
|
||||
list_display = ["uuid", "title", "colour", "backgroundcolour", "get_used_count"]
|
||||
list_display = ["uuid", "title", "colour", "backgroundcolour", "order", "get_used_count"]
|
||||
|
||||
@admin.display(description="Used by")
|
||||
def get_used_count(self, obj):
|
||||
@ -35,7 +35,7 @@ class TicketPriorityAdmin(admin.ModelAdmin):
|
||||
|
||||
class TicketTagAdmin(admin.ModelAdmin):
|
||||
|
||||
list_display = ["uuid", "title", "colour", "backgroundcolour", "get_used_count"]
|
||||
list_display = ["uuid", "title", "colour", "backgroundcolour", "order", "get_used_count"]
|
||||
|
||||
@admin.display(description="Used by")
|
||||
def get_used_count(self, obj):
|
||||
|
@ -8,7 +8,7 @@
|
||||
"author": "21b457a1-b64a-4499-8c53-0e2f3b42fe3c",
|
||||
"priority": "0ebc194c-b856-4e4f-9def-cd190d1e8d43",
|
||||
"create_timestamp": "2024-01-09T00:11:40Z",
|
||||
"edit_timestamp": "2024-01-16T15:53:48.787Z",
|
||||
"edit_timestamp": "2024-01-03T15:53:48.787Z",
|
||||
"tags": [
|
||||
"0ac68e5d-9000-4fcb-bb44-40b1b0faaa2b",
|
||||
"72fb255c-132f-4124-802d-f4c051620540",
|
||||
@ -25,7 +25,7 @@
|
||||
"author": "248bc1ef-df52-445e-847c-e370dccf436a",
|
||||
"priority": "d140a5be-cf24-4250-8b38-31338e69dffd",
|
||||
"create_timestamp": "2024-01-09T00:09:20Z",
|
||||
"edit_timestamp": "2024-01-16T15:53:31.535Z",
|
||||
"edit_timestamp": "2023-06-29T15:53:31.535Z",
|
||||
"tags": [
|
||||
"0ac68e5d-9000-4fcb-bb44-40b1b0faaa2b",
|
||||
"72fb255c-132f-4124-802d-f4c051620540",
|
||||
@ -42,7 +42,7 @@
|
||||
"author": "9f469a37-4d8d-4bd0-ba4e-16b07549f42a",
|
||||
"priority": "d140a5be-cf24-4250-8b38-31338e69dffd",
|
||||
"create_timestamp": "2024-01-09T00:05:54Z",
|
||||
"edit_timestamp": "2024-01-16T15:53:18.994Z",
|
||||
"edit_timestamp": "2024-01-13T15:53:18.994Z",
|
||||
"tags": [
|
||||
"0ac68e5d-9000-4fcb-bb44-40b1b0faaa2b",
|
||||
"28b160b5-5c8b-43a5-84d1-4179bde87e6f",
|
||||
|
@ -132,6 +132,17 @@ body {
|
||||
|
||||
.ticket-item .ticket-item-complex .badge {
|
||||
width: 1.8rem;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.ticket-item .ticket-item-complex .badge:hover .ticket-item-complex-expand,
|
||||
.ticket-item .ticket-item-complex .badge .ticket-item-complex-expand:hover {
|
||||
width: fit-content;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
|
||||
}
|
||||
|
||||
.ticket-item .ticket-item-icon {
|
||||
|
@ -7,4 +7,9 @@ $("#themeToggle").on("click", function() {
|
||||
else {
|
||||
$("body").attr("data-bs-theme", "light");
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
// Activate all tooltips
|
||||
$('[data-bs-toggle="tooltip"]').tooltip();
|
||||
});
|
@ -1,4 +1,4 @@
|
||||
var filters = {"ordering": "-edit_timestamp"};
|
||||
var filters = {"ordering": "-edit_timestamp", "strict-tags": true};
|
||||
global_loadingTickets = false;
|
||||
searchTimeout = null;
|
||||
pagination = {};
|
||||
@ -222,6 +222,14 @@ function changeItemsPage(next) {
|
||||
loadTicketItems(page);
|
||||
}
|
||||
|
||||
$("#strictTags").on("change", function() {
|
||||
const strictTags = $(this).prop("checked");
|
||||
if (strictTags) filters["strict-tags"] = strictTags;
|
||||
else delete filters["strict-tags"];
|
||||
|
||||
loadTicketItems();
|
||||
});
|
||||
|
||||
function loadTicketItems(page=1) {
|
||||
|
||||
if (global_loadingTickets) {
|
||||
@ -288,24 +296,25 @@ function loadTicketItems(page=1) {
|
||||
});
|
||||
|
||||
var priorityElem = template.find(".ticket-item-priority");
|
||||
// priorityElem.text(ticket.priority.title);
|
||||
priorityElem.css("color", ticket.priority.colour);
|
||||
priorityElem.css("background-color", ticket.priority.backgroundcolour);
|
||||
// priorityElem.attr("data-bs-title", ticket.priority.title);
|
||||
// priorityElem.attr("data-bs-toggle", "tooltip");
|
||||
// priorityElem.tooltip();
|
||||
|
||||
var departmentElem = template.find(".ticket-item-department");
|
||||
departmentElem.addClass("bgc-orange-100 c-orange-700")
|
||||
departmentElem.css("color", ticket.author.department.colour);
|
||||
departmentElem.css("background-color", ticket.author.department.backgroundcolour);
|
||||
// departmentElem.attr("data-bs-title", ticket.author.department.title);
|
||||
// departmentElem.attr("data-bs-toggle", "tooltip");
|
||||
// departmentElem.tooltip();
|
||||
|
||||
// // Add the priority using the badge template
|
||||
// var priorityTemplate = $($("#ticketContentBadgeTemplate").html());
|
||||
// priorityTemplate.find(".ticket-content-badge-text").text(ticket.priority.title + " Priority");
|
||||
// priorityTemplate.css({ "color": ticket.priority.colour, "background-color": ticket.priority.backgroundcolour });
|
||||
// priorityTemplate.removeClass("rounded-pill").addClass("rounded-1");
|
||||
// template.find(".ticket-item-priority").append(priorityTemplate);
|
||||
|
||||
// Add the content to the interface
|
||||
$("#ticketsContainer .content").append(template);
|
||||
});
|
||||
|
||||
$("body").tooltip();
|
||||
|
||||
// Make tickets clickable
|
||||
applyTicketClickFunction();
|
||||
|
||||
|
@ -130,7 +130,7 @@
|
||||
<span>{{ department.title }}</span>
|
||||
</div>
|
||||
<div class="peer">
|
||||
<span class="badge rounded-pill bg-secondary-subtle text-secondary-emphasis">0</span> <!-- bgc-green-50 c-green-700 -->
|
||||
<span class="badge rounded-pill" style="color: {{ department.colour }}; background-color: {{ department.backgroundcolour }};">0</span>
|
||||
</div>
|
||||
</div>
|
||||
</label>
|
||||
@ -405,10 +405,13 @@
|
||||
<!-- Ticket Item Template -->
|
||||
<script id="ticketItemTemplate" type="text/template">
|
||||
<div class="ticket-item fxw-nw bdB peers fxw-nw p-20 w-100" data-uuid="-1">
|
||||
<div class="ticket-item-complex peer mR-20 d-flex flex-column align-items-center align-self-stretch">
|
||||
<div class="ticket-item-complex peer mR-20 d-flex flex-column align-items-center align-self-stretch pos-r">
|
||||
<img src="" alt="" class="ticket-item-icon">
|
||||
<div class="ticket-item-department badge rounded mt-auto">
|
||||
<i class="fa fa-users"></i>
|
||||
<div class="ticket-item-complex-expand">
|
||||
THis is a TEST
|
||||
</div>
|
||||
</div>
|
||||
<div class="ticket-item-priority badge rounded mt-2">
|
||||
<i class="fa fa-folder"></i>
|
||||
|
Loading…
x
Reference in New Issue
Block a user