Push navigation into a single place, so that the navigation experience is consistent regardless of which views (public vs staff) the user lands on. Closes GH-52, thanks to kotowicz.

This commit is contained in:
Ross Poulton 2011-04-28 21:00:11 +10:00
parent 592ec09916
commit f3bd5da906
3 changed files with 31 additions and 25 deletions

View File

@ -43,26 +43,7 @@
<div id='container'>
<div id='header'>
<h1>{% trans "Helpdesk" %}</h1>
<ul id="dropdown">
<li><a href='{% url helpdesk_dashboard %}'>{% trans "Dashboard" %}</a></li>
<li><a href='{% url helpdesk_list %}'>{% trans "Tickets" %}</a></li>
<li><a href='{% url helpdesk_submit %}'>{% trans "New Ticket" %}</a></li>
<li><a href='{% url helpdesk_report_index %}'>{% trans "Stats" %}</a></li>
{% if user_saved_queries_ %}
<li class="headerlink"><a>Load Saved Query</a>
<ul>
{% for q in user_saved_queries_ %}
<li><a href="{% url helpdesk_list %}?saved_query={{ q.id }}">{{ q.title }}
{% if q.shared %}
(Shared{% ifnotequal user q.user %} by {{ q.user.username }}{% endifnotequal %})
{% endif %}</a></li>
{% endfor %}
</ul>
</li>
{% endif %}
<li><a href='{% url logout %}'>{% trans "Logout" %}</a></li>
{% if not query %}<li><form id='searchform' method='get' action='{% url helpdesk_list %}'><input type='text' name='q' size='10' class='input' value='{% trans "Search..." %}' id='search_query' onFocus='s=document.getElementById("search_query");if (s.value == "{% trans "Search..." %}") { s.value = ""; }' title='{% trans "Enter a keyword, or a ticket number to jump straight to that ticket." %}'/><input type='hidden' name='status' value='1' /><input type='hidden' name='status' value='2' /><input type='hidden' name='status' value='3' /><input type='hidden' name='search_type' value='header' />{% csrf_token %}</form></li>{% endif %}
</ul>
{% include "helpdesk/navigation.html" %}
</div>
<div id='body'>

View File

@ -0,0 +1,29 @@
{% load i18n %}
{% if user.is_staff %}
<ul id="dropdown">
<li><a href='{% url helpdesk_dashboard %}'>{% trans "Dashboard" %}</a></li>
<li><a href='{% url helpdesk_list %}'>{% trans "Tickets" %}</a></li>
<li><a href='{% url helpdesk_submit %}'>{% trans "New Ticket" %}</a></li>
<li><a href='{% url helpdesk_report_index %}'>{% trans "Stats" %}</a></li>
{% if user_saved_queries_ %}
<li class="headerlink"><a>Load Saved Query</a>
<ul>
{% for q in user_saved_queries_ %}
<li><a href="{% url helpdesk_list %}?saved_query={{ q.id }}">{{ q.title }}
{% if q.shared %}
(Shared{% ifnotequal user q.user %} by {{ q.user.username }}{% endifnotequal %})
{% endif %}</a></li>
{% endfor %}
</ul>
</li>
{% endif %}
<li><a href='{% url logout %}'>{% trans "Logout" %}</a></li>
{% if not query %}<li><form id='searchform' method='get' action='{% url helpdesk_list %}'><input type='text' name='q' size='10' class='input' value='{% trans "Search..." %}' id='search_query' onFocus='s=document.getElementById("search_query");if (s.value == "{% trans "Search..." %}") { s.value = ""; }' title='{% trans "Enter a keyword, or a ticket number to jump straight to that ticket." %}'/><input type='hidden' name='status' value='1' /><input type='hidden' name='status' value='2' /><input type='hidden' name='status' value='3' /><input type='hidden' name='search_type' value='header' />{% csrf_token %}</form></li>{% endif %}
</ul>
{% else %}
<ul>
<li><a href='{% url helpdesk_home %}'>{% trans "Submit A Ticket" %}</a></li>
<li><a href='{% url helpdesk_kb_index %}'>{% trans "Knowledgebase" %}</a></li>
<li><a href='{% url login %}?next={% url helpdesk_dashboard %}'>{% trans "Log In" %}</a></li>
</ul>
{% endif %}

View File

@ -9,11 +9,7 @@
<div id='container'>
<div id='header'>
<h1>{% trans "Helpdesk" %}</h1>
<ul>
<li><a href='{% url helpdesk_home %}'>{% trans "Submit A Ticket" %}</a></li>
<li><a href='{% url helpdesk_kb_index %}'>{% trans "Knowledgebase" %}</a></li>
<li><a href='{% url login %}?next={% url helpdesk_dashboard %}'>{% trans "Log In" %}</a></li>
</ul>
{% include "helpdesk/navigation.html" %}
</div>
<div id='body'>
{% block helpdesk_body %}{% endblock %}