From 0861e05531b9acc855c4f946e93ff9c42a06ff8a Mon Sep 17 00:00:00 2001 From: Bob Terrell Date: Thu, 23 Aug 2018 14:55:55 -0400 Subject: [PATCH] Fix several issues with table headers in Safari MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The width += 1 does not apply to Safari, either. Safari requires min-width and max-width to be set. “width” is not honored. Add a line break to template so comments stay on separate line. Moved browser checks to higher scope; the user agent only needs to be checked once, not once per cell. Signed-off-by: Bob Terrell --- js/sql.js | 12 ++++++++---- templates/display/results/comment_for_row.twig | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/js/sql.js b/js/sql.js index fd648b8e3136..77926e32e136 100644 --- a/js/sql.js +++ b/js/sql.js @@ -1056,14 +1056,18 @@ function rearrangeStickyColumns ($sticky_columns, $table_results) { var $originalHeader = $table_results.find('thead'); var $originalColumns = $originalHeader.find('tr:first').children(); var $clonedHeader = $originalHeader.clone(); + var is_firefox = navigator.userAgent.indexOf('Firefox') > -1; + var is_safari = navigator.userAgent.indexOf('Safari') > -1; // clone width per cell - $clonedHeader.find('tr:first').children().width(function (i,val) { + $clonedHeader.find('tr:first').children().each(function (i) { var width = $originalColumns.eq(i).width(); - var is_firefox = navigator.userAgent.indexOf('Firefox') > -1; - if (! is_firefox) { + if (! is_firefox && ! is_safari) { width += 1; } - return width; + $(this).width(width); + if (is_safari) { + $(this).css('min-width', width).css('max-width', width); + } }); $sticky_columns.empty().append($clonedHeader); } diff --git a/templates/display/results/comment_for_row.twig b/templates/display/results/comment_for_row.twig index 5380b71dc01a..f232375115aa 100644 --- a/templates/display/results/comment_for_row.twig +++ b/templates/display/results/comment_for_row.twig @@ -1,6 +1,6 @@ {% if comments_map[fields_meta.table] is defined and comments_map[fields_meta.table][fields_meta.name] is defined %} - +
{% if comments_map[fields_meta.table][fields_meta.name]|length > limit_chars %} {{ comments_map[fields_meta.table][fields_meta.name]|slice(0, limit_chars) }}… {% else %}