This commit is contained in:
2025-03-31 12:06:01 -06:00
parent 5125612c05
commit f4f5077210
3 changed files with 24 additions and 6 deletions
+4 -1
View File
@@ -35,13 +35,16 @@
}
if ($_SERVER['SCRIPT_NAME'] == '/admin.php') {
echo '
<script src="js/clickable_rows.js"></script>
';
$args = get_args_from_url();
if (isset($args['view'])) {
if ($args['view'] == 'users') {
echo '
<script src="js/upload.js"></script>
';
';
}
}
}
+5 -5
View File
@@ -49,7 +49,7 @@ function admin_article_view()
<table>
<thead>
<tr>
<th>Select</th>
<th class="">Select</th>
<th>Article ID</th>
<th>Author</th>
<th>Title</th>
@@ -67,8 +67,8 @@ function admin_article_view()
foreach ($results as $key => $result) {
$display .= '
<tr>
<td>
<tr data-href="articles.php?action=view&article_id=' . $result['article_id'] . '">
<td class="excluded_cell">
<label class="form_checkbox_container">
<input name="selected_articles[]" value="' . $result['article_id'] . '" type="checkbox">
<span class="checkmark"></span>
@@ -139,8 +139,8 @@ function admin_user_view()
foreach ($results as $key => $result) {
$display .= '
<tr>
<td>
<tr data-href="user.php?action=view&user_id=' . $result['user_id'] . '">
<td class="excluded_cell">
<label class="form_checkbox_container">
<input name="selected_users[]" value="' . $result['user_id'] . '" type="checkbox">
<span class="checkmark"></span>
+15
View File
@@ -0,0 +1,15 @@
document.addEventListener('DOMContentLoaded', function() {
const rows = document.querySelectorAll('tbody tr');
rows.forEach(row => {
row.addEventListener('click', function(event) {
// Check if the clicked element is within the non-clickable cell
if (event.target.closest('.excluded_cell')) {
return; // Do nothing if clicked inside the non-clickable cell
}
// Perform the desired action (e.g., redirect)
window.location.href = this.dataset.href; // Example redirect
});
});
});