Fix PHP parse error and CSS/JS follow-on fixes
- DashboardView.php: fix PHP parse error on line 456/472/473/474 caused by
escaped double-quotes {$row[\"key\"]} inside double-quoted echo strings;
replaced with safe string concatenation . $row['key'] .
- ticket.css: fix status-select hover/focus border rgba(white) → terminal palette
- ticket.js: add null guards to addComment, togglePreview, updatePreview,
toggleMarkdownMode, and addDependency element lookups
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1367,12 +1367,12 @@ body.dark-mode .timeline-date {
|
||||
|
||||
.status-select:hover {
|
||||
opacity: 0.9;
|
||||
border-color: rgba(255, 255, 255, 0.3);
|
||||
border-color: rgba(0, 255, 65, 0.4);
|
||||
}
|
||||
|
||||
.status-select:focus {
|
||||
outline: none;
|
||||
border-color: rgba(255, 255, 255, 0.5);
|
||||
border-color: var(--terminal-amber);
|
||||
}
|
||||
|
||||
/* Status colors for dropdown */
|
||||
|
||||
@@ -134,18 +134,21 @@ function toggleEditMode() {
|
||||
}
|
||||
|
||||
function addComment() {
|
||||
const commentText = document.getElementById('newComment').value;
|
||||
const newComment = document.getElementById('newComment');
|
||||
if (!newComment) return;
|
||||
const commentText = newComment.value;
|
||||
if (!commentText.trim()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const ticketId = getTicketIdFromUrl();
|
||||
|
||||
|
||||
if (!ticketId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const isMarkdownEnabled = document.getElementById('markdownMaster').checked;
|
||||
|
||||
const markdownMaster = document.getElementById('markdownMaster');
|
||||
const isMarkdownEnabled = markdownMaster ? markdownMaster.checked : false;
|
||||
|
||||
fetch('/api/add_comment.php', {
|
||||
method: 'POST',
|
||||
@@ -171,7 +174,8 @@ function addComment() {
|
||||
.then(data => {
|
||||
if(data.success) {
|
||||
// Clear the comment box
|
||||
document.getElementById('newComment').value = '';
|
||||
const nc = document.getElementById('newComment');
|
||||
if (nc) nc.value = '';
|
||||
|
||||
// Format the comment text for display
|
||||
let displayText;
|
||||
@@ -226,10 +230,12 @@ function addComment() {
|
||||
function togglePreview() {
|
||||
const preview = document.getElementById('markdownPreview');
|
||||
const textarea = document.getElementById('newComment');
|
||||
const isPreviewEnabled = document.getElementById('markdownToggle').checked;
|
||||
|
||||
const toggleEl = document.getElementById('markdownToggle');
|
||||
if (!preview || !textarea || !toggleEl) return;
|
||||
|
||||
const isPreviewEnabled = toggleEl.checked;
|
||||
preview.style.display = isPreviewEnabled ? 'block' : 'none';
|
||||
|
||||
|
||||
if (isPreviewEnabled) {
|
||||
preview.innerHTML = parseMarkdown(textarea.value);
|
||||
textarea.addEventListener('input', updatePreview);
|
||||
@@ -239,12 +245,15 @@ function togglePreview() {
|
||||
}
|
||||
|
||||
function updatePreview() {
|
||||
const commentText = document.getElementById('newComment').value;
|
||||
const textarea = document.getElementById('newComment');
|
||||
const previewDiv = document.getElementById('markdownPreview');
|
||||
const isMarkdownEnabled = document.getElementById('markdownMaster').checked;
|
||||
|
||||
const masterEl = document.getElementById('markdownMaster');
|
||||
if (!textarea || !previewDiv || !masterEl) return;
|
||||
|
||||
const commentText = textarea.value;
|
||||
const isMarkdownEnabled = masterEl.checked;
|
||||
|
||||
if (isMarkdownEnabled && commentText.trim()) {
|
||||
// For markdown preview, use parseMarkdown which handles line breaks correctly
|
||||
previewDiv.innerHTML = parseMarkdown(commentText);
|
||||
previewDiv.style.display = 'block';
|
||||
} else {
|
||||
@@ -254,12 +263,15 @@ function updatePreview() {
|
||||
|
||||
function toggleMarkdownMode() {
|
||||
const previewToggle = document.getElementById('markdownToggle');
|
||||
const isMasterEnabled = document.getElementById('markdownMaster').checked;
|
||||
|
||||
const masterEl = document.getElementById('markdownMaster');
|
||||
if (!previewToggle || !masterEl) return;
|
||||
|
||||
const isMasterEnabled = masterEl.checked;
|
||||
previewToggle.disabled = !isMasterEnabled;
|
||||
if (!isMasterEnabled) {
|
||||
previewToggle.checked = false;
|
||||
document.getElementById('markdownPreview').style.display = 'none';
|
||||
const preview = document.getElementById('markdownPreview');
|
||||
if (preview) preview.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user