Author: kake Date: 2012-04-27 19:04:12 +0100 (Fri, 27 Apr 2012) New Revision: 1370
Added: trunk/templates/node_image.tt Modified: trunk/Build.PL trunk/MANIFEST trunk/t/43_preview_edits.t trunk/templates/edit_form.tt trunk/templates/node.tt trunk/templates/node_image_fields.tt Log: Make sure node image shows up on edit preview.
Modified: trunk/Build.PL =================================================================== --- trunk/Build.PL 2012-04-27 16:30:27 UTC (rev 1369) +++ trunk/Build.PL 2012-04-27 18:04:12 UTC (rev 1370) @@ -418,6 +418,7 @@ "newpage.tt", "node.tt", "node_history.tt", + "node_image.tt", "node_image_fields.tt", "node_photo_notes.tt", "node_rdf.tt",
Modified: trunk/MANIFEST =================================================================== --- trunk/MANIFEST 2012-04-27 16:30:27 UTC (rev 1369) +++ trunk/MANIFEST 2012-04-27 18:04:12 UTC (rev 1370) @@ -69,6 +69,7 @@ templates/newpage.tt templates/node.tt templates/node_history.tt +templates/node_image.tt templates/node_image_fields.tt templates/node_photo_notes.tt templates/node_rdf.tt
Modified: trunk/t/43_preview_edits.t =================================================================== --- trunk/t/43_preview_edits.t 2012-04-27 16:30:27 UTC (rev 1369) +++ trunk/t/43_preview_edits.t 2012-04-27 18:04:12 UTC (rev 1370) @@ -15,19 +15,23 @@ plan skip_all => "Test::HTML::Content not installed"; }
-plan tests => 1; +plan tests => 6;
# Clear out the database from any previous runs. - OpenGuides::Test::refresh_db(); +OpenGuides::Test::refresh_db();
my $config = OpenGuides::Test->make_basic_config; my $guide = OpenGuides->new( config => $config ); my $wiki = $guide->wiki;
my $q = OpenGuides::Test->make_cgi_object( - content => "I am some content.", - summary => "I am a summary.", - ); + content => "I am some content.", + summary => "I am a summary.", + node_image => "http://example.com/image.png", + node_image_copyright => "PhotoKake", + node_image_licence => "http://example.com/licence", + node_image_url => "http://example.com/info", +);
# Get a checksum for a "blank" node. my %node_data = $wiki->retrieve_node( "Clapham Junction Station" ); @@ -42,5 +46,18 @@ # Strip Content-Type header to stop Test::HTML::Content getting confused. $output =~ s/^Content-Type.*[\r\n]+//m;
-Test::HTML::Content::text_ok( $output, "I am a summary.", - "Summary shows up in preview." ); +my $warned; +eval { + local $SIG{__WARN__} = sub { $warned = 1; }; + Test::HTML::Content::text_ok( $output, "I am a summary.", + "Summary shows up in preview." ); +}; +ok( !$warned, "...and HTML seems to be valid" ); +Test::HTML::Content::tag_ok( $output, "img", + { src => "http://example.com/image.png" }, + "Image URL shows up too" ); +like( $output, qr|©\s+PhotoKake|, "...so does image copyright holder" ); +Test::HTML::Content::link_ok( $output, "http://example.com/licence", + "...and we link to the licence" ); +Test::HTML::Content::link_ok( $output, "http://example.com/info", + "...and we link to the info page" );
Modified: trunk/templates/edit_form.tt =================================================================== --- trunk/templates/edit_form.tt 2012-04-27 16:30:27 UTC (rev 1369) +++ trunk/templates/edit_form.tt 2012-04-27 18:04:12 UTC (rev 1370) @@ -34,6 +34,7 @@ [% IF summary %] <div id="summary">[% summary %]</div> [% END %] + [% INCLUDE node_image.tt %] [% INCLUDE display_metadata.tt %] [% preview_html %] </div> @@ -416,6 +417,7 @@ [% IF summary %] <div id="summary">[% summary %]</div> [% END %] + [% INCLUDE node_image.tt %] [% INCLUDE display_metadata.tt %] [% preview_html %] </div>
Modified: trunk/templates/node.tt =================================================================== --- trunk/templates/node.tt 2012-04-27 16:30:27 UTC (rev 1369) +++ trunk/templates/node.tt 2012-04-27 18:04:12 UTC (rev 1370) @@ -48,26 +48,7 @@ [% END %] [% END %]
-[% IF node_image %] - <div id="node_image_box"> - [% IF node_image_url %]<a href="[% node_image_url %]">[% END %] - <img id="node_image" src="[% node_image %]" - alt="Picture of [% node_name %]" /> - [% IF node_image_url %]</a>[% END %] - [% IF node_image_copyright %] - <div id="node_image_copyright"> - [% IF node_image_licence %] - <a href="[% node_image_licence %]">© - [% node_image_copyright %]</a> - [% ELSE %] - © [% node_image_copyright %] - [% END %] - </div> - [% END %] - </div> -[% ELSE %] - <span id="node_no_image" /> -[% END %] +[% INCLUDE node_image.tt %]
<div id="node_title"> [% IF current %]
Added: trunk/templates/node_image.tt =================================================================== --- trunk/templates/node_image.tt (rev 0) +++ trunk/templates/node_image.tt 2012-04-27 18:04:12 UTC (rev 1370) @@ -0,0 +1,20 @@ +[% IF node_image %] + <div id="node_image_box"> + [% IF node_image_url %]<a href="[% node_image_url %]">[% END %] + <img id="node_image" src="[% node_image %]" + alt="Picture of [% node_name %]" /> + [% IF node_image_url %]</a>[% END %] + [% IF node_image_copyright %] + <div id="node_image_copyright"> + [% IF node_image_licence %] + <a href="[% node_image_licence %]">© + [% node_image_copyright %]</a> + [% ELSE %] + © [% node_image_copyright %] + [% END %] + </div> + [% END %] + </div> +[% ELSE %] + <span id="node_no_image" /> +[% END %]
Modified: trunk/templates/node_image_fields.tt =================================================================== --- trunk/templates/node_image_fields.tt 2012-04-27 16:30:27 UTC (rev 1369) +++ trunk/templates/node_image_fields.tt 2012-04-27 18:04:12 UTC (rev 1370) @@ -2,7 +2,7 @@ <legend>Image to illustrate this page</legend>
<div class="edit_form_group" id="node_image_group"> - <label for="node_image"> + <label for="node_image_input"> [% IF conflict %] Current image: [% ELSE %] @@ -10,7 +10,7 @@ [% END %] </label> <div class="edit_box"> - <input type="text" size="50" id="node_image" name="node_image" + <input type="text" size="50" id="node_image_input" name="node_image" value="[% node_image %]" /> [% INCLUDE node_photo_notes.tt %] </div> @@ -25,7 +25,7 @@ </div>
<div class="edit_form_group" id="node_image_copyright_group"> - <label for="node_image_copyright"> + <label for="node_image_copyright_input"> [% IF conflict %] Current copyright holder: [% ELSE %] @@ -33,7 +33,7 @@ [% END %] </label> <div class="edit_box"> - <input type="text" size="50" id="node_image_copyright" + <input type="text" size="50" id="node_image_copyright_input" name="node_image_copyright" value="[% node_image_copyright %]" /> </div> [% IF conflict %]
openguides-commits@lists.openguides.org