mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-06-18 23:56:43 +02:00
Merge branch 'master' into template-cleanup
This commit is contained in:
commit
d95aa46b03
@ -17,7 +17,9 @@
|
|||||||
<li><a href='{% url 'helpdesk_list' %}'><span class="glyphicon glyphicon-tags"></span> <span class="nav-text">{% trans "Tickets" %}</span></a></li>
|
<li><a href='{% url 'helpdesk_list' %}'><span class="glyphicon glyphicon-tags"></span> <span class="nav-text">{% trans "Tickets" %}</span></a></li>
|
||||||
<li><a href='{% url 'helpdesk_submit' %}'><span class="glyphicon glyphicon-plus"></span> <span class="nav-text">{% trans "New Ticket" %}</span></a></li>
|
<li><a href='{% url 'helpdesk_submit' %}'><span class="glyphicon glyphicon-plus"></span> <span class="nav-text">{% trans "New Ticket" %}</span></a></li>
|
||||||
<li><a href='{% url 'helpdesk_report_index' %}'><span class="glyphicon glyphicon-stats"></span><span class="nav-text"> {% trans "Stats" %}</span></a></li>
|
<li><a href='{% url 'helpdesk_report_index' %}'><span class="glyphicon glyphicon-stats"></span><span class="nav-text"> {% trans "Stats" %}</span></a></li>
|
||||||
|
{% if helpdesk_settings.HELPDESK_KB_ENABLED %}
|
||||||
<li><a href='{% url 'helpdesk_kb_index' %}'><span class="glyphicon glyphicon-tree-deciduous"></span><span class="nav-text">{% trans "Knowledgebase" %}</span></a></li>
|
<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_ %}
|
{% 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>
|
<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">
|
<ul class="dropdown-menu">
|
||||||
|
@ -8,12 +8,12 @@
|
|||||||
<p>The following items can be maintained by you or other superusers:</p>{% endblocktrans %}
|
<p>The following items can be maintained by you or other superusers:</p>{% endblocktrans %}
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href='../ignore/'>{% trans "E-Mail Ignore list" %}</a></li>
|
<li><a href='{% url 'helpdesk_email_ignore' %}'>{% trans "E-Mail Ignore list" %}</a></li>
|
||||||
<li><a href='{{ ADMIN_URL }}helpdesk/queue/'>{% trans "Maintain Queues" %}</a></li>
|
<li><a href='{% url 'admin:helpdesk_queue_changelist' %}'>{% trans "Maintain Queues" %}</a></li>
|
||||||
<li><a href='{{ ADMIN_URL }}helpdesk/presetreply/'>{% trans "Maintain Pre-Set Replies" %}</a></li>
|
<li><a href='{% url 'admin:helpdesk_presetreply_changelist' %}'>{% trans "Maintain Pre-Set Replies" %}</a></li>
|
||||||
<li><a href='{{ ADMIN_URL }}helpdesk/kbcategory/'>{% trans "Maintain Knowledgebase Categories" %}</a></li>
|
<li><a href='{% url 'admin:helpdesk_kbcategory_changelist' %}'>{% trans "Maintain Knowledgebase Categories" %}</a></li>
|
||||||
<li><a href='{{ ADMIN_URL }}helpdesk/kbitem/'>{% trans "Maintain Knowledgebase Items" %}</a></li>
|
<li><a href='{% url 'admin:helpdesk_kbitem_changelist' %}'>{% trans "Maintain Knowledgebase Items" %}</a></li>
|
||||||
<li><a href='{{ ADMIN_URL }}helpdesk/emailtemplate/'>{% trans "Maintain E-Mail Templates" %}</a></li>
|
<li><a href='{% url 'admin:helpdesk_emailtemplate_changelist' %}'>{% trans "Maintain E-Mail Templates" %}</a></li>
|
||||||
<li><a href='{{ ADMIN_URL }}auth/user/'>{% trans "Maintain Users" %}</a></li>
|
<li><a href='{% url 'admin:auth_user_changelist' %}'>{% trans "Maintain Users" %}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
from helpdesk.tests.ticket_submission import *
|
from helpdesk.tests.ticket_submission import *
|
||||||
from helpdesk.tests.public_actions import *
|
from helpdesk.tests.public_actions import *
|
||||||
|
from helpdesk.tests.navigation import *
|
33
helpdesk/tests/helpers.py
Normal file
33
helpdesk/tests/helpers.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import sys
|
||||||
|
try:
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
except ImportError:
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
else:
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
def get_staff_user(username='helpdesk.staff', password='password'):
|
||||||
|
try:
|
||||||
|
user = User.objects.get(username=username)
|
||||||
|
except User.DoesNotExist:
|
||||||
|
user = User.objects.create_user(username=username, password=password, email='staff@example.com')
|
||||||
|
user.is_staff = True
|
||||||
|
user.save()
|
||||||
|
else:
|
||||||
|
user.set_password(password)
|
||||||
|
user.save()
|
||||||
|
return user
|
||||||
|
|
||||||
|
|
||||||
|
def reload_urlconf(urlconf=None):
|
||||||
|
if urlconf is None:
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
urlconf = settings.ROOT_URLCONF
|
||||||
|
if urlconf in sys.modules:
|
||||||
|
from django.core.urlresolvers import clear_url_caches
|
||||||
|
|
||||||
|
reload(sys.modules[urlconf])
|
||||||
|
clear_url_caches()
|
38
helpdesk/tests/navigation.py
Normal file
38
helpdesk/tests/navigation.py
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from django.core.urlresolvers import reverse
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
from helpdesk.tests.helpers import get_staff_user, reload_urlconf
|
||||||
|
|
||||||
|
|
||||||
|
class TestKBDisabled(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
from helpdesk import settings
|
||||||
|
|
||||||
|
self.HELPDESK_KB_ENABLED = settings.HELPDESK_KB_ENABLED
|
||||||
|
if self.HELPDESK_KB_ENABLED:
|
||||||
|
settings.HELPDESK_KB_ENABLED = False
|
||||||
|
reload_urlconf()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
from helpdesk import settings
|
||||||
|
|
||||||
|
if self.HELPDESK_KB_ENABLED:
|
||||||
|
settings.HELPDESK_KB_ENABLED = True
|
||||||
|
reload_urlconf()
|
||||||
|
|
||||||
|
def test_navigation(self):
|
||||||
|
"""Test proper rendering of navigation.html by accessing the dashboard"""
|
||||||
|
from django.core.urlresolvers import NoReverseMatch
|
||||||
|
|
||||||
|
self.client.login(username=get_staff_user().username, password='password')
|
||||||
|
self.assertRaises(NoReverseMatch, reverse, 'helpdesk_kb_index')
|
||||||
|
try:
|
||||||
|
response = self.client.get(reverse('helpdesk_dashboard'))
|
||||||
|
except NoReverseMatch, e:
|
||||||
|
if 'helpdesk_kb_index' in e.message:
|
||||||
|
self.fail("Please verify any unchecked references to helpdesk_kb_index (start with navigation.html)")
|
||||||
|
else:
|
||||||
|
raise
|
||||||
|
else:
|
||||||
|
self.assertEqual(response.status_code, 200)
|
@ -221,7 +221,6 @@ urlpatterns += patterns('',
|
|||||||
url(r'^help/context/$', TemplateView.as_view(template_name='helpdesk/help_context.html'),
|
url(r'^help/context/$', TemplateView.as_view(template_name='helpdesk/help_context.html'),
|
||||||
name='helpdesk_help_context'),
|
name='helpdesk_help_context'),
|
||||||
|
|
||||||
url(r'^system_settings/$',DirectTemplateView.as_view(template_name='helpdesk/system_settings.html',
|
url(r'^system_settings/$', DirectTemplateView.as_view(template_name='helpdesk/system_settings.html'),
|
||||||
extra_context={'ADMIN_URL': getattr(settings, 'ADMIN_URL', '/admin/')}),
|
|
||||||
name='helpdesk_system_settings'),
|
name='helpdesk_system_settings'),
|
||||||
)
|
)
|
||||||
|
@ -26,6 +26,7 @@ from django.db.models import Q
|
|||||||
from django.http import HttpResponseRedirect, Http404, HttpResponse, HttpResponseForbidden
|
from django.http import HttpResponseRedirect, Http404, HttpResponse, HttpResponseForbidden
|
||||||
from django.shortcuts import render_to_response, get_object_or_404
|
from django.shortcuts import render_to_response, get_object_or_404
|
||||||
from django.template import loader, Context, RequestContext
|
from django.template import loader, Context, RequestContext
|
||||||
|
from django.utils.dates import MONTHS_3
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
from django import forms
|
from django import forms
|
||||||
@ -978,21 +979,7 @@ def run_report(request, report):
|
|||||||
# a second table for more complex queries
|
# a second table for more complex queries
|
||||||
summarytable2 = defaultdict(int)
|
summarytable2 = defaultdict(int)
|
||||||
|
|
||||||
|
month_name = lambda m: MONTHS_3[m].title()
|
||||||
months = (
|
|
||||||
_('Jan'),
|
|
||||||
_('Feb'),
|
|
||||||
_('Mar'),
|
|
||||||
_('Apr'),
|
|
||||||
_('May'),
|
|
||||||
_('Jun'),
|
|
||||||
_('Jul'),
|
|
||||||
_('Aug'),
|
|
||||||
_('Sep'),
|
|
||||||
_('Oct'),
|
|
||||||
_('Nov'),
|
|
||||||
_('Dec'),
|
|
||||||
)
|
|
||||||
|
|
||||||
first_ticket = Ticket.objects.all().order_by('created')[0]
|
first_ticket = Ticket.objects.all().order_by('created')[0]
|
||||||
first_month = first_ticket.created.month
|
first_month = first_ticket.created.month
|
||||||
@ -1005,7 +992,7 @@ def run_report(request, report):
|
|||||||
periods = []
|
periods = []
|
||||||
year, month = first_year, first_month
|
year, month = first_year, first_month
|
||||||
working = True
|
working = True
|
||||||
periods.append("%s %s" % (months[month - 1], year))
|
periods.append("%s %s" % (month_name(month), year))
|
||||||
|
|
||||||
while working:
|
while working:
|
||||||
month += 1
|
month += 1
|
||||||
@ -1014,7 +1001,7 @@ def run_report(request, report):
|
|||||||
month = 1
|
month = 1
|
||||||
if (year > last_year) or (month > last_month and year >= last_year):
|
if (year > last_year) or (month > last_month and year >= last_year):
|
||||||
working = False
|
working = False
|
||||||
periods.append("%s %s" % (months[month - 1], year))
|
periods.append("%s %s" % (month_name(month), year))
|
||||||
|
|
||||||
if report == 'userpriority':
|
if report == 'userpriority':
|
||||||
title = _('User by Priority')
|
title = _('User by Priority')
|
||||||
@ -1080,7 +1067,7 @@ def run_report(request, report):
|
|||||||
|
|
||||||
elif report == 'usermonth':
|
elif report == 'usermonth':
|
||||||
metric1 = u'%s' % ticket.get_assigned_to
|
metric1 = u'%s' % ticket.get_assigned_to
|
||||||
metric2 = u'%s %s' % (months[ticket.created.month - 1], ticket.created.year)
|
metric2 = u'%s %s' % (month_name(ticket.created.month), ticket.created.year)
|
||||||
|
|
||||||
elif report == 'queuepriority':
|
elif report == 'queuepriority':
|
||||||
metric1 = u'%s' % ticket.queue.title
|
metric1 = u'%s' % ticket.queue.title
|
||||||
@ -1092,11 +1079,11 @@ def run_report(request, report):
|
|||||||
|
|
||||||
elif report == 'queuemonth':
|
elif report == 'queuemonth':
|
||||||
metric1 = u'%s' % ticket.queue.title
|
metric1 = u'%s' % ticket.queue.title
|
||||||
metric2 = u'%s %s' % (months[ticket.created.month - 1], ticket.created.year)
|
metric2 = u'%s %s' % (month_name(ticket.created.month), ticket.created.year)
|
||||||
|
|
||||||
elif report == 'daysuntilticketclosedbymonth':
|
elif report == 'daysuntilticketclosedbymonth':
|
||||||
metric1 = u'%s' % ticket.queue.title
|
metric1 = u'%s' % ticket.queue.title
|
||||||
metric2 = u'%s %s' % (months[ticket.created.month - 1], ticket.created.year)
|
metric2 = u'%s %s' % (month_name(ticket.created.month), ticket.created.year)
|
||||||
metric3 = ticket.modified - ticket.created
|
metric3 = ticket.modified - ticket.created
|
||||||
metric3 = metric3.days
|
metric3 = metric3.days
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user