diff --git a/lib/unix_dog/Controller/Main.pm b/lib/unix_dog/Controller/Main.pm
index 5a1dee8..8edd9e7 100644
--- a/lib/unix_dog/Controller/Main.pm
+++ b/lib/unix_dog/Controller/Main.pm
@@ -104,16 +104,15 @@ sub announcements ($self) {
$next_page = $page + 1;
}
-
+ my @chosen = (sort keys %announcements)[$start_index..$end_index];
+ my @items;
+ for my $key (@chosen) {
+ push @items, $announcements{$key};
+ }
$self->stash(
- announcements => \%announcements,
- total_items => $total_items,
- items_per_page => $items_per_page,
- page => $page,
- start_index => $start_index,
- end_index => $end_index,
- next_page => $next_page,
+ next_page => $next_page,
+ items => \@items,
);
$self->render();
}
diff --git a/templates/main/announcements.html.ep b/templates/main/announcements.html.ep
index 6567eff..47badd5 100644
--- a/templates/main/announcements.html.ep
+++ b/templates/main/announcements.html.ep
@@ -7,25 +7,23 @@
These announcements are also avaiable over RSS. Just add .rss to the path here.
- Also, all announcements are signed with the following PGP key:
+ Also, all announcements are signed with the following PGP key:
67A3 9437 8618 B72E B4D5 CC69 B0EB E117 49B9 9367 alpha@unix.dog
so you can verify their authenticity. When a new announcement is out, you should
also recieve an email if you're registered.
-<% my @sorted = sort (keys %$announcements); %>
-<% foreach my $key (@sorted[$start_index..$end_index]) { %>
- <% my $value = $announcements->{$key}; %>
+% foreach my $entry (@$items) {
- <%= $value->{"title"} %>
+ <%= $entry->{"title"} %>
- Posted <%= localtime($value->{"date"})->strftime() %>.
- ">Download PGP signature.
+ Posted <%= localtime($entry->{"date"})->strftime() %>.
+ ">Download PGP signature.
-
<%= $value->{"text"} %>
+ <%= $entry->{"text"} %>
-<% } %>
-<% if ($next_page != -1) { %>
+% }
+% if ($next_page != -1) {
Next page...
-<% } %>
+% }