From: Simon Cozens Date: Sat, 10 Feb 2007 12:33:37 +0000 (+0000) Subject: Show some photos on the front page #11. X-Git-Tag: 1.2+svn20070808~45 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=d82c04ad8284377640baac802ce54fa811fc514a;p=memories.git Show some photos on the front page #11. git-svn-id: http://svn.simon-cozens.org/memories/trunk@23 041978f6-d955-411f-a9d7-1d8545c9c3c7 --- diff --git a/Memories.pm b/Memories.pm index 7027b09..efad269 100644 --- a/Memories.pm +++ b/Memories.pm @@ -112,11 +112,13 @@ sub do_cached { return @stuff; } -sub _recent_uploads { Memories::Photo->search_recent() } -sub _random { Memories::Photo->search_random() } +for my $how (qw(random recent interesting popular)) { + no strict; + my $method = "search_$how"; + *{"_$how"} = sub { Memories::Photo->$method }; + *{$how} = sub { shift->do_cached(\&{"_$how"})}; +} -sub recent_uploads { shift->do_cached(\&_recent_uploads) } -sub random { shift->do_cached(\&_random) } sub tagcloud { shift->do_cached(\&_tagcloud) } sub _tagcloud { diff --git a/templates/frontpage b/templates/frontpage index 9bd9576..31a9f7c 100644 --- a/templates/frontpage +++ b/templates/frontpage @@ -1,6 +1,16 @@ [% INCLUDE header %] -

Welcome to Memories

- +[% PROCESS macros %] + +[% FOR how = ["popular", "interesting", "random"] %] + + +[% FOR pic = request.$how %] + +[% END %] + +[% END %] +
[%how | ucfirst%] photos
[% minithumb(pic) %]
[%pic.title%]
+

Memories is a site where you can upload and share your photos.

diff --git a/templates/static/memories.css b/templates/static/memories.css index 4147e18..77476f2 100644 --- a/templates/static/memories.css +++ b/templates/static/memories.css @@ -91,6 +91,8 @@ p { font-family: sans-serif; } .photolicense { font-size: 80%; padding: 10px; } .smaller { font-size: 80% } +.frontpagetable { padding: 10px; } +.frontpagetable th { border: 1px solid black; } span.tagcloud0 { font-size: 9px;} span.tagcloud1 { font-size: 10px;} span.tagcloud2 { font-size: 10px;}