Merge pull request #237 from brente/user-menu

User menu
This commit is contained in:
Ross Poulton 2014-07-26 20:30:44 +10:00
commit d38240e3cb
4 changed files with 30 additions and 43 deletions

View File

@ -26,7 +26,7 @@
.goog-te-banner-frame {display: none !important;}
.goog-te-balloon-frame {display: none !important;}
/* hide google translate tooltips (generated for every translated item) */
.goog-tooltip {display: none !important; }
.goog-tooltip {display: none !important; }
</style>
<style type="text/css">
@ -61,7 +61,6 @@
<div class="col-md-2">{% include "helpdesk/attribution.html" %}</div>
<div class="col-md-2"><a href='{% url 'helpdesk_rss_index' %}'><img src='{{ STATIC_URL }}helpdesk/rss_icon.png' width='14' height='14' alt='{% trans "RSS Icon" %}' title='{% trans "RSS Feeds" %}' border='0' />{% trans "RSS Feeds" %}</a></div>
<div class="col-md-2"><a href='{% url 'helpdesk_api_help' %}'>{% trans "API" %}</a></div>
<div class="col-md-2"><a href='{% url 'helpdesk_user_settings' %}'>{% trans "User Settings" %}</a></div>
{% if user.is_superuser %}<div class="col-md-2"><a href='{% url 'helpdesk_system_settings' %}'>{% trans "System Settings" %}</a></div>{% endif %}
</div>
</div>

View File

@ -21,22 +21,30 @@
<li><a href='{% url 'helpdesk_kb_index' %}'><span class="glyphicon glyphicon-tree-deciduous"></span><span class="nav-text">{% trans "Knowledgebase" %}</span></a></li>
{% endif %}
{% if user_saved_queries_ %}
<li class="headerlink dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#"><span class="glyphicon glyphicon-filter"></span><span class="nav-text"> {% trans "Saved Query" %} <b class="caret"></b></span></a>
<ul class="dropdown-menu">
{% 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>
<li class="headerlink dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#"><span class="glyphicon glyphicon-filter"></span><span class="nav-text"> {% trans "Saved Query" %} <b class="caret"></b></span></a>
<ul class="dropdown-menu">
{% 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' %}'><span class="glyphicon glyphicon-log-out"></span><span class="nav-text">{% trans "Logout" %} ({{ user.username }})</span></a></li>
<li class="headerlink dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#"><span class="glyphicon glyphicon-user"></span><span class="nav-text"> {{ user.get_full_name|default:user.username }} <b class="caret"></b></span></a>
<ul class="dropdown-menu">
<li><a href='{% url 'helpdesk_user_settings' %}'>{% trans "User Settings" %}</a></li>
{% if helpdesk_settings.HELPDESK_SHOW_CHANGE_PASSWORD and user.has_usable_password %}
<li><a href='{% url 'auth_password_change' %}'>{% trans "Change password" %}</a></li>
{% endif %}
<li class="divider"></li>
<li><a href='{% url 'logout' %}'>{#<span class="glyphicon glyphicon-log-out"></span> #}{% trans "Logout" %}</a></li>
</ul>
</li>
</ul>
{% if not query %}
<form class="navbar-form navbar-left" id='searchform' method='get' action="{% url 'helpdesk_list' %}">
<div class="input-group">
<input type='text' name='q' size='15' class='input form-control' placeholder='{% trans "Search..." %}' id='search_query' title='{% trans "Enter a keyword, or a ticket number to jump straight to that ticket." %}'/>
@ -48,7 +56,6 @@
</span>
</div>
</form>
{% endif %}
{% else %}
{# Public menu #}

View File

@ -1,32 +1,20 @@
{% extends "helpdesk/base.html" %}{% load i18n %}{% load url from future %}
{% extends "helpdesk/base.html" %}{% load i18n bootstrap %}{% load url from future %}
{% block helpdesk_title %}{% trans "Change User Settings" %}{% endblock %}
{% block helpdesk_body %}
{% if show_password_change_link %}
{% url 'auth_password_change' as password_change_url %}
<h2>Change Password</h2>
<p>
Change your password <a href="{{ password_change_url }}" title="change your password">here</a>.
</p>
{% endif %}
{% blocktrans %}
<h2>User Settings</h2>
<p>Use the following options to change the way your helpdesk system works for you. These settings do not impact any other user.</p>
{% endblocktrans %}
<form method='post' action='./'>
<fieldset>
<dl>{% for field in form %}
<dt><label for='id_{{ field.name }}'>{{ field.label }}</label></dt>
<dd>{{ field }}</dd>
{% if field.errors %}<dd class='error'>{{ field.errors }}</dd>{% endif %}
{% if field.help_text %}<dd class='form_help_text'>{{ field.help_text }}</dd>{% endif %}
{% endfor %}</dl>
</fieldset>
<input class="btn btn-primary" type='submit' value='{% trans "Save Options" %}' />
{% csrf_token %}</form>
<form role="form" method='post' action='./'>
{% csrf_token %}
{{ form|bootstrap }}
<div class="form-group">
<input class="btn btn-primary" type='submit' value='{% trans "Save Options" %}' />
</div>
</form>
{% endblock %}
{% endblock %}

View File

@ -1163,16 +1163,9 @@ def user_settings(request):
else:
form = UserSettingsForm(s.settings)
user = User.objects.get(id = request.user.id)
show_password_change_link = 0
# we don't want non-local users to see the 'change password' link.
if helpdesk_settings.HELPDESK_SHOW_CHANGE_PASSWORD and user.has_usable_password():
show_password_change_link = 1
return render_to_response('helpdesk/user_settings.html',
RequestContext(request, {
'form': form,
'show_password_change_link': show_password_change_link,
}))
user_settings = staff_member_required(user_settings)