links to archive years

This commit is contained in:
Frederic Peters 2009-05-25 17:09:37 +02:00
parent 7d4ebded93
commit 1370f92fa3
2 changed files with 19 additions and 0 deletions

View File

@ -71,6 +71,10 @@ class RevuesDePresse(BaseContent):
return all_links[offset:]
return all_links[offset:offset+num]
def getRangeOfYears(self):
first_year = self.getLinks()[-1][2][0]
return range(int(first_year), time.localtime()[0]+1)
def getYear(self, year):
if not year:
year = time.localtime()[0]

View File

@ -33,6 +33,15 @@ div.archives br {
clear: both;
}
ul.range-of-years {
list-style: none;
}
ul.range-of-years li {
display: inline;
padding: 0 1em;
}
</style>
</metal:cssslot>
@ -51,6 +60,12 @@ div.archives br {
<div class="archives" tal:content="structure python: context.getArchives(year)"/>
<ul class="range-of-years">
<li tal:repeat="y python: context.getRangeOfYears()">
<a tal:attributes="href python: context.absolute_url() + '/archives?year=' + str(y)" tal:content="y"></a>
</li>
</ul>
<div tal:replace="structure provider:plone.belowcontentbody" />
</tal:main-macro>
</metal:main>