mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-06-23 19:11:30 +02:00
Fix num_to_link error, was leaving off a letter of text if next to the ID, to address #511
This commit is contained in:
parent
9fd170f707
commit
c8ee3815ec
@ -39,7 +39,7 @@ def num_to_link(text):
|
|||||||
if ticket:
|
if ticket:
|
||||||
style = ticket.get_status_display()
|
style = ticket.get_status_display()
|
||||||
text = "%s <a href='%s' class='ticket_link_status ticket_link_status_%s'>#%s</a>%s" % (
|
text = "%s <a href='%s' class='ticket_link_status ticket_link_status_%s'>#%s</a>%s" % (
|
||||||
text[:match.start()], url, style, match.groups()[0], text[match.end():])
|
text[:match.start()+1], url, style, match.groups()[0], text[match.end():])
|
||||||
return mark_safe(text)
|
return mark_safe(text)
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
@ -125,6 +125,7 @@ class TicketActionsTestCase(TestCase):
|
|||||||
|
|
||||||
def test_num_to_link(self):
|
def test_num_to_link(self):
|
||||||
"""Test that we are correctly expanding links to tickets from IDs"""
|
"""Test that we are correctly expanding links to tickets from IDs"""
|
||||||
|
|
||||||
# make staff user
|
# make staff user
|
||||||
self.loginUser()
|
self.loginUser()
|
||||||
|
|
||||||
@ -141,7 +142,10 @@ class TicketActionsTestCase(TestCase):
|
|||||||
|
|
||||||
# generate the URL text
|
# generate the URL text
|
||||||
result = num_to_link('this is ticket#%s' % ticket_id)
|
result = num_to_link('this is ticket#%s' % ticket_id)
|
||||||
self.assertEqual(result, "this is ticke <a href='/helpdesk/tickets/%s/' class='ticket_link_status ticket_link_status_Open'>#%s</a>" % (ticket_id, ticket_id))
|
self.assertEqual(result, "this is ticket <a href='/helpdesk/tickets/%s/' class='ticket_link_status ticket_link_status_Open'>#%s</a>" % (ticket_id, ticket_id))
|
||||||
|
|
||||||
|
result2 = num_to_link('whoa another ticket is here #%s huh' % ticket_id)
|
||||||
|
self.assertEqual(result2, "whoa another ticket is here <a href='/helpdesk/tickets/%s/' class='ticket_link_status ticket_link_status_Open'>#%s</a> huh" % (ticket_id, ticket_id))
|
||||||
|
|
||||||
def test_create_ticket_getform(self):
|
def test_create_ticket_getform(self):
|
||||||
self.loginUser()
|
self.loginUser()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user