334bc34cbe
Fix "Illegal invocation" JavaScript error when opening edit modal: - Remove Bootstrap 2 'hide' class from modal markup - Add proper Bootstrap 5 modal structure (modal-dialog/modal-content) - Update JavaScript to use Bootstrap 5 Modal API - Load dynamic content into .modal-content instead of root modal - Remove legacy data-toggle attribute from button The modal now uses the correct Bootstrap 5.3 structure and API, resolving selector-engine.js errors. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
66 lines
1.7 KiB
Plaintext
Executable File
66 lines
1.7 KiB
Plaintext
Executable File
<div id="dt_example" class="example_alt_pagination">
|
|
<table class="table table-striped table-hover table-bordered pull-left" id="data-table">
|
|
<thead>
|
|
<tr>
|
|
<th>
|
|
Name
|
|
</th>
|
|
<th>
|
|
Email
|
|
</th>
|
|
<th>
|
|
Admin User
|
|
</th>
|
|
<th>
|
|
Action
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<% @users.each do |u|%>
|
|
<tr>
|
|
<td style="word-wrap:break-word;">
|
|
<%= "#{u.first_name} #{u.last_name}"%>
|
|
</td>
|
|
<td>
|
|
<%= u.email%>
|
|
</td>
|
|
<td>
|
|
<%= u.admin ? %{<span class="fs1" aria-label="check" data-icon=""}.html_safe : nil %>
|
|
</td>
|
|
<td>
|
|
<%= link_to "Edit", "#", {:onClick => "javascript:openEditModal(#{u.id});", :role => "button", :style => "width:70px", :class => "btn btn-inverse"}%>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<div id="editAcct" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel1" aria-hidden="true">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<!-- Content will be loaded here dynamically -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="clearfix">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
|
|
function openEditModal(id){
|
|
var link = '/admin/'+ id +'/get_user';
|
|
$("#editAcct .modal-content").load(link);
|
|
var modal = new bootstrap.Modal(document.getElementById('editAcct'));
|
|
modal.show();
|
|
};
|
|
|
|
function dataTablePagination(){
|
|
$('#data-table').dataTable({
|
|
"sPaginationType": "full_numbers"
|
|
});
|
|
};
|
|
|
|
$(document).ready(dataTablePagination());
|
|
</script> |