NAME
Angerwhale::Controller::Categories - Catalyst Controller
SYNOPSIS
See Angerwhale
DESCRIPTION
Catalyst Controller.
METHODS
show_category
Gets a list of articles to show. The first argument is the name of the category to display, or q{} (an empty string) for the "root" category. If there's another argument, it should be a date in the form:
(YYYY, MM, DD)
Processing of articles will begin on this date, such that all articles on that day are shown, then YYYY, MM, DD-1; and so on, until articles_per_page
articles have been selected for display. If there are more than articles_per_page
articles from a single day, they will all be displayed regardless of the articles_per_page
setting. (Just for general sanity; not likely to happen in real life.)
Config options that are used:
- mini_cutoff
-
If an articles has fewer than this number of words, it is displayed in "mini" form, unless it's the first article on the page. Defaults to 150.
- articles_per_page
-
How many articles to display before the "42 older articles" link is displayed. Can be overridden by sepcifying
articles_desired
in the stash. Defaults to 5.
To deal with paging, newer_articles
and older_articles
are set to the dates of newer and older articles.
_split_articles
($before_ref, $current_ref, $after_ref) =
_split_articles($articles_ref, $args_ref)
Splits the array reference $articles_ref
into three arrays, before, current, and after. The article list should be sorted, with the most recent article first. If this isn't the case, expect something bad to happen.
$args_ref
is a hash reference containing:
- date
-
An array reference to the date array: [year, month, day].
For example, [2006, 07, 31] is July 31, 2006.
- articles_per_page
-
How many articles to put on the "current" page.
XXX: Note that I'm being lazy about checking validity of paramaters. Don't set articles_per_page to be -42 or sort the array backwards. If you do that, expect something bad to happen. RTFM.
Throws an exception if the date is not valid.
_date_of
Given an article, returns the date in yyyy/mm/dd format.
list_categories
XXX: todo.
default($category)
Display the $category
or an error message if it doesn't exist.
AUTHOR
Jonathan Rockway
LICENSE
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.