Index: templates/header.tt =================================================================== --- templates/header.tt (revision 1177) +++ templates/header.tt (working copy) @@ -55,6 +55,9 @@ [% IF deter_robots %] [% END %] + [% UNLESS not_editable %] + +[% END %] [% IF enable_gmaps AND display_google_maps AND gmaps_api_key %] [% END %] Index: t/85_universal_edit.t =================================================================== --- t/85_universal_edit.t (revision 0) +++ t/85_universal_edit.t (revision 0) @@ -0,0 +1,61 @@ +use strict; +use OpenGuides; +use OpenGuides::Test; +use Test::More; +use Wiki::Toolkit::Setup::SQLite; + +eval { require DBD::SQLite; }; +if ( $@ ) { + plan skip_all => "DBD::SQLite not installed - no database to test with"; + exit 0; +} + + +plan tests => 2; + +# test that an editable page gets the universal edit and that a non-editable one doesnt. + +my ( $config, $guide, $wiki, $cookie, $output ); + +# Clear out the database from any previous runs. +unlink "t/node.db"; +unlink ; +Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + +# Make a guide. +$config = OpenGuides::Test->make_basic_config; +$guide = OpenGuides->new( config => $config ); +my $wiki = $guide->wiki; + +# Write a node. +OpenGuides::Test->write_data( + guide => $guide, + node => "Red Lion", + ); + +$output = $guide->display_node( + id => "Red Lion", + return_output => 1, + ); +like( $output, qr|output( + wiki => $wiki, + config => $config, + template => "preferences.tt", + noheaders => 1, + vars => { + not_editable => 1, + show_form => 1 + }, + ); +}