Author: kake
Date: 2012-04-27 10:52:18 +0100 (Fri, 27 Apr 2012)
New Revision: 1365
Modified:
trunk/README.CSS
trunk/t/55_node_history.t
trunk/templates/node.tt
Log:
Added another link to current version on historical display of nodes (this one is near the title, and can be hidden with CSS).
Modified: trunk/README.CSS
===================================================================
--- trunk/README.CSS 2012-04-24 15:16:38 UTC (rev 1364)
+++ trunk/README.CSS 2012-04-27 09:52:18 UTC (rev 1365)
@@ -120,6 +120,11 @@
Purpose: Defines content that will be hidden for users with a
CSS-conforming user agent
+span.current_version_title_link
+ Used in: node.tt
+ Purpose: On display of historical versions of nodes, provides a link to
+ the current version.
+
span.node_name
Used in: backlink_results.tt delete_confirm.tt delete_done.tt
differences.tt node_history.tt
Modified: trunk/t/55_node_history.t
===================================================================
--- trunk/t/55_node_history.t 2012-04-24 15:16:38 UTC (rev 1364)
+++ trunk/t/55_node_history.t 2012-04-27 09:52:18 UTC (rev 1365)
@@ -11,10 +11,13 @@
plan skip_all => "DBD::SQLite could not be used - no database to test with ($error)";
}
-plan tests => 2;
+eval { require Test::HTML::Content; };
+my $thc = $@ ? 0 : 1;
- OpenGuides::Test::refresh_db();
+plan tests => 4;
+OpenGuides::Test::refresh_db();
+
my $config = OpenGuides::Test->make_basic_config;
$config->script_name( "mywiki.cgi" );
$config->script_url( "http://example.com/" );
@@ -22,7 +25,7 @@
$guide->wiki->write_node( "South Croydon Station", "A sleepy main-line station in what is arguably the nicest part of Croydon.", undef, { comment => "<myfaketag>" } ) or die "Can't write node";
my %data = $guide->wiki->retrieve_node( "South Croydon Station" );
-$guide->wiki->write_node( "South Croydon Station", "A sleepy main-line station in what is arguably the nicest part of Croydon.", $data{checksum}, { comment => "<myfaketag>" } ) or die "Can't write node";
+$guide->wiki->write_node( "South Croydon Station", "A sleepy mainline station in what is arguably the nicest part of Croydon.", $data{checksum}, { comment => "<myfaketag>" } ) or die "Can't write node";
my $output = $guide->display_node(
id => "South Croydon Station",
@@ -33,4 +36,12 @@
"node param escaped properly in links in historic view" );
unlike( $output, qr'South%20Croydon%20Station',
"...in all links" );
-
+SKIP: {
+ skip "Test::HTML::Content not available", 2 unless $thc;
+ Test::HTML::Content::tag_ok(
+ $output, "span", { class => "current_version_title_link" },
+ "historical version has link to current version near title" );
+ Test::HTML::Content::link_ok( $output,
+ "mywiki.cgi?South_Croydon_Station",
+ "...and the link is correct" );
+}
Modified: trunk/templates/node.tt
===================================================================
--- trunk/templates/node.tt 2012-04-24 15:16:38 UTC (rev 1364)
+++ trunk/templates/node.tt 2012-04-27 09:52:18 UTC (rev 1365)
@@ -92,6 +92,9 @@
[% END %]
version [% version %] of
<span class="node_name">[% node_name %]</span></em>
+ <span class="current_version_title_link">
+ <a href="[% cgi_url %]?[% node_param %]">(view current version)</a>
+ </span>
</h2>
[% END %]
[% IF empty_node %]
Author: kake
Date: 2012-04-19 19:52:04 +0100 (Thu, 19 Apr 2012)
New Revision: 1362
Modified:
trunk/t/94_leaflet.t
Log:
Test new ->show_index() parameters, not old ones (since we already have tests to make sure old ones are still supported).
Modified: trunk/t/94_leaflet.t
===================================================================
--- trunk/t/94_leaflet.t 2012-04-19 18:41:20 UTC (rev 1361)
+++ trunk/t/94_leaflet.t 2012-04-19 18:52:04 UTC (rev 1362)
@@ -81,7 +81,7 @@
"...as is our own Leaflet map JavaScript." );
# Make sure the map doesn't try to show nodes with missing or broken geodata.
-my %tt_vars = $guide->show_index( type => "locale", value => "Croydon",
+my %tt_vars = $guide->show_index( loc => "Croydon",
format => "map", return_tt_vars => 1 );
my @nodes = @{$tt_vars{nodes}};
is( scalar @nodes, 4, "Right number of nodes in TT variables." );
@@ -92,7 +92,7 @@
"Nodes with no geodata don't have has_geodata set." );
# And check again in the HTML, in case of template bugs.
-$output = $guide->show_index( type => "locale", value => "Croydon",
+$output = $guide->show_index( loc => "Croydon",
format => "map", return_output => 1 );
unlike( $output, qr|name:\s*Lost\s+Lion|,
"Nodes with no geodata are not passed to JavaScript object." );
@@ -111,7 +111,7 @@
# Make sure name and address are passed through to the JavaScript for adding
# markers to the map.
-$output = $guide->show_index( type => "locale", value => "Waddon",
+$output = $guide->show_index( loc => "Waddon",
format => "map", return_output => 1 );
like( $output, qr/name:\s*["']Red\s+Lion["']/,
"Name added to JavaScript object." );
@@ -119,7 +119,7 @@
"Address added to JavaScript object." );
# Make sure nodes with no geodata get linked to despite not being on the map.
-$output = $guide->show_index( type => "locale", value => "Addiscombe",
+$output = $guide->show_index( loc => "Addiscombe",
format => "map", return_output => 1 );
like( $output, qr|Lost_Lion|, "Nodes with no geodata still get linked." );
@@ -143,7 +143,7 @@
return_output => 1,
);
-%tt_vars = $guide->show_index( type => "locale", value => "Zero Land",
+%tt_vars = $guide->show_index( loc => "Zero Land",
format => "map", return_tt_vars => 1 );
@nodes = @{$tt_vars{nodes}};
%node_hash = map { $_->{name} => $_ } @nodes;
@@ -153,21 +153,21 @@
"Nodes with zero longitude have has_geodata set." );
# Check capitalisation.
-$output = $guide->show_index( type => "category", value => "numerical nodes",
+$output = $guide->show_index( cat => "numerical nodes",
format => "map", return_output => 1 );
like( $output, qr/Category\s+Numerical\s+Nodes/,
"Multi-word categories are capitalised properly." );
-$output = $guide->show_index( type => "locale", value => "zero land",
+$output = $guide->show_index( loc => "zero land",
format => "map", return_output => 1 );
like( $output, qr/Locale\s+Zero\s+Land/,
"Multi-word locales are capitalised properly." );
# Map shouldn't be displayed if none of the nodes have geodata.
-%tt_vars = $guide->show_index( type => "locale", value => "Addiscombe",
+%tt_vars = $guide->show_index( loc => "Addiscombe",
format => "map", return_tt_vars => 1 );
ok( $tt_vars{no_nodes_on_map},
"no_nodes_on_map template variable is set when no nodes have geodata" );
-$output = $guide->show_index( type => "locale", value => "Addiscombe",
+$output = $guide->show_index( loc => "Addiscombe",
format => "map", return_output => 1 );
unlike( $output, qr/not on map/,
"...and no warning about individual things not being on the map" );