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 %]
Show replies by date