diff mbox series

[1/1] make current version cell scrollable

Message ID 20240213115914.392552-1-sen@hastings.org
State New
Headers show
Series [1/1] make current version cell scrollable | expand

Commit Message

Sen Hastings Feb. 13, 2024, 11:59 a.m. UTC
I realized that instead of truncating the version number,
we could simply make the cell horizontally scrollable.
This of course allows us to have a fixed cell width,
while preserving the full version number.

A demo is available here:
https://sen-h.codeberg.page/pkg-stats-demos/@pages/make-current-version-cell-scrollable.html

Signed-off-by: Sen Hastings <sen@hastings.org>
---
 support/scripts/pkg-stats | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
index 7835cb3d62..9307992d29 100755
--- a/support/scripts/pkg-stats
+++ b/support/scripts/pkg-stats
@@ -845,6 +845,13 @@  function expandField(fieldId){
 .centered {
   text-align: center;
 }
+
+ .current_version {
+   overflow: scroll;
+   width: 21ch;
+   padding: 10px 2px 10px 2px;
+ }
+
  .correct, .nopatches, .good_url, .version-good, .cpe-ok, .cve-ok {
    background: #d2ffc4;
  }
@@ -964,10 +971,7 @@  def dump_html_pkg(f, pkg):
 
     # Current version
     data_field_id = f'current_version__{pkg_css_class}'
-    if len(pkg.current_version) > 20:
-        current_version = pkg.current_version[:20] + "..."
-    else:
-        current_version = pkg.current_version
+    current_version = pkg.current_version
     f.write(f'  <div id="{data_field_id}" \
         class="centered current_version data _{pkg_css_class}">{current_version}</div>\n')