Author: kake Date: 2012-03-06 09:31:54 +0000 (Tue, 06 Mar 2012) New Revision: 1309
Added: trunk/templates/autocreate_content.tt Modified: trunk/Build.PL trunk/Changes trunk/MANIFEST trunk/lib/OpenGuides.pm trunk/t/19_autocreate.t Log: Add an autocreate_content.tt template to include a map link in content for autocreated categories and locales (closes #275).
Modified: trunk/Build.PL =================================================================== --- trunk/Build.PL 2012-03-06 08:54:04 UTC (rev 1308) +++ trunk/Build.PL 2012-03-06 09:31:54 UTC (rev 1309) @@ -347,6 +347,7 @@ $build->config_data( __templates => [ "admin_home.tt", "admin_revert_user.tt", + "autocreate_content.tt", "backlink_results.tt", "banner.tt", "blacklisted_host.tt",
Modified: trunk/Changes =================================================================== --- trunk/Changes 2012-03-06 08:54:04 UTC (rev 1308) +++ trunk/Changes 2012-03-06 09:31:54 UTC (rev 1309) @@ -3,6 +3,10 @@ More detailed changelogs can be found at http://dev.openguides.org/log/trunk.
+0.66 ? + Add an autocreate_content.tt template to include a map link in content + for autocreated categories and locales (#275). + 0.65 28 February 2010 Fix some more broken POD and add POD unit test (#268) Don't display revision info for nodes that don't exist (#193)
Modified: trunk/MANIFEST =================================================================== --- trunk/MANIFEST 2012-03-06 08:54:04 UTC (rev 1308) +++ trunk/MANIFEST 2012-03-06 09:31:54 UTC (rev 1309) @@ -29,6 +29,7 @@ search.cgi templates/admin_home.tt templates/admin_revert_user.tt +templates/autocreate_content.tt templates/backlink_results.tt templates/banner.tt templates/blacklisted_host.tt @@ -155,3 +156,4 @@ t/86_recent_changes.t t/templates/15_test.tt wiki.cgi +META.json
Modified: trunk/lib/OpenGuides.pm =================================================================== --- trunk/lib/OpenGuides.pm 2012-03-06 08:54:04 UTC (rev 1308) +++ trunk/lib/OpenGuides.pm 2012-03-06 09:31:54 UTC (rev 1309) @@ -1744,6 +1744,10 @@ my $ok = $tt->process( "custom_autocreate_content.tt", %tt_vars, $blurb ); if ( !$ok ) { + $ok = $tt->process( "autocreate_content.tt", + %tt_vars, $blurb ); + } + if ( !$ok ) { $blurb = "@INDEX_LINK [[$node]]"; } $wiki->write_node(
Modified: trunk/t/19_autocreate.t =================================================================== --- trunk/t/19_autocreate.t 2012-03-06 08:54:04 UTC (rev 1308) +++ trunk/t/19_autocreate.t 2012-03-06 09:31:54 UTC (rev 1309) @@ -12,7 +12,7 @@ "DBD::SQLite could not be used - no database to test with. ($error)"; }
-plan tests => 12; +plan tests => 13;
my $config = OpenGuides::Test->make_basic_config; $config->custom_template_path( cwd . "/t/templates/" ); @@ -111,10 +111,19 @@ guide => $guide, node => "Bleeding Heart", categories => "Pubs", + locales => "EC1", return_output => 1, ); $content = $wiki->retrieve_node( "Category Pubs" ); $content =~ s/\s+$//s; -$content =~ s/\s+/ /gs; -is( $content, "@INDEX_LINK [[Category Pubs]]", +is( $content, "Things in this category " + . "(@MAP_LINK [[Category Pubs|view them on a map]]):\n" + . "@INDEX_LIST [[Category Pubs]]", "Default content is picked up if autocreate template doesn't exist" ); + +$content = $wiki->retrieve_node( "Locale EC1" ); +$content =~ s/\s+$//s; +is( $content, "Things in EC1 " + . "(@MAP_LINK [[Locale EC1|view them on a map]]):\n" + . "@INDEX_LIST [[Locale EC1]]", + "...and for locales too." );
Added: trunk/templates/autocreate_content.tt =================================================================== --- trunk/templates/autocreate_content.tt (rev 0) +++ trunk/templates/autocreate_content.tt 2012-03-06 09:31:54 UTC (rev 1309) @@ -0,0 +1,2 @@ +Things in [% IF index_type == "Category" %]this category[% ELSE %][% index_value %][% END %] (@MAP_LINK [[[% node_name %]|view them on a map]]): +@INDEX_LIST [[[% node_name %]]]
openguides-commits@lists.openguides.org