Improvements on the news app. It's not nearly done yet, don't bother playing with it for a while unless you're really curious and want to see ugly, un-refined code :)

This commit is contained in:
Greg Taylor 2007-07-30 20:30:16 +00:00
parent 9db148f98c
commit 648bee599e
8 changed files with 160 additions and 13 deletions

View file

@ -0,0 +1,51 @@
{% extends "base.html" %}
{% block header_ext %}
{% endblock %}
{% block sidebar %}
{{sidebar}}
{% endblock %}
{% block content %}
<h1 id="alt-layout">News Archive</h1>
<strong>Navigation:</strong> <a href="/news/archive/?page=1">First</a> |
{% if has_previous %}
<a href="/news/archive/?page={{previous}}">Prev</a>
{% else %}
Prev
{% endif %}
| <em>{{page}}</em> of <em>{{pages}}</em> pages |
{% if has_next %}
<a href="/news/archive/?page={{next}}">Next</a>
{% else %}
Next
{% endif %}
| <a href="/news/archive/?page={{pages}}">Last</a>
{% for entry in object_list %}
<a href="/news/show/{{entry.id}}" class="newsHeading">{{entry.topic.name}}: {{entry.title}}</a>
<p class="newsDate">By {{entry.author.username}} on {{entry.date_posted|time}}</p>
<p class="newsSummary">{{entry.body|truncatewords:80}}</p>
{% endfor %}
<strong>Navigation:</strong> <a href="/news/archive/?page=1">First</a> |
{% if has_previous %}
<a href="/news/archive/?page={{previous}}">Prev</a>
{% else %}
Prev
{% endif %}
| <em>{{page}}</em> of <em>{{pages}}</em> pages |
{% if has_next %}
<a href="/news/archive/?page={{next}}">Next</a>
{% else %}
Next
{% endif %}
| <a href="/news/archive/?page={{pages}}&{{searchtext|urlencode}}">Last</a>
{% endblock %}

View file

@ -0,0 +1,19 @@
{% extends "base.html" %}
{% block header_ext %}
{% endblock %}
{% block sidebar %}
{{sidebar}}
{% endblock %}
{% block content %}
<h1 id="alt-layout">Search News</h1>
<p>Enter a search term or phrase to search by. Matches will be made against
news titles and their contents.</p>
<form method="GET">
{{search_form.as_p}}
<button type="Submit">Submit</button>
</form>
{{debug}}
{% endblock %}

View file

@ -4,13 +4,7 @@
{% endblock %}
{% block sidebar %}
<p class="doNotDisplay doNotPrint">This page&rsquo;s menu:</p>
<ul id="side-bar">
<li><a href="#alt-layout" title="Alternative layout">Alt. layout</a></li>
<li><a href="#compatibility" title="Improved cross-browser compatibility">Compatibility</a></li>
<li><a href="#stylesheets" title="Comprehensive stylesheets">Stylesheets</a></li>
<li><a href="#accessibility" title="Accessibility features">Accessibility</a></li>
</ul>
{{sidebar}}
{% endblock %}
{% block content %}