Fixed ticket editing, and ticket overview size.
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
/* Base Layout Components */
|
||||
.ticket-container {
|
||||
width: 90%;
|
||||
height: auto !important;
|
||||
min-height: 900px !important;
|
||||
min-width: 800px;
|
||||
max-width: 1800px;
|
||||
margin: 40px auto;
|
||||
@ -125,9 +127,18 @@ input.editable {
|
||||
|
||||
textarea.editable {
|
||||
width: calc(100% - 20px);
|
||||
min-height: 150px;
|
||||
resize: vertical;
|
||||
min-height: 800px !important;
|
||||
height: auto !important; /* Allow it to grow with content */
|
||||
box-sizing: border-box;
|
||||
white-space: pre; /* Preserve formatting */
|
||||
font-family: monospace; /* Better for ASCII art */
|
||||
line-height: 1.2; /* Tighter line spacing for ASCII art */
|
||||
}
|
||||
|
||||
#description-tab {
|
||||
min-height: 850px !important; /* Slightly larger than the textarea */
|
||||
height: auto !important;
|
||||
padding-bottom: 20px; /* Add some padding at the bottom */
|
||||
}
|
||||
|
||||
.editable:disabled {
|
||||
|
||||
@ -492,21 +492,15 @@ function resetHamburgerEditMode() {
|
||||
}
|
||||
|
||||
function createHamburgerMenu() {
|
||||
// Create hamburger menu container
|
||||
const hamburgerMenu = document.createElement('div');
|
||||
hamburgerMenu.className = 'hamburger-menu';
|
||||
|
||||
// Check if we're on a ticket page
|
||||
const isTicketPage = window.location.pathname.includes('ticket.php');
|
||||
|
||||
if (isTicketPage) {
|
||||
// Get current values from existing select elements
|
||||
const selects = document.querySelectorAll('select.editable');
|
||||
const values = {};
|
||||
selects.forEach(select => {
|
||||
select.dataset.originalValue = select.value;
|
||||
});
|
||||
|
||||
if (isTicketPage && window.ticketData) {
|
||||
// Use the ticket data from the global variable
|
||||
const values = window.ticketData;
|
||||
|
||||
hamburgerMenu.innerHTML = `
|
||||
<div class="hamburger-icon">☰</div>
|
||||
<div class="hamburger-content">
|
||||
@ -552,13 +546,12 @@ function createHamburgerMenu() {
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
const hamburgerEditButton = hamburgerMenu.querySelector('#hamburgerEditButton');
|
||||
if (hamburgerEditButton) {
|
||||
hamburgerEditButton.addEventListener('click', toggleHamburgerEditMode);
|
||||
} else {
|
||||
console.error("Error: #hamburgerEditButton not found!");
|
||||
}
|
||||
// Add event listener for Escape key press
|
||||
|
||||
document.addEventListener('keydown', (event) => {
|
||||
if (event.key === 'Escape') {
|
||||
cancelHamburgerEdit();
|
||||
|
||||
@ -161,6 +161,32 @@ function addComment() {
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Show description tab by default
|
||||
showTab('description');
|
||||
|
||||
// Add the auto-resize functionality here
|
||||
// Auto-resize the description textarea to fit content
|
||||
const descriptionTextarea = document.querySelector('textarea[data-field="description"]');
|
||||
|
||||
function autoResizeTextarea() {
|
||||
// Reset height to auto to get the correct scrollHeight
|
||||
descriptionTextarea.style.height = 'auto';
|
||||
// Set the height to match the scrollHeight
|
||||
descriptionTextarea.style.height = descriptionTextarea.scrollHeight + 'px';
|
||||
}
|
||||
|
||||
// Initial resize
|
||||
autoResizeTextarea();
|
||||
|
||||
// Resize on input when in edit mode
|
||||
descriptionTextarea.addEventListener('input', autoResizeTextarea);
|
||||
|
||||
// Also resize when edit mode is toggled
|
||||
const originalToggleEditMode = window.toggleEditMode;
|
||||
if (typeof originalToggleEditMode === 'function') {
|
||||
window.toggleEditMode = function() {
|
||||
originalToggleEditMode.apply(this, arguments);
|
||||
setTimeout(autoResizeTextarea, 0);
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
function showTab(tabName) {
|
||||
|
||||
Reference in New Issue
Block a user