Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 37 additions & 38 deletions app/javascript/application.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,38 @@
/* global window */
import './jQueryGlobalizer.js'
import '@hotwired/turbo-rails'
import 'bootstrap'
import 'bootstrap-select'
import './sweet-alert-confirm.js'
import './controllers'
import 'trix'
import '@rails/actiontext'
import './datatable.js'
Turbo.session.drive = false
import "./jquery.js";
import "@hotwired/turbo-rails";
import "bootstrap";
import "bootstrap-select";
import "./sweet-alert-confirm.js";
import "./controllers";
import "trix";
import "@rails/actiontext";
import "./datatable.js";
Turbo.session.drive = false;

require('datatables.net-dt')(null, window.jQuery) // First parameter is the global object. Defaults to window if null
require('select2')(window.jQuery)
require('@rails/ujs').start()
require('@rails/activestorage').start()
require('bootstrap-datepicker')
require('./src/add_to_calendar_button')
require('./src/case_contact')
require('./src/case_emancipation')
require('./src/casa_case')
require('./src/new_casa_case')
require('./src/dashboard')
require('./src/emancipations')
require('./src/import')
require('./src/password_confirmation')
require('./src/read_more')
require('./src/reimbursements')
require('./src/reports')
require('./src/require_communication_preference')
require('./src/select')
require('./src/tooltip')
require('./src/time_zone')
require('./src/session_timeout_poller.js')
require('./src/display_app_metric.js')
require('./src/casa_org')
require('./src/sms_reactivation_toggle')
require('./src/validated_form')
require('./src/learning_hours')
require("datatables.net-dt")(null, window.jQuery); // First parameter is the global object. Defaults to window if null
require("select2")(window.jQuery);
require("@rails/ujs").start();
require("@rails/activestorage").start();
require("bootstrap-datepicker");
require("./src/add_to_calendar_button");
require("./src/case_contact");
require("./src/case_emancipation");
require("./src/casa_case");
require("./src/new_casa_case");
require("./src/dashboard");
require("./src/emancipations");
require("./src/import");
require("./src/password_confirmation");
require("./src/read_more");
require("./src/reimbursements");
require("./src/reports");
require("./src/require_communication_preference");
require("./src/select");
require("./src/tooltip");
require("./src/time_zone");
require("./src/session_timeout_poller.js");
require("./src/display_app_metric.js");
require("./src/casa_org");
require("./src/sms_reactivation_toggle");
require("./src/validated_form");
require("./src/learning_hours");
2 changes: 0 additions & 2 deletions app/javascript/datatable.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* global $ */

export function initializeDataTable (selector) {
if ($(selector).length > 0) {
$(selector).DataTable({ searching: true, order: [[0, 'asc']] })
Expand Down
3 changes: 0 additions & 3 deletions app/javascript/jQueryGlobalizer.js

This file was deleted.

7 changes: 7 additions & 0 deletions app/javascript/jquery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import jquery from "jquery";
window.jQuery = jquery;
window.$ = jquery;

$(function () {
console.log("Hey!");
});
2 changes: 0 additions & 2 deletions app/javascript/src/add_to_calendar_button.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* global $ */

import 'add-to-calendar-button'

function createCalendarEvents () {
Expand Down
2 changes: 0 additions & 2 deletions app/javascript/src/all_casa_admin/tables.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* global $ */

import { initializeDataTable } from '../../datatable'

$(() => {
Expand Down
24 changes: 0 additions & 24 deletions app/javascript/src/casa_case.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/* global FormData */
/* global DOMParser */
/* global spinner */
/* global $ */

import Swal from 'sweetalert2'

Expand Down Expand Up @@ -149,23 +148,6 @@ function clearSelectErrors () {
errorEl.classList.add('d-none')
}

function handleModalClose () {
const selectEl = document.querySelector('#case-selection')

if (!selectEl) return

clearSelectErrors()
// this line taken from docs https://select2.org/programmatic-control/add-select-clear-items
$('#case-selection').val(null).trigger('change')
}

// re-initialized for setting modal as dropdownParent
function handleDropdownSelection () {
if ($('#case-selection').hasClass('select2')) {
$('#case-selection').select2()
}
}

$(() => { // JQuery's callback for the DOM loading
$('button.copy-court-button').on('click', copyOrdersFromCaseWithConfirmation)

Expand All @@ -182,12 +164,6 @@ $(() => { // JQuery's callback for the DOM loading
disableBtn($('button.copy-court-button')[0])
}
})
// modal id is defined in _generate_docx.html.erb so would like to be able to implement modal close logic in that file
// but not sure how to
$('#generate-docx-report-modal').on('hidden.bs.modal', () => handleModalClose())

$('#generate-docx-report-modal').on('shown.bs.modal', () => handleDropdownSelection())

$('#btnGenerateReport').on('click', handleGenerateReport)

if (/\/casa_cases\/.*\?.*success=true/.test(window.location.href)) {
Expand Down
67 changes: 30 additions & 37 deletions app/javascript/src/case_contact.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,51 @@
/* global window */
/* global $ */
import Swal from "sweetalert2";

import Swal from 'sweetalert2'
function convertDateToSystemTimeZone (date) {
return new Date((typeof date === 'string' ? new Date(date) : date))
function convertDateToSystemTimeZone(date) {
return new Date(typeof date === "string" ? new Date(date) : date);
}

async function displayFollowupAlert () {
const { value: text, isConfirmed } = await fireSwalFollowupAlert()
async function displayFollowupAlert() {
const { value: text, isConfirmed } = await fireSwalFollowupAlert();

if (!isConfirmed) return
if (!isConfirmed) return;

const params = text ? { note: text } : {}
const caseContactId = this.id.replace('followup-button-', '')
const params = text ? { note: text } : {};
const caseContactId = this.id.replace("followup-button-", "");

$.post(
`/case_contacts/${caseContactId}/followups`,
params,
() => window.location.reload()
)
$.post(`/case_contacts/${caseContactId}/followups`, params, () => window.location.reload());
}

async function fireSwalFollowupAlert () {
const inputLabel = 'Optional: Add a note about what followup is needed.'
async function fireSwalFollowupAlert() {
const inputLabel = "Optional: Add a note about what followup is needed.";

return await Swal.fire({
input: 'textarea',
input: "textarea",
title: inputLabel,
inputPlaceholder: 'Type your note here...',
inputAttributes: { 'aria-label': 'Type your note here' },
inputPlaceholder: "Type your note here...",
inputAttributes: { "aria-label": "Type your note here" },

showCancelButton: true,
showCloseButton: true,

confirmButtonText: 'Confirm',
confirmButtonColor: '#dc3545',
confirmButtonText: "Confirm",
confirmButtonColor: "#dc3545",

customClass: {
inputLabel: 'mx-5'
}
})
inputLabel: "mx-5",
},
});
}

$(document).on('turbo:load', function () {
$('.filter-form').on('change', '.filter-input', function () {
$(this).closest('form').submit()
})
})
$(document).on("turbo:load", function () {
$(".filter-form").on("change", ".filter-input", function () {
$(this).closest("form").submit();
});
});

Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Critical functionality was removed from this file without replacement. The removed code block (between the turbo:load handler and this export statement) contained click handler registration for .followup-button elements that called displayFollowupAlert(). Without this handler, the "Make Reminder" buttons throughout the application (e.g., in app/views/case_contacts/_followup.html.erb) will not work. The displayFollowupAlert function still exists in this file but is now unused. System tests at spec/system/case_contacts/followups/create_spec.rb will fail. Either restore the click handler registration or implement this functionality through a Stimulus controller.

Suggested change
// Register click handler for "Make Reminder" buttons
$(document).on('click', '.followup-button', displayFollowupAlert)

Copilot uses AI. Check for mistakes.
$(() => { // JQuery's callback for the DOM loading
$('[data-toggle="tooltip"]').tooltip()
$('.followup-button').on('click', displayFollowupAlert)
})
$(() => {
// JQuery's callback for the DOM loading
$('[data-toggle="tooltip"]').tooltip();
$(".followup-button").on("click", displayFollowupAlert);
});

export {
convertDateToSystemTimeZone
}
export { convertDateToSystemTimeZone };
1 change: 0 additions & 1 deletion app/javascript/src/case_emancipation.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-env jquery */
/* global $ */

const { Notifier } = require('./notifier')
const TypeChecker = require('./type_checker')
Expand Down
1 change: 0 additions & 1 deletion app/javascript/src/dashboard.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* global alert */
/* global $ */
const { Notifier } = require('./notifier')
let pageNotifier

Expand Down
2 changes: 0 additions & 2 deletions app/javascript/src/emancipations.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* global $ */

$(() => { // JQuery's callback for the DOM loading
$('table#all-case-emancipations').DataTable({
autoWidth: false,
Expand Down
1 change: 0 additions & 1 deletion app/javascript/src/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
/* global localStorage */
/* global File */
/* global DataTransfer */
/* global $ */

function dataURItoBlob (dataURI) {
// convert base64 to raw binary data held in a string
Expand Down
1 change: 0 additions & 1 deletion app/javascript/src/notifier.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* global $ */
import { escape } from 'lodash'

const TypeChecker = require('./type_checker.js')
Expand Down
1 change: 0 additions & 1 deletion app/javascript/src/password_confirmation.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-env jquery */
/* global $ */

import Swal from 'sweetalert2'
import { disableBtn, enableBtn } from './casa_case'
Expand Down
2 changes: 0 additions & 2 deletions app/javascript/src/reimbursements.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* global $ */

$(() => { // JQuery's callback for the DOM loading
const { groupBy, map, mapValues } = require('lodash')

Expand Down
23 changes: 12 additions & 11 deletions app/javascript/src/select.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/* global $ */

$(() => { // JQuery's callback for the DOM loading
$('.select2').select2(
{
theme: 'bootstrap-5',
width: $(this).data('width') ? $(this).data('width') : $(this).hasClass('w-100') ? '100%' : 'style',
placeholder: $(this).data('placeholder')
}
)
})
$(() => {
// JQuery's callback for the DOM loading
$(".select2").select2({
theme: "bootstrap-5",
width: $(this).data("width")
? $(this).data("width")
: $(this).hasClass("w-100")
? "100%"
: "style",
placeholder: $(this).data("placeholder"),
});
});
2 changes: 0 additions & 2 deletions app/javascript/src/tooltip.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* global $ */

$(() => { // JQuery's callback for the DOM loading
$('[data-toggle="tooltip"]').tooltip()
})
2 changes: 0 additions & 2 deletions app/javascript/src/validated_form.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* global $ */
const { Notifier } = require('./notifier')
const TypeChecker = require('./type_checker')

Expand Down Expand Up @@ -253,7 +252,6 @@ $(() => { // JQuery's callback for the DOM loading
if ($('#case_contact_miles_driven').length) {
safeInstantiateComponent('non driving contact medium warning', () => {
const contactMediumWithMilesDrivenWarning = new NonDrivingContactMediumWarning(validatedFormCollection.find('.contact-medium.form-group input:not([type=hidden]), #case_contact_miles_driven'), pageNotifier)
console.log(contactMediumWithMilesDrivenWarning)
validatableFormSectionComponents.push(contactMediumWithMilesDrivenWarning)
})
}
Expand Down
25 changes: 10 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@
"bootstrap": "5.3.6",
"bootstrap-datepicker": "^1.10.1",
"bootstrap-scss": "^5.3.8",
"bootstrap-select": "^1.13.18",
"chart.js": "^4.5.1",
"chartjs-adapter-luxon": "^1.3.1",
"datatables.net-dt": "^1.13.11",
"esbuild": "^0.27.2",
"jquery": "^3.7.1",
"jquery": "^4.0.0",
"js-cookie": "^3.0.5",
"jstz": "^2.1.1",
"lodash": "^4.17.21",
Expand Down
Loading