Browse Source

Shows empty tasks

devel
bashmak 8 years ago
parent
commit
290e39e342
  1. 9
      taskapp/locale/ru/LC_MESSAGES/django.po
  2. 6
      taskapp/templates/taskapp/ext.htm
  3. 8
      taskapp/templates/taskapp/footer_btns.html
  4. 91
      taskapp/templates/taskapp/tasklist_empty.html
  5. 5
      taskapp/templates/taskapp/tasklist_failed.html
  6. 1
      taskapp/urls.py
  7. 7
      taskapp/views.py

9
taskapp/locale/ru/LC_MESSAGES/django.po

@ -462,3 +462,12 @@ msgstr "Имя и количество комментов"
msgid "None"
msgstr "Нету"
msgid "View empty tasks"
msgstr "Задачи без получателей"
msgid "Tasks in which no recipients"
msgstr "Задачи, в которых нет получателей"
msgid "Tasks in which was trouble while at runtime"
msgstr "Задачи в которых возникли проблемы во время выполнения"

6
taskapp/templates/taskapp/ext.htm

@ -7,11 +7,13 @@
<li class="active">{% trans 'Tasks' %}</li>
</ol>
{% include 'message_block.html' %}
<div class="page-header">
<h2>{% trans 'Tasks to be performed' %}</h2>
<h2>{% block pagetitle %}
{% trans 'Tasks to be performed' %}
{% endblock %}
</h2>
</div>
<ul class="nav nav-tabs">

8
taskapp/templates/taskapp/footer_btns.html

@ -1,14 +1,16 @@
{% load i18n %}
<div class="btn-group btn-group-sm">
{% if perms.taskapp.add_task %}
<a href="{% url 'taskapp:add' %}" class="btn btn-sm btn-success">
<a href="{% url 'taskapp:add' %}" class="btn btn-success">
<span class="glyphicon glyphicon-plus"></span> {% trans 'Add new task' %}
</a>
{% endif %}
{% if perms.taskapp.can_viewall %}
<a href="{% url 'taskapp:all_tasks' %}" class="btn btn-sm btn-info">
<a href="{% url 'taskapp:all_tasks' %}" class="btn btn-info">
<span class="glyphicon glyphicon-baby-formula"></span> {% trans 'View all tasks' %}
</a>
{% endif %}
<a href="{% url 'taskapp:empty_tasks' %}" class="btn btn-default">
<span class="glyphicon glyphicon-eye-close"></span> {% trans 'View empty tasks' %}
</a>
</div>

91
taskapp/templates/taskapp/tasklist_empty.html

@ -0,0 +1,91 @@
{% extends request.is_ajax|yesno:'nullcont.htm,taskapp/ext.htm' %}
{% load i18n %}
{% block pagetitle %}
{% trans 'Tasks in which no recipients' %}
{% endblock %}
{% block content %}
<div class="table-responsive">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th class="hidden-xs">#</th>
<th class="col-sm-3">{% trans 'Name' %}</th>
<th class="col-sm-1">{% trans 'Address' %}</th>
<th class="col-sm-1">{% trans 'The nature of the damage' %}</th>
<th class="col-sm-4">{% trans 'Description' %}</th>
<th class="col-sm-1">{% trans 'Task author' %}</th>
<th class="col-sm-1 hidden-xs">{% trans 'Date of create' %}</th>
<th class="col-sm-1">{% trans 'Actions' %}</th>
</tr>
</thead>
<tbody>
{% with has_change_task=perms.taskapp.change_task %}
{% for task in tasks %}
{% if task.is_relevant %}
<tr class="text-muted">
{% else %}
{% if task.priority == 'E' %}
<tr class="success">
{% elif task.priority == 'C' %}
<tr>
{% elif task.priority == 'A' %}
<tr class="danger">
{% else %}
<tr>
{% endif %}
{% endif %}
<td class="hidden-xs"><a href="{% url 'taskapp:edit' task.pk %}">{{ task.pk }}</a></td>
{% if task.abon and task.abon.group %}
<td><a href="{% url 'abonapp:abon_home' task.abon.group.pk task.abon.username %}">{{ task.abon.get_full_name }}</a></td>
<td>{{ task.abon.group.title }}, {{ task.abon.street|default:_('Not assigned') }} {{ task.abon.house|default:_('Not assigned') }}</td>
{% else %}
<td>{% trans 'User does not exist' %}</td>
<td>---</td>
{% endif %}
<td>{{ task.get_mode_display }}</td>
<td>{{ task.descr }}</td>
<td>
{% if task.author %}
<a href="{% url 'acc_app:other_profile' task.author.pk %}" data-toggle="tooltip"
title="{{ task.author.get_full_name }}">{{ task.author.username }}</a>
{% else %}
{% trans 'Not assigned' %}
{% endif %}
</td>
<td class="hidden-xs">{{ task.time_of_create|date:'d E H:i' }}</td>
<td>
{% if has_change_task %}
<a href="{% url 'taskapp:edit' task.pk %}" class="btn btn-default" title="{% trans 'Edit' %}" data-toggle="tooltip">
<span class="glyphicon glyphicon-edit"></span>
</a>
{% endif %}
</td>
</tr>
{% empty %}
<tr>
<td colspan="8">{% trans 'The list is empty' %}</td>
</tr>
{% endfor %}
{% endwith %}
</tbody>
<tfoot>
<tr>
<td colspan="8">
{% include 'taskapp/footer_btns.html' %}
</td>
</tr>
</tfoot>
</table>
</div>
{% include 'pagination.html' %}
{% endblock %}

5
taskapp/templates/taskapp/tasklist_failed.html

@ -1,5 +1,10 @@
{% extends request.is_ajax|yesno:'nullcont.htm,taskapp/ext.htm' %}
{% load i18n %}
{% block pagetitle %}
{% trans 'Tasks in which was trouble while at runtime' %}
{% endblock %}
{% block content %}
<div class="table-responsive">

1
taskapp/urls.py

@ -21,5 +21,6 @@ urlpatterns = [
url(r'^own$', views.OwnTaskListView.as_view(), name='own_tasks'),
url(r'^my$', views.MyTaskListView.as_view(), name='my_tasks'),
url(r'^all$', views.AllTasksListView.as_view(), name='all_tasks'),
url(r'^empty$', views.EmptyTasksListView.as_view(), name='empty_tasks'),
url(r'^check_news$', views.check_news, name='check_news')
]

7
taskapp/views.py

@ -91,6 +91,13 @@ class AllTasksListView(BaseTaskListView):
.select_related('abon', 'abon__street', 'abon__group', 'author')
class EmptyTasksListView(NewTasksView):
template_name = 'taskapp/tasklist_empty.html'
def get_queryset(self):
return Task.objects.annotate(reccount=Count('recipients')).filter(reccount__lt=1)
@login_required
@permission_required('taskapp.delete_task')
def task_delete(request, task_id):

Loading…
Cancel
Save