aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-05-10 11:56:07 +0100
committerStruan Donald <struan@exo.org.uk>2011-05-10 11:56:07 +0100
commit7011ca98493656f98433d644ffa922c8b3720adc (patch)
treea0448c5e68270bd8fd40e9a542694b1f223c58e0
parent6e23ba1293355029a96eb5a9fd59cc60974d74ae (diff)
add subscribe target and get to rss through that instead
-rw-r--r--perllib/FixMyStreet/App/Controller/Alert.pm17
-rw-r--r--t/app/controller/alert.t12
2 files changed, 22 insertions, 7 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Alert.pm b/perllib/FixMyStreet/App/Controller/Alert.pm
index 93080c073..ef37e53c3 100644
--- a/perllib/FixMyStreet/App/Controller/Alert.pm
+++ b/perllib/FixMyStreet/App/Controller/Alert.pm
@@ -25,6 +25,7 @@ Show the alerts page
sub index : Path('') : Args(0) {
my ( $self, $c ) = @_;
+
# my $q = shift;
# my $cobrand = Page::get_cobrand($q);
# my $error = shift;
@@ -157,13 +158,27 @@ sub list : Path('list') : Args(0) {
$c->cobrand->uri( $rss_feed . '/20', $c->fake_q );
}
+=head2 subscribe
+
+Target for subscribe form
+
+=cut
+
+sub subscribe : Path('subscribe') : Args(0) {
+ my ( $self, $c ) = @_;
+
+ if ( $c->req->param( 'rss' ) ) {
+ $c->detach( 'rss' );
+ }
+}
+
=head2 rss
Redirects to relevant RSS feed
=cut
-sub rss : Path('rss') : Args(0) {
+sub rss : Private {
my ( $self, $c ) = @_;
my $feed = $c->req->params->{feed};
diff --git a/t/app/controller/alert.t b/t/app/controller/alert.t
index f3b705650..2f25a1c23 100644
--- a/t/app/controller/alert.t
+++ b/t/app/controller/alert.t
@@ -45,25 +45,25 @@ $mech->content_contains('hat location does not appear to be covered by a council
$mech->get_ok('/alert/list?pc=GL502PR');
$mech->content_contains('Problems within the boundary of');
-$mech->get_ok('/alert/rss?type=local&pc=ky16+8yg&rss=Give+me+an+RSS+feed&rznvy=' );
+$mech->get_ok('/alert/subscribe?rss=1&type=local&pc=ky16+8yg&rss=Give+me+an+RSS+feed&rznvy=' );
$mech->content_contains('Please select the feed you want');
-$mech->get_ok('/alert/rss?feed=invalid:1000:A_Locationtype=local&pc=ky16+8yg&rss=Give+me+an+RSS+feed&rznvy=');
+$mech->get_ok('/alert/subscribe?rss=1&feed=invalid:1000:A_Locationtype=local&pc=ky16+8yg&rss=Give+me+an+RSS+feed&rznvy=');
$mech->content_contains('Illegal feed selection');
TODO: {
local $TODO = 'not implemented rss feeds yet';
- $mech->get_ok('/alert/rss?feed=area:1000:A_Location');
+ $mech->get_ok('/alert/subscribe?rss=1&feed=area:1000:A_Location');
$mech->uri->path('/rss/area/A+Location');
- $mech->get_ok('/alert/rss?feed=area:1000:1001:A_Location:Diff_Location');
+ $mech->get_ok('/alert/subscribe?rss=1&feed=area:1000:1001:A_Location:Diff_Location');
$mech->uri->path('/rss/area/A+Location/Diff+Location');
- $mech->get_ok('/alert/rss?feed=council:1000:A_Location');
+ $mech->get_ok('/alert/subscribe?rss=1&feed=council:1000:A_Location');
$mech->uri->path('/rss/reports/A+Location');
- $mech->get_ok('/alert/rss?feed=ward:1000:1001:A_Location:Diff_Location');
+ $mech->get_ok('/alert/subscribe?rss=1&feed=ward:1000:1001:A_Location:Diff_Location');
$mech->uri->path('/rss/ward/A+Location/Diff+Location');
}