Finish bootstrapping list_detail

This commit is contained in:
Scot Hacker 2018-03-20 00:09:52 -07:00
parent 3be7ea7745
commit 998b53463d
8 changed files with 89 additions and 92 deletions

View file

@ -54,11 +54,11 @@
</tr>
</table>
<p><input type="submit" class="todo-button" name="add_task" value="Submit"></p>
<p><input type="submit" class="btn btn-primary" name="add_task" value="Submit"></p>
{% endcomment %}
{{ form.as_p }}
<p><input type="submit" class="todo-button" name="add_task" value="Submit"></p>
<p><input type="submit" class="btn btn-primary" name="add_task" value="Submit"></p>
</form>
{% endblock %}

View file

@ -2,6 +2,7 @@
{% load staticfiles %}
{% block extrahead %}
<!-- CSS and JavaScript for django-todo -->
<!-- CSS and JavaScripts for django-todo -->
<link rel="stylesheet" type="text/css" href="{% static 'todo/css/styles.css' %}" />
{% endblock extrahead %}

View file

@ -1,32 +1,33 @@
{% extends "todo/base.html" %}
{% block title %}Delete list{% endblock %}
{% block content %}
{% if user.is_staff %}
<h1>Delete entire list: {{ task_list.name }} ?</h1>
{% if user.is_staff %}
<h1>Delete entire list: {{ task_list.name }} ?</h1>
<p>Category tally:</p>
<p>Category tally:</p>
<ul>
<li>Incomplete: {{ item_count_undone }} </li>
<li>Complete: {{ item_count_done }} </li>
<li>
<strong>Total: {{ item_count_total }}</strong>
</li>
</ul>
<ul>
<li>Incomplete: {{ item_count_undone }} </li>
<li>Complete: {{ item_count_done }} </li>
<li><strong>Total: {{ item_count_total }}</strong> </li>
</ul>
<p> ... all of which will be irretrievably
<strong>blown away</strong>. Are you sure you want to do that?</p>
<p> ... all of which will be irretrievably <strong>blown away</strong>. Are you sure you want to do that?</p>
<form action="" method="post" accept-charset="utf-8">
{% csrf_token %}
<input type="hidden" name="task_list" value="{{ task_list.id }}">
<p>
<a href="{% url 'todo:list_detail' task_list.id task_list.slug %}" class="btn btn-success">Return to list: {{ task_list.name }}</a>
<input type="submit" name="delete-confirm" value="Do it! &rarr;" class="btn btn-danger">
</p>
</form>
<form action="" method="post" accept-charset="utf-8">
{% csrf_token %}
<input type="hidden" name="task_list" value="{{ task_list.id }}">
<p><input type="submit" name="delete-confirm" value="Do it! &rarr;" class="todo-button"> </p>
</form>
<a href="{% url 'todo:list_detail' task_list.id task_list.slug %}">Return to list: {{ task_list.name }}</a>
{% else %}
<p>Sorry, you don't have permission to delete lists. Please contact your group administrator.</p>
{% endif %}
{% endblock %}
{% else %}
<p>Sorry, you don't have permission to delete lists. Please contact your group administrator.</p>
{% endif %} {% endblock %}

View file

@ -0,0 +1,8 @@
{% if list_slug != "mine" %} {% if view_completed %}
<a href="{% url 'todo:list_detail' list_id list_slug %}" class="btn btn-sm btn-warning">View incomplete tasks</a>
{% else %}
<a href="{% url 'todo:list_detail_completed' list_id list_slug %}" class="btn btn-sm btn-info">View completed tasks</a>
{% endif %}
<a href="{% url 'todo:del_list' list_id list_slug %}" class="btn btn-sm btn-danger">Delete this list</a>
{% endif %}

View file

@ -57,7 +57,7 @@
<h1>Tasks assigned to me (in all groups)</h1>
{% else %}
<h1>{{ view_completed|yesno:"Completed tasks, Tasks" }} in "{{ task_list.name }}"</h1>
<p>This list belongs to group {{ task_list.group }}</p>
<p><small><i>In workgroup "{{ task_list.group }}" - drag rows to set priorities.</i></small></p>
{% endif %}
<form action="" name="show_tasks" method="post">
@ -77,10 +77,12 @@
{% for task in items %}
<tr id="{{ task.id }}">
<td>
<input type="checkbox" name="toggle_done_tasks" value="{{ task.id }}" id="{{ task.id }}">
<input type="checkbox" name="toggle_done_tasks"
value="{{ task.id }}" id="{{ task.id }}"
{% if task.completed %}checked{% endif %}>
</td>
<td>
<a href="{% url 'todo:task_detail' task.id %}">{{ task.title|truncatewords:20 }}</a>
<a href="{% url 'todo:task_detail' task.id %}">{{ task.title|truncatewords:10 }}</a>
</td>
<td>
{{ task.created_date|date:"m/d/Y" }}
@ -108,24 +110,14 @@
</tr>
{% endfor %}
</table>
<p>
<small><i>Drag rows to set priorities</i></small>
</p>
<p><input type="submit" name="process_tasks" value="Continue..." class="todo-button"></p>
<input type="submit" name="process_tasks" value="Process selection" class="btn btn-sm btn-success">
{% include 'todo/include/toggle_delete.html' %}
</form>
{% else %}
<h4>No items on this list yet (add one!)</h4>
{% endif %}
{% if list_slug != "mine" %}
{% if view_completed %}
<p><a href="{% url 'todo:list_detail' list_id list_slug %}">View incomplete tasks</a></p>
{% else %}
<p><a href="{% url 'todo:list_detail_completed' list_id list_slug %}">View completed tasks</a></p>
{% endif %}
<p><a class="todo" href="{% url 'todo:del_list' list_id list_slug %}">Delete this list</a></p>
{% include 'todo/include/toggle_delete.html' %}
{% endif %}

View file

@ -1,28 +1,26 @@
{% extends "todo/base.html" %}
{% block title %}{{ list_title }} Todo Lists{% endblock %}
{% block content %}
<h1>Todo Lists</h1>
<h1>Todo Lists</h1>
<p>{{ item_count }} items in {{ list_count }} list{{ list_count|pluralize }}</p>
<p>{{ item_count }} items in {{ list_count }} list{{ list_count|pluralize }}</p>
{% regroup lists by group as section_list %}
{% for group in section_list %}
<h3>Group: {{ group.grouper }}</h3>
<ul class="list-group">
{% for item in group.list %}
<li class="list-group-item d-flex justify-content-between align-items-center">
<a href="{% url 'todo:list_detail' item.id item.slug %}">{{ item.name }}</a>
<span class="badge badge-primary badge-pill">{{ item.item_set.count }}</span>
</li>
{% endfor %}
</ul>
{% endfor %}
{% regroup lists by group as section_list %}
{% for group in section_list %}
<h3>Group: {{ group.grouper }}</h3>
<ul class="list-group">
{% for item in group.list %}
<li class="list-group-item d-flex justify-content-between align-items-center">
<a href="{% url 'todo:list_detail' item.id item.slug %}">{{ item.name }}</a>
<span class="badge badge-primary badge-pill">{{ item.item_set.count }}</span>
</li>
{% endfor %}
</ul>
{% endfor %}
<div class="mt-3"><a href="{% url 'todo:add_list' %}" class="btn btn-primary">Create new todo list</a></div>
<div class="mt-3">
<a href="{% url 'todo:add_list' %}" class="btn btn-primary">Create new todo list</a>
</div>
{% endblock %}

View file

@ -1,33 +1,30 @@
{% extends "todo/base.html" %}
{% block title %}Search results{% endblock %}
{% block content_title %}
<h2 class="page_title">Search</h2>
{% endblock %}
{% block content_title %}<h2 class="page_title">Search</h2>{% endblock %}
{% block content %}
{% if found_items %}
<h2>{{found_items.count}} search results for term: "{{ query_string }}"</h2>
<div class="post_list">
{% for f in found_items %}
<p><strong><a href="{% url 'todo:task_detail' f.id %}">{{ f.title }}</a></strong><br />
<span class="minor">
In list:
<a href="{% url 'todo:list_detail' f.task_list.id f.task_list.slug %}">
{{ f.task_list.name }}
</a>
<br />
Assigned to:
{% if f.assigned_to %}{{ f.assigned_to }}{% else %}Anyone{% endif %}
(created by: {{ f.created_by }})
<br />
Complete: {{ f.completed|yesno:"Yes,No" }}
</span>
</p>
{% endfor %}
</div>
{% else %}
<h2> No results to show, sorry.</h2>
{% endif %}
{% if found_items %}
<h2>{{found_items.count}} search results for term: "{{ query_string }}"</h2>
<div class="post_list">
{% for f in found_items %}
<p>
<strong>
<a href="{% url 'todo:task_detail' f.id %}">{{ f.title }}</a>
</strong>
<br />
<span class="minor">
In list:
<a href="{% url 'todo:list_detail' f.task_list.id f.task_list.slug %}">
{{ f.task_list.name }}
</a>
<br /> Assigned to: {% if f.assigned_to %}{{ f.assigned_to }}{% else %}Anyone{% endif %} (created by: {{ f.created_by }})
<br /> Complete: {{ f.completed|yesno:"Yes,No" }}
</span>
</p>
{% endfor %}
</div>
{% else %}
<h2> No results to show, sorry.</h2>
{% endif %}
{% endblock %}

View file

@ -87,14 +87,14 @@
</tr>
</table>
<p><input type="submit" class="todo-button" name="edit_task" value="Edit task"></p>
<p><input type="submit" class="btn btn-primary" name="edit_task" value="Edit task"></p>
</div>
<hr/>
<h3>Add comment</h3>
<textarea name="comment-body"></textarea>
<p><input class="todo-button" type="submit" value="Submit"></p>
<p><input class="btn btn-primary" type="submit" value="Submit"></p>
</form>