Browse Source

Redesign task list pages

devel
Dmitry Novikov 8 years ago
parent
commit
a41a8311a2
  1. 5
      systemd_units/djing.timer
  2. 7
      taskapp/locale/ru/LC_MESSAGES/django.po
  3. 37
      taskapp/templates/taskapp/tasklist.html
  4. 37
      taskapp/templates/taskapp/tasklist_all.html
  5. 20
      taskapp/templatetags/tasktags.py

5
systemd_units/djing.timer

@ -1,10 +1,9 @@
[Unit]
Description=Run every 30 minutes a job for djing
Description=Run every night a job for djing
[Timer]
OnCalendar=*-*-* *:30:00
OnCalendar=*-*-* 01:59:00
Persistent=true
RandomizedDelaySec=300
Unit=djing.service
[Install]

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

@ -387,3 +387,10 @@ msgstr "Нет интернета"
msgid "Expired timeout -%(time_left)s"
msgstr "Время ожидания истекло -%(time_left)s"
msgid "Yesterday"
msgstr "Вчера"
msgid "Today"
msgstr "Сегодня"

37
taskapp/templates/taskapp/tasklist.html

@ -1,18 +1,19 @@
{% extends request.is_ajax|yesno:'nullcont.htm,taskapp/ext.htm' %}
{% load i18n %}
{% load tasktags %}
{% block content %}
<div class="table-responsive">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th class="hidden-xs">#</th>
<th class="col-sm-1">#</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="hidden-xs">{% trans 'Date of create' %}</th>
<th class="col-sm-1">{% trans 'Actions' %}</th>
</tr>
</thead>
@ -22,18 +23,21 @@
{% if task.is_relevant %}
<tr class="text-muted">
{% else %}
{% if task.priority == 'E' %}
<tr class="success">
{% elif task.priority == 'C' %}
<tr>
{% endif %}
<td class="hidden-xs">
<a href="{% url 'taskapp:view' task.pk %}">
{% if not task.is_relevant %}
{% if task.priority == 'E' %}
<span class="glyphicon glyphicon-ok-circle text-success"></span>
{% elif task.priority == 'A' %}
<tr class="danger">
{% else %}
<tr>
<span class="glyphicon glyphicon-exclamation-sign text-danger"></span>
{% endif %}
{% endif %}
<td class="hidden-xs"><a href="{% url 'taskapp:view' task.pk %}">{{ task.pk }}</a></td>
{{ task.pk }}
</a>
</td>
{% if task.abon and task.abon.group %}
<td><a href="{% url 'abonapp:abon_home' task.abon.group.pk task.abon.pk %}" title="{{ task.abon.description|default:'' }}" data-toggle="tooltip">{{ task.abon.get_full_name }}</a></td>
@ -52,7 +56,18 @@
{% trans 'Author does not exist' %}
{% endif %}
</td>
<td class="hidden-xs">{{ task.time_of_create|date:'d E H:i' }}</td>
<td class="hidden-xs">
{% is_today task.time_of_create as is_timecreate_is_today %}
{% is_yesterday task.time_of_create as is_timecreate_is_yesterday %}
{% if is_timecreate_is_today %}
{% trans 'Today' %} {{ task.time_of_create|date:'H:i' }}
{% elif is_timecreate_is_yesterday %}
{% trans 'Yesterday' %} {{ task.time_of_create|date:'H:i' }}
{% else %}
{{ task.time_of_create|date:'d E H:i' }}
{% endif %}
</td>
<td class="btn-group btn-group-xs btn-group-justified">
<a href="{% url 'taskapp:finish' task.pk %}" class="btn btn-success" data-toggle="tooltip" title="{% trans 'Complete' %}">

37
taskapp/templates/taskapp/tasklist_all.html

@ -1,5 +1,6 @@
{% extends request.is_ajax|yesno:'bajax.html,base.html' %}
{% load i18n %}
{% load tasktags %}
{% block main %}
<ol class="breadcrumb">
@ -18,8 +19,8 @@
<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 hidden-xs">#</th>
<th class="col-sm-2">{% 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-3">{% trans 'Description' %}</th>
@ -35,18 +36,21 @@
{% if task.is_relevant %}
<tr class="text-muted">
{% else %}
{% if task.priority == 'E' %}
<tr class="success">
{% elif task.priority == 'C' %}
<tr>
{% endif %}
<td class="hidden-xs">
<a href="{% url 'taskapp:view' task.pk %}">
{% if not task.is_relevant %}
{% if task.priority == 'E' %}
<span class="glyphicon glyphicon-ok-circle text-success"></span>
{% elif task.priority == 'A' %}
<tr class="danger">
{% else %}
<tr>
<span class="glyphicon glyphicon-exclamation-sign text-danger"></span>
{% endif %}
{% endif %}
<td class="hidden-xs"><a href="{% url 'taskapp:view' task.pk %}">{{ task.pk }}</a></td>
{{ task.pk }}
</a>
</td>
{% if task.abon and task.abon.group %}
<td><a href="{% url 'abonapp:abon_home' task.abon.group.pk task.abon.pk %}">{{ task.abon.get_full_name }}</a></td>
@ -67,7 +71,18 @@
{% endif %}
</td>
<td>{{ task.get_state_display }}</td>
<td class="hidden-xs">{{ task.time_of_create|date:'d E H:i' }}</td>
<td class="hidden-xs">
{% is_today task.time_of_create as is_timecreate_is_today %}
{% is_yesterday task.time_of_create as is_timecreate_is_yesterday %}
{% if is_timecreate_is_today %}
{% trans 'Today' %} {{ task.time_of_create|date:'H:i' }}
{% elif is_timecreate_is_yesterday %}
{% trans 'Yesterday' %} {{ task.time_of_create|date:'H:i' }}
{% else %}
{{ task.time_of_create|date:'d E H:i' }}
{% endif %}
</td>
<td class="btn-group btn-group-sm btn-group-justified">
{% if perms.taskapp.change_task %}

20
taskapp/templatetags/tasktags.py

@ -0,0 +1,20 @@
from datetime import datetime
from django import template
register = template.Library()
@register.simple_tag
def is_today(time):
if type(time) is not datetime:
raise TypeError
now = datetime.now()
return now.day == time.day
@register.simple_tag
def is_yesterday(time):
if type(time) is not datetime:
raise TypeError
now = datetime.now()
return now.day - 1 == time.day
Loading…
Cancel
Save