Author: kake Date: 2012-04-18 13:24:02 +0100 (Wed, 18 Apr 2012) New Revision: 1354
Modified: trunk/t/53_show_index.t trunk/templates/map_index_leaflet.tt trunk/templates/site_index.tt Log: Provide links between map and list version of action=index
Modified: trunk/t/53_show_index.t =================================================================== --- trunk/t/53_show_index.t 2012-04-18 12:07:02 UTC (rev 1353) +++ trunk/t/53_show_index.t 2012-04-18 12:24:02 UTC (rev 1354) @@ -5,14 +5,16 @@ use Test::More;
eval { require DBD::SQLite; }; - if ( $@ ) { my ($error) = $@ =~ /^(.*?)\n/; plan skip_all => "DBD::SQLite could not be used - no database to test with ($error)"; }
-plan tests => 42; +eval { require Test::HTML::Content; }; +my $thc = $@ ? 0 : 1;
+plan tests => 44; + # Clear out the database from any previous runs. OpenGuides::Test::refresh_db();
@@ -81,6 +83,15 @@ like( $footer, qr|action=index;cat=alpha;format=atom|, "Atom link correct in footer" );
+# When using leaflet, test link to map version in body. +SKIP: { + skip "Test::HTML::Content not available", 1 unless $thc; + $config->use_leaflet( 1 ); + Test::HTML::Content::link_ok( $output, + "http://example.com/wiki.cgi?action=index;cat=alpha;format=map", + "We have a link to the map version" ); +} + # Test the RDF version $output = $guide->show_index( cat => "Alpha", @@ -191,3 +202,10 @@ like( $output, qr|<link rel="alternate[^>]*action=index;loc=assam;format=atom|, "Atom link correct in header" ); + +SKIP: { + skip "Test::HTML::Content not available", 1 unless $thc; + Test::HTML::Content::link_ok( $output, + "http://example.com/wiki.cgi?action=index;loc=assam", + "We have a link to the non-map version" ); +}
Modified: trunk/templates/map_index_leaflet.tt =================================================================== --- trunk/templates/map_index_leaflet.tt 2012-04-18 12:07:02 UTC (rev 1353) +++ trunk/templates/map_index_leaflet.tt 2012-04-18 12:24:02 UTC (rev 1354) @@ -17,6 +17,7 @@ [% ELSE %] all nodes [% END %] + (<a href="[% feed_base %]">view as a list</a>) </h2>
<div id="map_index_node_list">
Modified: trunk/templates/site_index.tt =================================================================== --- trunk/templates/site_index.tt 2012-04-18 12:07:02 UTC (rev 1353) +++ trunk/templates/site_index.tt 2012-04-18 12:24:02 UTC (rev 1354) @@ -21,6 +21,7 @@ [% ELSE %] everything on this guide [%- END -%] + (<a href="[% feed_base %];format=map">view on a map</a>) </h2> <ol> [% FOREACH node = nodes %]
openguides-commits@lists.openguides.org