package FixMyStreet::App::Controller::Alert;
use Moose;
use namespace::autoclean;
BEGIN {extends 'Catalyst::Controller'; }
=head1 NAME
FixMyStreet::App::Controller::Alert - Catalyst Controller
=head1 DESCRIPTION
Catalyst Controller.
=head1 METHODS
=cut
=head2 alert
Show the alerts page
=cut
sub index :Path('') :Args(0) {
my ( $self, $c ) = @_;
# my $q = shift;
# my $cobrand = Page::get_cobrand($q);
# my $error = shift;
# my $errors = '';
# $errors = '
' if $error;
#
# my $form_action = Cobrand::url(Page::get_cobrand($q), '/alert', $q);
# my $cobrand_form_elements = Cobrand::form_elements($cobrand, 'alerts', $q);
# my $cobrand_extra_data = Cobrand::extra_data($cobrand, $q);
#
# $out .= $errors . qq(';
# my %vars = (header => $header,
# cobrand_form_elements => $cobrand_form_elements,
# error => $errors,
# rss_label => $rss_label,
# rss_feed => $rss_feed,
# default_link => $default_link,
# rss_details => $rss_details,
# rss_feed_2k => $rss_feed_2k,
# rss_feed_5k => $rss_feed_5k,
# rss_feed_10k => $rss_feed_10k,
# rss_feed_20k => $rss_feed_20k,
# lat => $lat,
# lon => $lon,
# options => $options );
# my $cobrand_page = Page::template_include('alert-options', $q, Page::template_root($q), %vars);
# $out = $cobrand_page if ($cobrand_page);
# return $out;
}
=head2 prettify_pc
This will canonicalise and prettify the postcode and stick a pretty_pc and pretty_pc_text in the stash.
=cut
sub prettify_pc : Private {
my ( $self, $c ) = @_;
# FIXME previously this had been run through ent so need to do similar here or in template
my $pretty_pc = $c->req->params->{'pc'};
# my $pretty_pc = $input_h{pc};
# my $pretty_pc_text;# This one isnt't getting the nbsp.
if (mySociety::PostcodeUtil::is_valid_postcode($c->req->params->{'pc'})) {
$pretty_pc = mySociety::PostcodeUtil::canonicalise_postcode($c->req->params->{'pc'});
my $pretty_pc_text = $pretty_pc;
$pretty_pc_text =~ s/ //g;
$c->stash->{pretty_pc_text} = $pretty_pc_text;
# this may be better done in template
$pretty_pc =~ s/ / /;
}
$c->stash->{pretty_pc} = $pretty_pc;
}
sub council_options : Private {
my ( $self, $c ) = @_;
if ( $c->config->{COUNTRY} eq 'NO' ) {
# my ($options, $options_start, $options_end);
# if (mySociety::Config::get('COUNTRY') eq 'NO') {
#
# my (@options, $fylke, $kommune);
# foreach (values %$areas) {
# if ($_->{type} eq 'NKO') {
# $kommune = $_;
# } else {
# $fylke = $_;
# }
# }
# my $kommune_name = $kommune->{name};
# my $fylke_name = $fylke->{name};
#
# if ($fylke->{id} == 3) { # Oslo
#
# push @options, [ 'council', $fylke->{id}, Page::short_name($fylke),
# sprintf(_("Problems within %s"), $fylke_name) ];
#
# $options_start = "";
#
# } else {
#
# push @options,
# [ 'area', $kommune->{id}, Page::short_name($kommune), $kommune_name ],
# [ 'area', $fylke->{id}, Page::short_name($fylke), $fylke_name ];
# $options_start = '