fix: show full request sentences, no mid-word truncation; edit uses textarea showing full text
This commit is contained in:
parent
0e98be999c
commit
eae31d55c7
|
|
@ -450,12 +450,22 @@
|
|||
if (detailMode) {
|
||||
titleHtml = `<a href="/app/requests/${eid}" style="color:var(--ds-tx);text-decoration:none" class="hover:underline">${escHtml(title)}</a>`;
|
||||
if (d.description) {
|
||||
const descTrunc = d.description.length > 120 ? d.description.substring(0, 120) + '\u2026' : d.description;
|
||||
titleHtml += `<div style="color:var(--ds-tx3);font-size:12px;margin-top:2px">${escHtml(descTrunc)}</div>`;
|
||||
titleHtml += `<div style="color:var(--ds-tx3);font-size:12px;margin-top:2px;line-height:1.4">${escHtml(d.description)}</div>`;
|
||||
}
|
||||
} else {
|
||||
const titleTrunc = title.length > 80 ? title.substring(0, 80) + '\u2026' : title;
|
||||
titleHtml = `<a href="/app/requests/${eid}" style="color:var(--ds-tx);text-decoration:none" class="hover:underline">${escHtml(titleTrunc)}</a>`;
|
||||
// Show first complete sentence, or full title if short — no arbitrary mid-word cut-off
|
||||
let displayTitle = title;
|
||||
if (title.length > 120) {
|
||||
const sentenceEnd = title.search(/[.!?]\s/);
|
||||
if (sentenceEnd > 20 && sentenceEnd < 160) {
|
||||
displayTitle = title.substring(0, sentenceEnd + 1);
|
||||
} else {
|
||||
// Break at last word boundary before 120
|
||||
const cut = title.lastIndexOf(' ', 120);
|
||||
displayTitle = title.substring(0, cut > 40 ? cut : 120);
|
||||
}
|
||||
}
|
||||
titleHtml = `<a href="/app/requests/${eid}" style="color:var(--ds-tx);text-decoration:none;line-height:1.4" class="hover:underline">${escHtml(displayTitle)}</a>`;
|
||||
}
|
||||
|
||||
// Priority select
|
||||
|
|
@ -549,13 +559,15 @@
|
|||
const titleCell = row.querySelector('.req-title-cell');
|
||||
if (!titleCell) return;
|
||||
row.dataset.originalTitleHtml = titleCell.innerHTML;
|
||||
titleCell.innerHTML = `<div style="display:flex;align-items:center;gap:4px">
|
||||
<input type="text" style="flex:1;padding:4px 8px;background:#0a1628;border:1px solid rgba(255,255,255,.12);border-radius:6px;color:white;font-size:13px;outline:none" id="edit-title-${id}">
|
||||
<button onclick="saveEditRequest('${id}')" style="padding:2px 8px;background:#c9a84c;color:#0a1628;border:none;border-radius:4px;font-size:11px;font-weight:600;cursor:pointer">Save</button>
|
||||
<button onclick="cancelEditRequest('${id}')" style="padding:2px 8px;background:rgba(255,255,255,.08);color:white;border:none;border-radius:4px;font-size:11px;cursor:pointer">Cancel</button>
|
||||
titleCell.innerHTML = `<div style="display:flex;flex-direction:column;gap:4px;width:100%">
|
||||
<textarea rows="2" style="width:100%;padding:6px 8px;background:#0a1628;border:1px solid rgba(201,168,76,.4);border-radius:6px;color:white;font-size:13px;outline:none;resize:vertical;line-height:1.4;font-family:inherit" id="edit-title-${id}"></textarea>
|
||||
<div style="display:flex;gap:4px">
|
||||
<button onclick="saveEditRequest('${id}')" style="padding:3px 12px;background:#c9a84c;color:#0a1628;border:none;border-radius:4px;font-size:11px;font-weight:600;cursor:pointer">Save</button>
|
||||
<button onclick="cancelEditRequest('${id}')" style="padding:3px 10px;background:rgba(255,255,255,.08);color:white;border:none;border-radius:4px;font-size:11px;cursor:pointer">Cancel</button>
|
||||
</div>
|
||||
</div>`;
|
||||
const input = document.getElementById('edit-title-' + id);
|
||||
if (input) { input.value = title; input.focus(); input.select(); }
|
||||
if (input) { input.value = title; input.focus(); input.setSelectionRange(input.value.length, input.value.length); }
|
||||
}
|
||||
|
||||
function cancelEditRequest(id) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue