From 16cedbacad42034be4eed965fe54b4892b6ed454 Mon Sep 17 00:00:00 2001 From: Edward Oakley <47759261+fatchild@users.noreply.github.com> Date: Fri, 13 Sep 2024 15:37:36 +0100 Subject: [PATCH] ejo - conditionally render form fields within a table to support older version of eprints <3.4.2 (#8) --- lib/plugins/EPrints/Plugin/Screen/Report.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/plugins/EPrints/Plugin/Screen/Report.pm b/lib/plugins/EPrints/Plugin/Screen/Report.pm index ce6ae05..074552e 100644 --- a/lib/plugins/EPrints/Plugin/Screen/Report.pm +++ b/lib/plugins/EPrints/Plugin/Screen/Report.pm @@ -635,9 +635,10 @@ sub render_splash_page #render possible search forms foreach my $formid (keys %search_forms) { - my $table = $repo->make_element( "table", class=>"ep_search_fields", id=>$formid, style=>"display: none" ); - $form->appendChild( $table ); - $table->appendChild( $search_forms{$formid} ); + my $fields_tag = $search_forms{$formid}->findnodes('tr')->size > 0 ? "table" : "div"; + my $fields_wrapper = $repo->make_element( $fields_tag, class=>"ep_search_fields", id=>$formid, style=>"display: none" ); + $form->appendChild( $fields_wrapper ); + $fields_wrapper->appendChild( $search_forms{$formid} ) } $form->appendChild( $self->render_controls );