This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<form action="" id="analytics_search">
|
||||
Search by IP: <input type="text" id="ip" name="ip"><br />
|
||||
<input type="checkbox" value="" id="field_ip_address" name="field[ip_address]"> IP Address<br />
|
||||
<input type="checkbox" value="" id="field_referrer" name="field[referrer]"> Referrer<br />
|
||||
<input type="checkbox" value="" id="field_user_agent" name="field[user_agent]"> User Agent
|
||||
</form>
|
||||
|
||||
<div id="dt_example" class="example_alt_pagination">
|
||||
<table class="table table-striped table-hover table-bordered pull-left <%= "custom" if params[:field] %>" id="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<%
|
||||
count = (params[:field] ? (custom_fields.count+1) : 6)
|
||||
count.times do %>
|
||||
<th> </th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @analytics.each do |a|%>
|
||||
<tr>
|
||||
<% a.attributes.each do |k,v| %>
|
||||
<td><%= v %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<div id="editAcct" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel1" aria-hidden="true">
|
||||
</div>
|
||||
<div class="clearfix">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= javascript_include_tag "jquery.dataTables.min.js"%>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function dataTablePagination(){
|
||||
$('#data-table').dataTable({
|
||||
"sPaginationType": "full_numbers"
|
||||
});
|
||||
};
|
||||
|
||||
$(document).ready(dataTablePagination());
|
||||
</script>
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<!-- Success Alert -->
|
||||
<div id="success" style="display: none;" class="alert alert-success alert-dismissible fade show" role="alert">
|
||||
<div class="d-flex align-items-center">
|
||||
<i class="bi bi-check-circle-fill me-2" style="font-size: 1.5rem;"></i>
|
||||
<div>
|
||||
<h5 class="alert-heading mb-1">Success!</h5>
|
||||
<p class="mb-0">User information successfully updated.</p>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
|
||||
<!-- Error Alert -->
|
||||
<div id="failure" style="display: none;" class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
<div class="d-flex align-items-center">
|
||||
<i class="bi bi-exclamation-triangle-fill me-2" style="font-size: 1.5rem;"></i>
|
||||
<div>
|
||||
<h5 class="alert-heading mb-1">Error!</h5>
|
||||
<p class="mb-0">Something went wrong. Please try again.</p>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
|
||||
<!-- User Management Card -->
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-header bg-white py-3">
|
||||
<h4 class="mb-0">
|
||||
<i class="bi bi-people-fill text-primary"></i> Manage Users
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<div id="userDataTable" class="card-body p-0">
|
||||
<!-- Loading state -->
|
||||
<div class="text-center py-5">
|
||||
<div class="spinner-border text-primary" role="status">
|
||||
<span class="visually-hidden">Loading users...</span>
|
||||
</div>
|
||||
<p class="text-muted mt-3">Loading user data...</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= javascript_include_tag "jquery.dataTables.min.js" %>
|
||||
|
||||
<script type="text/javascript">
|
||||
function makeActive() {
|
||||
$('li[id="admin"]').addClass('active');
|
||||
}
|
||||
|
||||
function loadTable() {
|
||||
$("#userDataTable").load("/admin/" + <%= params[:admin_id] %> + "/get_all_users");
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
makeActive();
|
||||
loadTable();
|
||||
});
|
||||
|
||||
// Handle Turbolinks page loads
|
||||
$(document).on('turbolinks:load', function() {
|
||||
makeActive();
|
||||
});
|
||||
</script>
|
||||
Executable
+63
@@ -0,0 +1,63 @@
|
||||
<div class="container-fluid">
|
||||
<!-- Header -->
|
||||
<div class="row mb-4">
|
||||
<div class="col-12">
|
||||
<h2 class="mb-3">
|
||||
<i class="bi bi-people-fill text-primary"></i> Manage Users
|
||||
</h2>
|
||||
<p class="text-muted">View and manage all system users</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Users Table -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body">
|
||||
<div id="dt_example" class="example_alt_pagination">
|
||||
<table class="table table-striped table-hover table-bordered" 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 class="text-center">
|
||||
<%= u.admin ? '<i class="bi bi-check-circle-fill text-success" title="Admin"></i>'.html_safe : '<i class="bi bi-dash-circle text-muted" title="Not Admin"></i>'.html_safe %>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to admin_get_user_path(u.id), class: "btn btn-sm btn-outline-primary" do %>
|
||||
<i class="bi bi-pencil"></i> Edit
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function dataTablePagination(){
|
||||
$('#data-table').dataTable({
|
||||
"sPaginationType": "full_numbers"
|
||||
});
|
||||
};
|
||||
|
||||
$(document).ready(dataTablePagination());
|
||||
</script>
|
||||
Executable
+55
@@ -0,0 +1,55 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-lg-8 mx-auto">
|
||||
<div class="card shadow-sm mt-4">
|
||||
<div class="card-header bg-white d-flex justify-content-between align-items-center py-3">
|
||||
<h4 class="mb-0">
|
||||
<i class="bi bi-person-gear text-primary"></i> Edit User Account
|
||||
</h4>
|
||||
<%= link_to "Back to Users", admin_get_all_users_path(current_user.id), class: "btn btn-outline-secondary btn-sm" %>
|
||||
</div>
|
||||
<div class="card-body p-4">
|
||||
<%= form_for @user, url: admin_update_user_path(params[:admin_id]), method: :patch do |f| %>
|
||||
<div class="mb-3">
|
||||
<%= f.label :email, nil, {:class => "form-label"}%>
|
||||
<%= f.text_field :email, {:class => "form-control"}%>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<%= f.label :first_name, nil, {:class => "form-label"}%>
|
||||
<%= f.text_field :first_name, {:class => "form-control"} %>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<%= f.label :last_name, nil, {:class => "form-label"}%>
|
||||
<%= f.text_field :last_name, {:class => "form-control"} %>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<%= f.label :password, "Password (leave blank to keep current)", {:class => "form-label"}%>
|
||||
<%= f.password_field :password, {:class => "form-control", :placeholder => "Enter new password"}%>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<%= f.label :password_confirmation, nil, {:class => "form-label"}%>
|
||||
<%= f.password_field :password_confirmation, {:class => "form-control", :placeholder => "Confirm new password"} %>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<%= f.label :admin, "Administrator", {:class => "form-label"}%>
|
||||
<%= f.select(:admin, @admin_select, {}, {:class => "form-select"}) %>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-between">
|
||||
<%= link_to "Delete User", admin_delete_user_path(params[:admin_id]), method: :post, data: { confirm: "Are you sure you want to delete this user?" }, class: "btn btn-danger" %>
|
||||
<div>
|
||||
<%= link_to "Cancel", admin_get_all_users_path(current_user.id), class: "btn btn-secondary me-2" %>
|
||||
<%= f.submit "Save Changes", class: "btn btn-primary" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user