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 */
|
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]
|
before_action :set_participant, only: [:show, :edit, :update, :destroy]
|
||||||
|
|
||||||
def index
|
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
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,25 +10,25 @@
|
||||||
<nav aria-label="Page navigation">
|
<nav aria-label="Page navigation">
|
||||||
<ul class="pagination">
|
<ul class="pagination">
|
||||||
<li class="page-item <%= 'disabled' if current_page.first? %>">
|
<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>
|
||||||
<li class="page-item <%= 'disabled' if current_page.first? %>">
|
<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>
|
</li>
|
||||||
<% each_page do |page| -%>
|
<% each_page do |page| -%>
|
||||||
<% if page.display_tag? -%>
|
<% if page.display_tag? -%>
|
||||||
<li class="page-item <%= 'active' if page.number == current_page.number %>">
|
<li class="page-item <%= 'active' if page.number == current_page.number %>">
|
||||||
<%= link_to page.number, participants_path(page: page.number), class: 'page-link' %>
|
<%= link_to page.number, participants_path(page: page.number), class: 'page-link bg-secondary text-white' %>
|
||||||
</li>
|
</li>
|
||||||
<% elsif !page.was_truncated? -%>
|
<% 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 -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<li class="page-item <%= 'disabled' if current_page.last? %>">
|
<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>
|
||||||
<li class="page-item <%= 'disabled' if current_page.last? %>">
|
<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>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
|
@ -54,8 +54,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<%= form.label :mci, 'MCI', class: 'form-label' %>
|
<%= form.label :mci, 'MCI', class: 'form-label' %>
|
||||||
<%= form.text_field :mci, class: 'form-control', placeholder: 'Required for Participant' %>
|
<%= form.text_field :mci, class: 'form-control', placeholder: 'Required for Participant', maxlength: 10, pattern: "\\d{10}", oninput: "validateMCI(this)" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
|
@ -211,3 +211,19 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
</script>
|
</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>
|
<h1 class="mb-4 text-center">Participants</h1>
|
||||||
|
|
||||||
<div class="text-center mt-3">
|
<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>
|
</div>
|
||||||
|
|
||||||
<%= paginate @participants %>
|
<%= paginate @participants %>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# 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|
|
create_table "employers", force: :cascade do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.string "address"
|
t.string "address"
|
||||||
|
@ -44,6 +44,9 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_22_040719) do
|
||||||
t.integer "worker_id"
|
t.integer "worker_id"
|
||||||
t.string "last_name"
|
t.string "last_name"
|
||||||
t.index ["employer_id"], name: "index_participants_on_employer_id"
|
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"
|
t.index ["worker_id"], name: "index_participants_on_worker_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue