Skip to content
Browse files

Don't show next links if it's today

  • Loading branch information...
1 parent 5010ecb commit 6a064a02c8eccbf88ba345141490b227c1339be8 @avar committed
Showing with 13 additions and 2 deletions.
  1. +6 −0 lib/Avarpics/Controller/Day.pm
  2. +7 −2 root/day.tt
View
6 lib/Avarpics/Controller/Day.pm
@@ -40,6 +40,12 @@ sub index :Path :CaptureArgs(1) {
$c->error( "$day is not a valid day" );
}
+ # Don't show next links if it's today
+ my $today = strftime("%Y-%m-%d", localtime);
+ if ($today eq $day) {
+ $c->stash->{no_next} = 1;
+ }
+
$c->stash->{title} = sprintf "Pics from %s for %s", $c->config->{channel}, $day;
$c->stash->{template} = 'day.tt';
}
View
9 root/day.tt
@@ -14,7 +14,10 @@ function small(img) {
<h2>[% IF img_count > 0 %][% img_count %] images[% IF vid_count > 0 %], [% END %][% END %][% IF vid_count > 0 %][% vid_count %] videos[% END %]</h2>
<div id="toc">
-<a href="#pics" style="font-weight: bold">skip to pics &darr;</a> &nbsp; <a href="[% c.uri_for("/day/$prev_day") %]">&larr; prev day</a> &nbsp; <a href="[% c.uri_for("/day/$next_day") %]">next day &rarr;</a> &nbsp; <a href="[% c.uri_for('/menu') %]">list all days</a>
+<a href="#pics" style="font-weight: bold">skip to pics &darr;</a> &nbsp;
+<a href="[% c.uri_for("/day/$prev_day") %]">&larr; prev day</a> &nbsp;
+[% UNLESS no_next %]<a href="[% c.uri_for("/day/$next_day") %]">next day &rarr;</a> &nbsp;[% END %]
+<a href="[% c.uri_for('/menu') %]">list all days</a>
<ol>
[% anchor = 1 %]
[% FOREACH uri IN uris %]
@@ -51,7 +54,9 @@ function small(img) {
</div>
[% END %]
<p>
-<a href="[% c.uri_for("/day/$prev_day") %]">&larr; prev day</a> &nbsp; <a href="[% c.uri_for("/day/$next_day") %]">next day &rarr;</a> &nbsp; <a href="[% c.uri_for('/menu') %]">list all days</a>
+<a href="[% c.uri_for("/day/$prev_day") %]">&larr; prev day</a> &nbsp;
+[% UNLESS no_next %]<a href="[% c.uri_for("/day/$next_day") %]">next day &rarr;</a> &nbsp;[% END %]
+<a href="[% c.uri_for('/menu') %]">list all days</a>
</p>
</div>
</body>

0 comments on commit 6a064a0

Please sign in to comment.
Something went wrong with that request. Please try again.