Changeset 1269


Ignore:
Timestamp:
Jun 19, 2009, 11:41:38 PM (12 years ago)
Author:
Dominic Hargreaves
Message:

Don't display revision info for nodes that don't exist (fixes #193)

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Changes

    r1261 r1269  
    660.65
    77        Fix some more broken POD and add POD unit test (#268)
     8        Don't display revision info for nodes that don't exist (#193)
    89
    9100.64    23 February 2009
  • trunk/lib/OpenGuides.pm

    r1261 r1269  
    288288                   wgs84_lat     => $wgs84_lat
    289289               );
     290
     291    $tt_vars{empty_node} = !($tt_vars{content} ||
     292                             $tt_vars{coord_field_1_value} ||
     293                             $tt_vars{coord_field_2_value} ||
     294                             $tt_vars{latitude} ||
     295                             $tt_vars{longitude});
    290296
    291297    # Hide from search engines if showing a specific version.
  • trunk/t/51_display_node.t

    r1098 r1269  
    1414}
    1515
    16 plan tests => 15;
     16plan tests => 18;
    1717
    1818Wiki::Toolkit::Setup::SQLite::cleardb( { dbname => "t/node.db" } );
     
    111111like( $output, qr{\Q<a href="wiki.cgi?Locale_Does_Exist"},
    112112    "wrongly-cased locales are linked as they should be" );
     113
     114$output = $guide->display_node( id => "Does not exist",
     115                                return_output => 1
     116                              );
     117like( $output, qr{\QWe don't have a node called "Does not exist".},
     118    "not found message shows up" );
     119unlike( $output, qr{\QRevision 0},
     120    "bogus revision number doesn't show up" );
     121unlike( $output, qr{\QLast edited},
     122    "bogus last edited doesn't show up" );
  • trunk/templates/navbar.tt

    r1236 r1269  
    1313  [% INCLUDE navbar_locales.tt %]
    1414 </div>
     15[% UNLESS empty_node %]
    1516  [% INCLUDE navbar_revision_info.tt %]
     17[% END %]
    1618
    1719</div>
  • trunk/templates/node.tt

    r1237 r1269  
    6969  </h2>
    7070[% END %]
    71 [% IF not (content || coord_field_1_value || coord_field_2_value || latitude || longitude) %]
     71[% IF empty_node %]
    7272</div>
    7373<div id="nonexistent_node_message">We don't have a node called "[% node_name %]". Would you like to <a href="[% full_cgi_url %]?action=edit;id=[% node_param %]">create it</a>?</div>
Note: See TracChangeset for help on using the changeset viewer.