Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
sidebar now broken down by article type
Browse files Browse the repository at this point in the history
  • Loading branch information
thraxil committed Jul 31, 2008
1 parent 3bd2ea7 commit 0cef731
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 4 deletions.
13 changes: 13 additions & 0 deletions fu/models.py
Expand Up @@ -84,6 +84,19 @@ def is_current(self):
def banner_url(self):
return "/uploads/banners/%04d-%02d-%02d.jpg" % (self.pub_date.year,self.pub_date.month,self.pub_date.day)

def articles(self):
return list(self.article_set.filter(atype='article').order_by("cardinality"))[1:]

def cartoons(self):
return self.article_set.filter(atype='cartoon').order_by("cardinality")

def photos(self):
return self.article_set.filter(atype='photos').order_by("cardinality")

def editorials(self):
return self.article_set.filter(atype='editorial').order_by("cardinality")


class Tag(models.Model):
name = models.CharField(max_length=256)
slug = models.SlugField(prepopulate_from=["name"])
Expand Down
58 changes: 56 additions & 2 deletions fu/templates/article.html
Expand Up @@ -156,7 +156,8 @@ <h3>comments</h3>

<h2 class="sidebar-main">In This Issue</h2>

{% for article in article.issue.non_main_articles %}
{% if article.issue.articles %}<h3>Articles:</h3>
{% for article in article.issue.articles %}

<div class="article">
<div class="article-thumb">
Expand All @@ -171,9 +172,62 @@ <h2><a href="{{ article.get_absolute_url }}">{{ article.headline }}</a></h2>
<p>{{ article.author.fullname }}</p>
<div class="clear"></div>
</div>
{% endfor %}{% endif %}

{% if article.issue.editorials %}<h3>Editorials:</h3>
{% for article in article.issue.editorials %}

<div class="article">
<div class="article-thumb">
{% thumbnail article.author.headshot 65x65 crop,bw,upscale as bwheadshot %}
{% thumbnail article.author.headshot 65x65 crop,upscale as colorheadshot %}
<a href="{{ article.get_absolute_url }}"><img src="{{ bwheadshot }}"
onmouseover="this.src = '{{colorheadshot}}'"
onmouseout="this.src = '{{ bwheadshot }}'"
width="65" height="65" border="0" /></a>
</div>
<h2><a href="{{ article.get_absolute_url }}">{{ article.headline }}</a></h2>
<p>{{ article.author.fullname }}</p>
<div class="clear"></div>
</div>
{% endfor %}{% endif %}

{% if article.issue.cartoons %}<h3>Cartoons:</h3>
{% for article in article.issue.cartoons %}

<div class="article">
<div class="article-thumb">
{% thumbnail article.author.headshot 65x65 crop,bw,upscale as bwheadshot %}
{% thumbnail article.author.headshot 65x65 crop,upscale as colorheadshot %}
<a href="{{ article.get_absolute_url }}"><img src="{{ bwheadshot }}"
onmouseover="this.src = '{{colorheadshot}}'"
onmouseout="this.src = '{{ bwheadshot }}'"
width="65" height="65" border="0" /></a>
</div>
<h2><a href="{{ article.get_absolute_url }}">{{ article.headline }}</a></h2>
<p>{{ article.author.fullname }}</p>
<div class="clear"></div>
</div>
{% endfor %}{% endif %}

{% if article.issue.photos %}<h3>Photography:</h3>
{% for article in article.issue.photos %}

<div class="article">
<div class="article-thumb">
{% thumbnail article.author.headshot 65x65 crop,bw,upscale as bwheadshot %}
{% thumbnail article.author.headshot 65x65 crop,upscale as colorheadshot %}
<a href="{{ article.get_absolute_url }}"><img src="{{ bwheadshot }}"
onmouseover="this.src = '{{colorheadshot}}'"
onmouseout="this.src = '{{ bwheadshot }}'"
width="65" height="65" border="0" /></a>
</div>
<h2><a href="{{ article.get_absolute_url }}">{{ article.headline }}</a></h2>
<p>{{ article.author.fullname }}</p>
<div class="clear"></div>
</div>
{% endfor %}{% endif %}

{% endfor %}

<h3>Tag cloud</h3>
<div id="tag-cloud">
Expand Down
55 changes: 53 additions & 2 deletions fu/templates/issue.html
Expand Up @@ -127,8 +127,42 @@ <h3>comments</h3>

<h2 class="sidebar-main">In This Issue</h2>

{% for article in issue.non_main_articles %}
{% if issue.articles %}<h3>Articles:</h3>
{% for article in issue.articles %}
<div class="article">
<div class="article-thumb">
{% thumbnail article.author.headshot 65x65 crop,bw,upscale as bwheadshot %}
{% thumbnail article.author.headshot 65x65 crop,upscale as colorheadshot %}
<a href="{{ article.get_absolute_url }}"><img src="{{ bwheadshot }}"
onmouseover="this.src = '{{colorheadshot}}'"
onmouseout="this.src = '{{ bwheadshot }}'"
width="65" height="65" border="0" /></a>
</div>
<h2><a href="{{ article.get_absolute_url }}">{{ article.headline }}</a></h2>
<p>{{ article.author.fullname }}</p>
<div class="clear"></div>
</div>
{% endfor %}{% endif %}

{% if issue.editorials %}<h3>Editorials:</h3>
{% for article in issue.editorials %}
<div class="article">
<div class="article-thumb">
{% thumbnail article.author.headshot 65x65 crop,bw,upscale as bwheadshot %}
{% thumbnail article.author.headshot 65x65 crop,upscale as colorheadshot %}
<a href="{{ article.get_absolute_url }}"><img src="{{ bwheadshot }}"
onmouseover="this.src = '{{colorheadshot}}'"
onmouseout="this.src = '{{ bwheadshot }}'"
width="65" height="65" border="0" /></a>
</div>
<h2><a href="{{ article.get_absolute_url }}">{{ article.headline }}</a></h2>
<p>{{ article.author.fullname }}</p>
<div class="clear"></div>
</div>
{% endfor %}{% endif %}

{% if issue.cartoons %}<h3>Cartoons:</h3>
{% for article in issue.cartoons %}
<div class="article">
<div class="article-thumb">
{% thumbnail article.author.headshot 65x65 crop,bw,upscale as bwheadshot %}
Expand All @@ -142,9 +176,26 @@ <h2><a href="{{ article.get_absolute_url }}">{{ article.headline }}</a></h2>
<p>{{ article.author.fullname }}</p>
<div class="clear"></div>
</div>
{% endfor %}{% endif %}

{% if issue.photos %}<h3>Photography:</h3>
{% for article in issue.photos %}
<div class="article">
<div class="article-thumb">
{% thumbnail article.author.headshot 65x65 crop,bw,upscale as bwheadshot %}
{% thumbnail article.author.headshot 65x65 crop,upscale as colorheadshot %}
<a href="{{ article.get_absolute_url }}"><img src="{{ bwheadshot }}"
onmouseover="this.src = '{{colorheadshot}}'"
onmouseout="this.src = '{{ bwheadshot }}'"
width="65" height="65" border="0" /></a>
</div>
<h2><a href="{{ article.get_absolute_url }}">{{ article.headline }}</a></h2>
<p>{{ article.author.fullname }}</p>
<div class="clear"></div>
</div>
{% endfor %}{% endif %}


{% endfor %}

<h3>Tag cloud</h3>
<div id="tag-cloud">
Expand Down

0 comments on commit 0cef731

Please sign in to comment.