Merge pull request #1147 from timthelion/webhooks-3

Fixes for my-tickets view and public ticket view
This commit is contained in:
Christopher Broderick 2023-12-06 22:12:20 +00:00 committed by GitHub
commit 82653806c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 13 deletions

View File

@ -83,12 +83,13 @@ class PublicTicketListingSerializer(serializers.ModelSerializer):
status = serializers.SerializerMethodField()
queue = serializers.SerializerMethodField()
kbitem = serializers.SerializerMethodField()
secret_key = serializers.CharField(read_only=True)
class Meta:
model = Ticket
# fields = '__all__'
fields = ('ticket', 'id', 'title', 'queue', 'status',
'created', 'due_date', 'submitter', 'kbitem')
'created', 'due_date', 'submitter', 'kbitem', 'secret_key')
def get_queue(self, obj):
return {"title": obj.queue.title, "id": obj.queue.id}

View File

@ -73,7 +73,13 @@ table.ticket-stats tbody th, table.ticket-stats tbody tr {padding-left: 20px}
padding-top: 0;
}
#ticket-description {background-color: #FCF8E3;}
.followup.well {background-color: #f4f5ff;}
.followup.well {
background-color: #f4f5ff;
}
.followup {
padding: 20px;
margin: 30px;
}
/*
Add your custom styles here
*/

View File

@ -7,17 +7,17 @@
<table class="table table-striped" id="ticketsTable">
<thead>
<tr>
<th>Title</th>
<th>Queue</th>
<th>Status</th>
<th>Created</th>
<th>{% trans "Title" %}</th>
<th>{% trans "Queue" %}</th>
<th>{% trans "Status" %}</th>
<th>{% trans "Created" %}</th>
</tr>
</thead>
<tbody>
<!-- Rows will be added here dynamically using jQuery -->
</tbody>
</table>
<nav aria-label="Page navigation">
<nav aria-label="{% trans 'Page navigation' %}">
<ul class="pagination" id="pagination">
<!-- Pagination buttons will be added here dynamically -->
</ul>
@ -37,7 +37,7 @@ window.addEventListener('load', function()
data.results.forEach(function(ticket) {
$('#ticketsTable tbody').append(`
<tr>
<td><a href="/view/?ticket=${ticket.id}&email=${ticket.submitter}">${ticket.title}</a></td>
<td><a href="/view/?ticket=${ticket.id}&email=${ticket.submitter}&key=${ticket.secret_key}">${ticket.title}</a></td>
<td>${ticket.queue.title}</td>
<td>${ticket.status}</td>
<td>${ticket.created}</td>

View File

@ -5,11 +5,18 @@
{% block helpdesk_body %}
<table class="table table-hover table-bordered table-striped">
<caption>{{ ticket.ticket }} . {{ ticket.title }} [{{ ticket.get_status }}]</caption>
<thead>
<tr><th colspan='2'>{% blocktrans with ticket.queue as queue_name %}Queue: {{ queue_name }}{% endblocktrans %}</th></tr>
<tr>
<th colspan="2">
<capiton>
{{ ticket.ticket }} . {{ ticket.title }} [{{ ticket.get_status }}]
</capiton>
</th>
</tr>
</thead>
<tbody>
<tr><th>{% blocktrans with ticket.queue as queue_name %}Queue</th>
<td>{{ queue_name }}{% endblocktrans %}</td></tr>
<tr>
<th>{% trans "Submitted On" %}</th>
<td>{{ ticket.created|date:"DATETIME_FORMAT" }} ({{ ticket.created|naturaltime }})</td>
@ -66,8 +73,8 @@
<h3>{% trans "Follow-Ups" %}</h3>
{% load ticket_to_link %}
{% for followup in ticket.followup_set.public_followups %}
<div class='followup well'>
<div class='title'>{{ followup.title }} <span class='byline text-info'>{% if followup.user %}by {{ followup.user }}{% endif %} <span title='{{ followup.date|date:"DATETIME_FORMAT" }}'>{{ followup.date|naturaltime }}</span></span></div>
<div class='followup well card'>
<p><b>{{ followup.title }} <span class='byline text-info'>{% if followup.user %}by {{ followup.user }}{% endif %} <span title='{{ followup.date|date:"DATETIME_FORMAT" }}'>{{ followup.date|naturaltime }}</span></span></b></p>
{{ followup.comment|force_escape|urlizetrunc:50|num_to_link|linebreaksbr }}
{% if followup.ticketchange_set.all %}<div class='changes'><ul>
{% for change in followup.ticketchange_set.all %}
@ -152,7 +159,7 @@
</fieldset>
<button class="btn btn-primary btn-lg" type='submit'>{% trans "Update This Ticket" %}</button>
<button class="btn btn-primary btn-lg" style="margin-bottom:10px" type='submit'>{% trans "Update This Ticket" %}</button>
{% csrf_token %}</form>