Update and move pretty tables function to a seperate js file and also add img-fluid to <img> tags so images dont run off the page and also update ticket details page with prettyContent function

This commit is contained in:
johnnyq 2023-09-26 14:22:58 -04:00
parent 1a5cd14208
commit 51489c2420
4 changed files with 21 additions and 27 deletions

View File

@ -66,7 +66,7 @@ $document_parent = intval($row['document_parent']);
<?php } ?> <?php } ?>
</div> </div>
</div> </div>
<div class="card-body" id="formatTables"> <div class="card-body prettyContent">
<?php echo $document_content; ?> <?php echo $document_content; ?>
</div> </div>
</div> </div>
@ -285,14 +285,7 @@ $document_parent = intval($row['document_parent']);
</div> </div>
<script> <script src="js/pretty_content.js"></script>
document.addEventListener("DOMContentLoaded", function(){
let tables = document.querySelectorAll('div#formatTables');
tables.forEach(function(table){
table.classList.add('table');
});
});
</script>
<?php <?php
@ -304,5 +297,3 @@ require_once("client_document_link_software_modal.php");
require_once("client_document_link_vendor_modal.php"); require_once("client_document_link_vendor_modal.php");
require_once("share_modal.php"); require_once("share_modal.php");
require_once("footer.php"); require_once("footer.php");
?>

View File

@ -48,22 +48,14 @@ $document_updated_at = nullable_htmlentities($row['document_updated_at']);
</button> </button>
</div> </div>
</div> </div>
<div class="card-body" id="formatTables"> <div class="card-body prettyContent">
<?php echo $document_content; ?> <?php echo $document_content; ?>
</div> </div>
</div> </div>
<script> <script src="js/pretty_content.js"></script>
document.addEventListener("DOMContentLoaded", function(){
let tables = document.querySelectorAll('div#formatTables');
tables.forEach(function(table){
table.classList.add('table');
});
});
</script>
<?php <?php
require_once("document_template_edit_modal.php"); require_once("document_template_edit_modal.php");
require_once("footer.php"); require_once("footer.php");

7
js/pretty_content.js Normal file
View File

@ -0,0 +1,7 @@
$(document).ready(function(){
// Add class to tables
$('div.prettyContent table').addClass('table');
// Add img-responsive class to img tags
$('div.prettyContent img').addClass('img-fluid');
});

View File

@ -269,7 +269,7 @@ if (isset($_GET['ticket_id'])) {
<h3 class="card-title text-bold"><?php echo $ticket_subject; ?></h3> <h3 class="card-title text-bold"><?php echo $ticket_subject; ?></h3>
</div> </div>
<div class="card-body"> <div class="card-body prettyContent">
<?php echo $ticket_details; ?> <?php echo $ticket_details; ?>
<?php <?php
@ -402,11 +402,13 @@ if (isset($_GET['ticket_id'])) {
<div class="media-body"> <div class="media-body">
<?php echo $ticket_reply_by_display; ?> <?php echo $ticket_reply_by_display; ?>
<br> <div>
<small class="text-muted"><?php echo $ticket_reply_created_at; ?> <?php if (!empty($ticket_reply_updated_at)) { echo "modified: $ticket_reply_updated_at"; } ?></small> <small class="text-muted"><?php echo $ticket_reply_created_at; ?> <?php if (!empty($ticket_reply_updated_at)) { echo "modified: $ticket_reply_updated_at"; } ?></small>
<br> </div>
<?php if ($ticket_reply_type !== "Client") { ?> <?php if ($ticket_reply_type !== "Client") { ?>
<div>
<small class="text-muted">Time worked: <?php echo date_format($ticket_reply_time_worked, 'H:i:s'); ?></small> <small class="text-muted">Time worked: <?php echo date_format($ticket_reply_time_worked, 'H:i:s'); ?></small>
</div>
<?php } ?> <?php } ?>
</div> </div>
</div> </div>
@ -435,7 +437,7 @@ if (isset($_GET['ticket_id'])) {
</div> </div>
<div class="card-body"> <div class="card-body prettyContent">
<?php echo $ticket_reply; ?> <?php echo $ticket_reply; ?>
<?php <?php
@ -823,3 +825,5 @@ if ($ticket_status !== "Closed") { ?>
<?php } ?> <?php } ?>
<script src="js/ticket_add_remove_watchers.js"></script> <script src="js/ticket_add_remove_watchers.js"></script>
<script src="js/pretty_content.js"></script>