changed active page highlight color to warning for Participant index, also changed Participant form MCI field to only allow 10 numeric digits
This commit is contained in:
parent
52e0fbb211
commit
2830ace0d9
|
@ -19,4 +19,8 @@
|
|||
background-color: #e6e5e5da; /* Light grey color */
|
||||
}
|
||||
|
||||
.pagination .page-item.active .page-link {
|
||||
border-color: var(--bs-warning);
|
||||
}
|
||||
|
||||
|
|
@ -2,7 +2,8 @@ class ParticipantsController < ApplicationController
|
|||
before_action :set_participant, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@participants = Participant.order(:last_name).page(params[:page]).per(10) # Adjust the number per page as needed
|
||||
@participants = Participant.order(:last_name).page(params[:page]).per(5) # Adjust the number per page as needed
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -10,25 +10,25 @@
|
|||
<nav aria-label="Page navigation">
|
||||
<ul class="pagination">
|
||||
<li class="page-item <%= 'disabled' if current_page.first? %>">
|
||||
<%= link_to 'First', participants_path(page: 1), class: 'page-link' unless current_page.first? %>
|
||||
<%= link_to 'First', participants_path(page: 1), class: 'page-link bg-secondary text-white' unless current_page.first? %>
|
||||
</li>
|
||||
<li class="page-item <%= 'disabled' if current_page.first? %>">
|
||||
<%= link_to 'Previous', participants_path(page: current_page.number - 1), class: 'page-link' unless current_page.first? %>
|
||||
<%= link_to 'Previous', participants_path(page: current_page.number - 1), class: 'page-link bg-secondary text-white' unless current_page.first? %>
|
||||
</li>
|
||||
<% each_page do |page| -%>
|
||||
<% if page.display_tag? -%>
|
||||
<li class="page-item <%= 'active' if page.number == current_page.number %>">
|
||||
<%= link_to page.number, participants_path(page: page.number), class: 'page-link' %>
|
||||
</li>
|
||||
<%= link_to page.number, participants_path(page: page.number), class: 'page-link bg-secondary text-white' %>
|
||||
</li>
|
||||
<% elsif !page.was_truncated? -%>
|
||||
<li class="page-item disabled"><span class="page-link">…</span></li>
|
||||
<li class="page-item disabled"><span class="page-link bg-secondary text-white">…</span></li>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<li class="page-item <%= 'disabled' if current_page.last? %>">
|
||||
<%= link_to 'Next', participants_path(page: current_page.number + 1), class: 'page-link' unless current_page.last? %>
|
||||
<%= link_to 'Next', participants_path(page: current_page.number + 1), class: 'page-link bg-secondary text-white' unless current_page.last? %>
|
||||
</li>
|
||||
<li class="page-item <%= 'disabled' if current_page.last? %>">
|
||||
<%= link_to 'Last', participants_path(page: total_pages), class: 'page-link' unless current_page.last? %>
|
||||
<%= link_to 'Last', participants_path(page: total_pages), class: 'page-link bg-secondary text-white' unless current_page.last? %>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
|
|
@ -54,8 +54,8 @@
|
|||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<%= form.label :mci, 'MCI', class: 'form-label' %>
|
||||
<%= form.text_field :mci, class: 'form-control', placeholder: 'Required for Participant' %>
|
||||
<%= form.label :mci, 'MCI', class: 'form-label' %>
|
||||
<%= form.text_field :mci, class: 'form-control', placeholder: 'Required for Participant', maxlength: 10, pattern: "\\d{10}", oninput: "validateMCI(this)" %>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
|
@ -211,3 +211,19 @@ $(document).ready(function() {
|
|||
});
|
||||
</script>
|
||||
|
||||
<%# This is to limit the MCI to 10 numeric digits on entry %>
|
||||
|
||||
<script>
|
||||
function validateMCI(input) {
|
||||
let value = input.value;
|
||||
let newValue = value.replace(/[^0-9]/g, '');
|
||||
|
||||
if (newValue.length > 10) {
|
||||
newValue = newValue.slice(0, 10);
|
||||
}
|
||||
|
||||
input.value = newValue;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
<h1 class="mb-4 text-center">Participants</h1>
|
||||
|
||||
<div class="text-center mt-3">
|
||||
<%= link_to 'New Participant', new_participant_path, class: 'btn btn-primary mb-3' %>
|
||||
|
||||
<%= link_to 'New Participant', new_participant_path, class: 'btn btn-secondary mb-3' %>
|
||||
</div>
|
||||
|
||||
|
||||
<%= paginate @participants %>
|
||||
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_01_22_040719) do
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_01_23_023259) do
|
||||
create_table "employers", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "address"
|
||||
|
@ -44,6 +44,9 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_22_040719) do
|
|||
t.integer "worker_id"
|
||||
t.string "last_name"
|
||||
t.index ["employer_id"], name: "index_participants_on_employer_id"
|
||||
t.index ["last_name"], name: "index_participants_on_last_name"
|
||||
t.index ["mci"], name: "index_participants_on_mci"
|
||||
t.index ["ssn"], name: "index_participants_on_ssn"
|
||||
t.index ["worker_id"], name: "index_participants_on_worker_id"
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue