Changeset 1095
- Timestamp:
- 06/20/07 17:34:42 (16 months ago)
- Location:
- trunk
- Files:
-
- 3 modified
-
lib/OpenGuides/Template.pm (modified) (1 diff)
-
t/51_display_node.t (modified) (2 diffs)
-
templates/display_metadata.tt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/OpenGuides/Template.pm
r1091 r1095 320 320 321 321 my @categories = map { { name => $_, 322 url => "$script_name?Category_"323 . uri_escape($formatter->node_name_to_node_param($_)) } } @catlist;322 url => $args{wiki}->node_exists( "Category_" . $formatter->node_name_to_node_param($_)) ? "$script_name?Category_" 323 . uri_escape($formatter->node_name_to_node_param($_)) : "" } } @catlist; 324 324 325 325 my @locales = map { { name => $_, 326 url => "$script_name?Locale_"327 . uri_escape($formatter->node_name_to_node_param($_)) } } @loclist;326 url => $args{wiki}->node_exists( "Locale_" . $formatter->node_name_to_node_param($_)) ? "$script_name?Locale_" 327 . uri_escape($formatter->node_name_to_node_param($_)) : "" } } @loclist; 328 328 329 329 # The 'website' attribute might contain a URL so we wiki-format it here -
trunk/t/51_display_node.t
r1064 r1095 13 13 } 14 14 15 plan tests => 9;15 plan tests => 13; 16 16 17 Wiki::Toolkit::Setup::SQLite::cleardb( { dbname => "t/node.db" } ); 17 18 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); 18 19 my $config = OpenGuides::Config->new( … … 61 62 62 63 unlike( $output, qr{^\QLocation: }ms, '...but not with redirect=0' ); 64 65 $wiki->write_node( "Non-existent categories and locales", "foo", undef, 66 { category => [ "Does not exist" ], 67 locale => [ "Does not exist" ] } ); 68 69 $output = $guide->display_node( id => 'Non-existent categories and locales', 70 return_output => 1 71 ); 72 73 unlike( $output, qr{\Q<a href="wiki.cgi?Category_Does_Not_Exist"}, 74 'Category name not linked if category does not exist' ); 75 76 $wiki->write_node( "Category_Does_Not_Exist", "bar", undef, undef ); 77 78 $output = $guide->display_node( id => 'Non-existent categories and locales', 79 return_output => 1 80 ); 81 82 like( $output, qr{\Q<a href="wiki.cgi?Category_Does_Not_Exist"}, 83 'but does when it does exist' ); 84 85 unlike( $output, qr{\Q<a href="wiki.cgi?Locale_Does_Not_Exist"}, 86 'Locale name not linked if category does not exist' ); 87 88 $wiki->write_node( "Locale_Does_Not_Exist", "wibble", undef, undef ); 89 90 $output = $guide->display_node( id => 'Non-existent categories and locales', 91 return_output => 1 92 ); 93 94 like( $output, qr{\Q<a href="wiki.cgi?Locale_Does_Not_Exist"}, 95 'but does when it does exist' ); 96 97 -
trunk/templates/display_metadata.tt
r937 r1095 82 82 <span class="metadata_label">Categories:</span> 83 83 [% FOREACH category = categories %] 84 <a href="[% category.url %]" class="category">[% category.name %]</a>[%- "," UNLESS loop.last %] 84 [% IF category.url != "" %] 85 <a href="[% category.url %]" class="category">[% category.name %]</a>[%- "," UNLESS loop.last %] 86 [% ELSE %] 87 [% category.name %][%- "," UNLESS loop.last %] 88 [% END %] 85 89 [% END %] 86 90 </li> … … 91 95 <span class="metadata_label">Locales:</span> 92 96 [% FOREACH locale = locales %] 93 <a href="[% locale.url %]" class="addr locality">[% locale.name %]</a>[%- "," UNLESS loop.last %] 97 [% IF locale.url != "" %] 98 <a href="[% locale.url %]" class="addr locality">[% locale.name %]</a>[%- "," UNLESS loop.last %] 99 [% ELSE %] 100 [% locale.name %][%- "," UNLESS loop.last %] 101 [% END %] 94 102 [% END %] 95 103 </li>
