From 715232cba02b4fb1debb5488fb2ea246b6178ce5 Mon Sep 17 00:00:00 2001 From: Matt Zagrabelny Date: Wed, 1 Feb 2017 10:55:46 -0600 Subject: [PATCH] Fixes for #1906 Using the CSS attribute/value "table-layout: fixed" for the subnet view table gives each cell equal width. Extend htdocs/generic/data_table.mhtml to allow passing of CSS classes to the component for the HTML table it generates. Remove extraneous semicolons for %args block. --- htdocs/css/style.css | 5 ++++- htdocs/generic/data_table.mhtml | 22 ++++++++++++++++------ htdocs/management/subnet.mhtml | 8 ++++++-- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/htdocs/css/style.css b/htdocs/css/style.css index ae38f64ca..73d099918 100644 --- a/htdocs/css/style.css +++ b/htdocs/css/style.css @@ -431,7 +431,10 @@ div.clear { clear: both } padding: 4px; } - +table.ip_block_subnet_view { + width: 100%; + table-layout: fixed; +} .formtablec1 { background-color: #ffffee; text-align: right} .formtablec2 { background-color: #f0f7e9; text-align: left; vertical-align: bottom; } diff --git a/htdocs/generic/data_table.mhtml b/htdocs/generic/data_table.mhtml index 02f9070c3..51c2a3a7c 100644 --- a/htdocs/generic/data_table.mhtml +++ b/htdocs/generic/data_table.mhtml @@ -21,17 +21,27 @@ Arguments: <%args> -@field_headers => undef; -@data => (); -$subclass => ""; -@style => (); -@rowstyle => (); +@field_headers => undef +@data => () +$subclass => "" +@style => () +@rowstyle => () +@table_classes => () +<%init> +my $table_classes = undef; +if (@table_classes > 0) { + # build the classes attribute for the table element... + $table_classes = join ' ', @table_classes; + $table_classes = qq{class="$table_classes"}; +} + + % if( $subclass ) { $subclass = '_'.$subclass; } - +
> % if ( @style ){ % for (my $i=0; $i < scalar @field_headers; $i++) { diff --git a/htdocs/management/subnet.mhtml b/htdocs/management/subnet.mhtml index ca547078d..b73797b5f 100644 --- a/htdocs/management/subnet.mhtml +++ b/htdocs/management/subnet.mhtml @@ -221,5 +221,9 @@ for( my $i=0; $i<($num/$cols); $i++ ) { -<& /generic/data_table.mhtml, field_headers=>\@headers, data=>\@rows, subclass=>"ipb" &> - +<& /generic/data_table.mhtml, + field_headers => \@headers, + data => \@rows, + subclass => "ipb", + table_classes => ('ip_block_subnet_view'), +&>