dropdown menu for saved queries - removes previously used div.

This commit is contained in:
Andreas Kotowicz 2011-02-05 22:31:12 +01:00
parent 613b2fc132
commit b40d4511a3

View File

@ -12,57 +12,63 @@
<link rel='alternate' href='{% url helpdesk_rss "user" %}{{ user.username }}/' type='application/rss+xml' title='{% trans "My Open Tickets" %}' />
<link rel='alternate' href='{% url helpdesk_rss "recent_activity" %}' type='application/rss+xml' title='{% trans "All Recent Activity" %}' />
<link rel='alternate' href='{% url helpdesk_rss "unassigned" %}' type='application/rss+xml' title='{% trans "Unassigned Tickets" %}' />
<script type="text/javascript">
$(document).ready(function(){
// hide queryloadheader div by default
$("#queryloadheader").hide();
// toggle the event
$("#toggle_query").click(function(){
}).toggle( function() {
$("#queryloadheader").show();
}, function() {
$("#queryloadheader").hide();
});
// replace display while hovering over menu item
$('li.headerlink').hover(
function() { $('ul', this).css('display', 'block'); },
function() { $('ul', this).css('display', 'none'); });
});
</script>
<style type="text/css">
/* header */
#dropdown li.headerlink { width: auto; float: left; text-align: center; }
/* query list */
#dropdown li.headerlink ul { display: none;
text-align: left;
position: absolute;
padding: 5px;
z-index: 2; }
/* query entries */
#dropdown li.headerlink:hover ul { display: block; width: auto; }
#dropdown li.headerlink:hover ul li { padding: 5px; margin: 1px; float: none; display: block; }
</style>
{% block helpdesk_head %}{% endblock %}
</head>
<body>
<div id='container'>
<div id='header'>
<h1>{% trans "Helpdesk" %}</h1>
<ul>
<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><a href="#queryloadheader" id="toggle_query">Load Saved Query</a></li>
<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>
</div>
{% if user_saved_queries_ %}
<div id="queryloadheader" style="float:right; padding: 20px; background:#ECF1EF; ">
<form method='get' action='{% url helpdesk_list %}'>
<label for='id_query_selector'>{% trans "Query" %}</label> <select name='saved_query' id='id_query_selector' />
{% for q in user_saved_queries_ %}
<option value='{{ q.id }}'>{{ q.title }}{% if q.shared %} (Shared{% ifnotequal user q.user %} by {{ q.user.username }}{% endifnotequal %}){% endif %}</option>
{% endfor %}
</select>
<input type='submit' value='{% trans "Run Query" %}'>
{% csrf_token %}</form>
</div>
{% endif %}
<div id='body'>
{% block helpdesk_body %}{% endblock %}
</div>
<div id='footer'>
<p>{% trans "Powered by <a href='https://github.com/rossp/django-helpdesk'>django-helpdesk</a>." %} {% if user.is_staff %}{% load svn_revision %}{% helpdesk_svn_revision %}{% endif %} <a href='{% url helpdesk_rss_index %}'><img src='{{ MEDIA_URL }}helpdesk/rss_icon.png' width='14' height='14' alt='{% trans "RSS Icon" %}' title='{% trans "RSS Feeds" %}' border='0' />{% trans "RSS Feeds" %}</a> <a href='{% url helpdesk_api_help %}'>{% trans "API" %}</a> <a href='{% url helpdesk_user_settings %}'>{% trans "User Settings" %}</a> {% if user.is_superuser %}<a href='{% url helpdesk_system_settings %}'>{% trans "System Settings" %}</a>{% endif %}</p>
</div>