This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/steve.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 71a0481  STV UI updates
71a0481 is described below

commit 71a0481d04a5b1e637ffa1e40520aac8875fe431
Author: Daniel Gruno <[email protected]>
AuthorDate: Sat Feb 8 13:35:38 2025 +0100

    STV UI updates
    
    - if a candidate name is very long, don't display it in the tooltips
    - fix drag'n'drop for embedded images
---
 pysteve/www/htdocs/js/steve_stv.js | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/pysteve/www/htdocs/js/steve_stv.js 
b/pysteve/www/htdocs/js/steve_stv.js
index ed1a263..ab37ffb 100644
--- a/pysteve/www/htdocs/js/steve_stv.js
+++ b/pysteve/www/htdocs/js/steve_stv.js
@@ -146,10 +146,13 @@ function drawCandidates() {
         outer.setAttribute("id", name)
         outer.setAttribute("data", name)
         inner.setAttribute("data", name)
+        inner.setAttribute("draggable", "false")
         outer.setAttribute("draggable", "true")
         outer.setAttribute("ondragstart", "dragVote(event)")
         outer.appendChild(inner)
-        outer.setAttribute("title", "Drag to move "  + name + " to the ballot 
box")
+        // if it's a super long name, like a data blob, don't tooltip it
+        if (name.length > 32) outer.setAttribute("title", "Drag to move the 
candidate to the ballot box")
+        else outer.setAttribute("title", "Drag to move "  + name + " to the 
ballot box")
         outer.setAttribute("ondrop", "dropCandidate(event, false)")
         outer.setAttribute("ondragover", "event.preventDefault();")
         outer.setAttribute("ondragend", "event.preventDefault();")
@@ -159,7 +162,9 @@ function drawCandidates() {
         if (statements[char]) {
             var statement = document.createElement('div')
             statement.setAttribute("class", "statement_marker")
-            statement.setAttribute("title", "Click to read " + name + "'s 
statement")
+            // if it's a super long name, like a data blob, don't tooltip it
+            if (name.length > 32) statement.setAttribute("title", "Click to 
read the candidate's statement")
+            else statement.setAttribute("title", "Click to read " + name + "'s 
statement")
             statement.setAttribute("onclick", 
"location.hash='#statement_"+char+"';")
             statement.innerHTML = "<a href='#statement_"+char+"'>Statement</a>"
 

Reply via email to