mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-03-04 18:22:58 +01:00
new option 'HELPDESK_SHOW_EDIT_BUTTON_FOLLOW_UP' which allows superusers to delete individual followups (so you don't have to go to the admin).
This commit is contained in:
parent
11283741a2
commit
a2a5b10b2d
@ -85,6 +85,9 @@ HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE = getattr(settings, 'HELPDESK_ALLOW_NON_S
|
|||||||
# show edit buttons in ticket follow ups.
|
# show edit buttons in ticket follow ups.
|
||||||
HELPDESK_SHOW_EDIT_BUTTON_FOLLOW_UP = getattr(settings, 'HELPDESK_SHOW_EDIT_BUTTON_FOLLOW_UP', True)
|
HELPDESK_SHOW_EDIT_BUTTON_FOLLOW_UP = getattr(settings, 'HELPDESK_SHOW_EDIT_BUTTON_FOLLOW_UP', True)
|
||||||
|
|
||||||
|
# show delete buttons in ticket follow ups if user is 'superuser'
|
||||||
|
HELPDESK_SHOW_DELETE_BUTTON_SUPERUSER_FOLLOW_UP = getattr(settings, 'HELPDESK_SHOW_DELETE_BUTTON_SUPERUSER_FOLLOW_UP', False)
|
||||||
|
|
||||||
# show ticket edit button on top of ticket description.
|
# show ticket edit button on top of ticket description.
|
||||||
HELPDESK_SHOW_EDIT_BUTTON_TICKET_TOP = getattr(settings, 'HELPDESK_SHOW_EDIT_BUTTON_TICKET_TOP', True)
|
HELPDESK_SHOW_EDIT_BUTTON_TICKET_TOP = getattr(settings, 'HELPDESK_SHOW_EDIT_BUTTON_TICKET_TOP', True)
|
||||||
|
|
||||||
|
@ -74,6 +74,9 @@ function googleTranslateElementInit() {
|
|||||||
<a href="{% url helpdesk_followup_edit ticket.id followup.id %}" class='followup-edit'><img width="60" height="15" title="Edit" alt="Edit" src="{{ STATIC_URL }}helpdesk/buttons/edit.png"></a>
|
<a href="{% url helpdesk_followup_edit ticket.id followup.id %}" class='followup-edit'><img width="60" height="15" title="Edit" alt="Edit" src="{{ STATIC_URL }}helpdesk/buttons/edit.png"></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if user.is_superuser and helpdesk_settings.HELPDESK_SHOW_DELETE_BUTTON_SUPERUSER_FOLLOW_UP %}
|
||||||
|
<a href="{% url helpdesk_followup_delete ticket.id followup.id %}" class='followup-edit'><img width="60" height="15" title="Delete" alt="Delete" src="{{ STATIC_URL }}helpdesk/buttons/delete.png"></a>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class='followup'>
|
<div class='followup'>
|
||||||
@ -84,6 +87,9 @@ function googleTranslateElementInit() {
|
|||||||
<a href="{% url helpdesk_followup_edit ticket.id followup.id %}" class='followup-edit'><img width="60" height="15" title="Edit" alt="Edit" src="{{ STATIC_URL }}helpdesk/buttons/edit.png"></a>
|
<a href="{% url helpdesk_followup_edit ticket.id followup.id %}" class='followup-edit'><img width="60" height="15" title="Edit" alt="Edit" src="{{ STATIC_URL }}helpdesk/buttons/edit.png"></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if user.is_superuser and helpdesk_settings.HELPDESK_SHOW_DELETE_BUTTON_SUPERUSER_FOLLOW_UP %}
|
||||||
|
<a href="{% url helpdesk_followup_delete ticket.id followup.id %}" class='followup-edit'><img width="60" height="15" title="Delete" alt="Delete" src="{{ STATIC_URL }}helpdesk/buttons/delete.png"></a>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<span class='followup-desc'>{% if followup.comment %}{{ followup.comment|force_escape|urlizetrunc:50|num_to_link|linebreaksbr }}{% endif %}</span>
|
<span class='followup-desc'>{% if followup.comment %}{{ followup.comment|force_escape|urlizetrunc:50|num_to_link|linebreaksbr }}{% endif %}</span>
|
||||||
|
@ -41,6 +41,10 @@ urlpatterns = patterns('helpdesk.views.staff',
|
|||||||
'followup_edit',
|
'followup_edit',
|
||||||
name='helpdesk_followup_edit'),
|
name='helpdesk_followup_edit'),
|
||||||
|
|
||||||
|
url(r'^tickets/(?P<ticket_id>[0-9]+)/followup_delete/(?P<followup_id>[0-9]+)/$',
|
||||||
|
'followup_delete',
|
||||||
|
name='helpdesk_followup_delete'),
|
||||||
|
|
||||||
url(r'^tickets/(?P<ticket_id>[0-9]+)/edit/$',
|
url(r'^tickets/(?P<ticket_id>[0-9]+)/edit/$',
|
||||||
'edit_ticket',
|
'edit_ticket',
|
||||||
name='helpdesk_edit'),
|
name='helpdesk_edit'),
|
||||||
|
@ -139,7 +139,7 @@ def delete_ticket(request, ticket_id):
|
|||||||
return HttpResponseRedirect(reverse('helpdesk_home'))
|
return HttpResponseRedirect(reverse('helpdesk_home'))
|
||||||
delete_ticket = staff_member_required(delete_ticket)
|
delete_ticket = staff_member_required(delete_ticket)
|
||||||
|
|
||||||
def followup_edit(request, ticket_id, followup_id, ):
|
def followup_edit(request, ticket_id, followup_id):
|
||||||
"Edit followup options with an ability to change the ticket."
|
"Edit followup options with an ability to change the ticket."
|
||||||
followup = get_object_or_404(FollowUp, id=followup_id)
|
followup = get_object_or_404(FollowUp, id=followup_id)
|
||||||
ticket = get_object_or_404(Ticket, id=ticket_id)
|
ticket = get_object_or_404(Ticket, id=ticket_id)
|
||||||
@ -179,8 +179,21 @@ def followup_edit(request, ticket_id, followup_id, ):
|
|||||||
attachment.followup = new_followup
|
attachment.followup = new_followup
|
||||||
attachment.save()
|
attachment.save()
|
||||||
# delete old followup
|
# delete old followup
|
||||||
followup.delete()
|
followup.delete()
|
||||||
return HttpResponseRedirect(reverse('helpdesk_view', args=[ticket.id]))
|
return HttpResponseRedirect(reverse('helpdesk_view', args=[ticket.id]))
|
||||||
|
|
||||||
|
|
||||||
|
def followup_delete(request, ticket_id, followup_id):
|
||||||
|
''' followup delete for superuser'''
|
||||||
|
|
||||||
|
ticket = get_object_or_404(Ticket, id=ticket_id)
|
||||||
|
if not request.user.is_superuser:
|
||||||
|
return HttpResponseRedirect(reverse('helpdesk_view', args=[ticket.id]))
|
||||||
|
|
||||||
|
followup = get_object_or_404(FollowUp, id=followup_id)
|
||||||
|
followup.delete()
|
||||||
|
return HttpResponseRedirect(reverse('helpdesk_view', args=[ticket.id]))
|
||||||
|
|
||||||
|
|
||||||
def view_ticket(request, ticket_id):
|
def view_ticket(request, ticket_id):
|
||||||
ticket = get_object_or_404(Ticket, id=ticket_id)
|
ticket = get_object_or_404(Ticket, id=ticket_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user