hide "log in" button on '/helpdesk/login/' page.

modify "log in" redirect if possbible, so that user lands on same ticket (instead of dashboard) after login.
This commit is contained in:
Andreas Kotowicz 2011-11-23 19:56:36 +01:00
parent f897d5bcb4
commit 4b0b628724
2 changed files with 8 additions and 2 deletions

View File

@ -28,8 +28,8 @@
<li><a href='{% url helpdesk_home %}'>{% trans "Submit A Ticket" %}</a></li> <li><a href='{% url helpdesk_home %}'>{% trans "Submit A Ticket" %}</a></li>
{% endif %} {% endif %}
{% if helpdesk_settings.HELPDESK_KB_ENABLED %}<li><a href='{% url helpdesk_kb_index %}'>{% trans "Knowledgebase" %}</a></li>{% endif %} {% if helpdesk_settings.HELPDESK_KB_ENABLED %}<li><a href='{% url helpdesk_kb_index %}'>{% trans "Knowledgebase" %}</a></li>{% endif %}
{% if not helpdesk_settings.HELPDESK_REDIRECT_TO_LOGIN_BY_DEFAULT or user.is_authenticated %} {% if not request.path == '/helpdesk/login/' or user.is_authenticated %}
<li>{% if user.is_authenticated %}<a href='{% url logout %}'>{% trans "Logout" %}</a>{% else %}<a href='{% url login %}?next={% url helpdesk_dashboard %}'>{% trans "Log In" %}</a>{% endif %}</li> <li>{% if user.is_authenticated %}<a href='{% url logout %}'>{% trans "Logout" %}</a>{% else %}<a href='{% url login %}?next={% if next %}{{ next|escape }}{% else %}{% url helpdesk_dashboard %}{% endif %}'>{% trans "Log In" %}</a>{% endif %}</li>
{% endif %} {% endif %}
</ul> </ul>
{% endif %} {% endif %}

View File

@ -111,10 +111,16 @@ def view_ticket(request):
return update_ticket(request, ticket_id, public=True) return update_ticket(request, ticket_id, public=True)
# redirect user back to this ticket if possible.
redirect_url = ''
if helpdesk_settings.HELPDESK_NAVIGATION_ENABLED:
redirect_url = reverse('helpdesk_view', args=[ticket_id])
return render_to_response('helpdesk/public_view_ticket.html', return render_to_response('helpdesk/public_view_ticket.html',
RequestContext(request, { RequestContext(request, {
'ticket': ticket, 'ticket': ticket,
'helpdesk_settings': helpdesk_settings, 'helpdesk_settings': helpdesk_settings,
'next': redirect_url,
})) }))
return render_to_response('helpdesk/public_view_form.html', return render_to_response('helpdesk/public_view_form.html',