Skip to content

Commit

Permalink
Merge pull request #5171 from FireLemons/fix_js_deprecation
Browse files Browse the repository at this point in the history
fix deprecation warnings
  • Loading branch information
FireLemons authored Aug 31, 2023
2 parents 1cb59dc + 2a4ccb0 commit f2960ad
Show file tree
Hide file tree
Showing 21 changed files with 27 additions and 25 deletions.
2 changes: 1 addition & 1 deletion app/javascript/src/add_to_calendar_button.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ function createCalendarEvents () {
})
}

$('document').ready(() => {
$(() => { // JQuery's callback for the DOM loading
createCalendarEvents()
})
8 changes: 4 additions & 4 deletions app/javascript/src/all_casa_admin/patch_notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ patchNoteFunctions.savePatchNote = function (patchNoteGroupId, patchNoteId, patc
})
}

$('document').ready(() => {
$(() => { // JQuery's callback for the DOM loading
if (!(window.location.pathname.includes('patch_notes'))) {
return
}
Expand All @@ -505,9 +505,9 @@ $('document').ready(() => {
const asyncNotificationsElement = $('#async-notifications')
pageNotifier = new AsyncNotifier(asyncNotificationsElement)

$('#new-patch-note button').click(patchNoteFunctions.onCreate)
$('#patch-note-list .button-delete').click(patchNoteFunctions.onDeletePatchNote)
$('#patch-note-list .button-edit').click(patchNoteFunctions.onEditPatchNote)
$('#new-patch-note button').on('click', patchNoteFunctions.onCreate)
$('#patch-note-list .button-delete').on('click', patchNoteFunctions.onDeletePatchNote)
$('#patch-note-list .button-edit').on('click', patchNoteFunctions.onEditPatchNote)
} catch (err) {
pageNotifier.notify('Could not intialize app', 'error')
pageNotifier.notify(err.message, 'error')
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/all_casa_admin/tables.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global $ */

$(() => {
$(() => { // JQuery's callback for the DOM loading
if ($('table.admin-list').length > 0) {
$('table.admin-list').DataTable({ searching: true, order: [[0, 'asc']] })
}
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/casa_case.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function handleGenerateReport (e) {
})
}

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

if ($('button.copy-court-button').length) {
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/casa_org.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function removeCheckedAttr (el) {
el.attr('disabled', true)
}

$('document').ready(() => {
$(() => { // JQuery's callback for the DOM loading
$('.accordionTwilio').attr('data-bs-toggle', 'collapse')
$('.accordionTwilio').attr('data-bs-target', '#collapseTwilio')
$('.accordionTwilio').attr('aria-expanded', 'false')
Expand Down
6 changes: 3 additions & 3 deletions app/javascript/src/case_contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ window.onload = function () {
}
}

$('#casa-contact-form').submit(function (e) {
$('#casa-contact-form').on('submit', function (e) {
validateNoteContent(e)
})

Expand All @@ -108,7 +108,7 @@ window.onload = function () {

const caseContactSubmitFormModal = document.getElementById('modal-case-contact-submit')
caseContactSubmitFormModal.onclick = function () {
$('#casa-contact-form').unbind('submit')
$('#casa-contact-form').off('submit')
}

caseContactSubmit.on('click', function () {
Expand Down Expand Up @@ -185,7 +185,7 @@ function displayHighlightModal (event) {
$('#caseContactHighlight').modal('show')
}

$('document').ready(() => {
$(() => { // JQuery's callback for the DOM loading
$('[data-toggle="tooltip"]').tooltip()
$('.followup-button').on('click', displayFollowupAlert)
$('#open-highlight-modal').on('click', displayHighlightModal)
Expand Down
3 changes: 2 additions & 1 deletion app/javascript/src/case_contact_autosave.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global $ */

$(() => {
$(() => { // JQuery's callback for the DOM loading
const formId = 'casa-contact-form'
let localStorageKey = formId

Expand All @@ -9,6 +9,7 @@ $(() => {
const caseContactId = $(`#${formId}`)[0].action.split('/').pop()
localStorageKey = `${formId}-${caseContactId}`
}

const save = () => {
const data = []

Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/case_emancipation.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class Toggler {
}
}

$('document').ready(() => {
$(() => { // JQuery's callback for the DOM loading
if (!((/casa_cases\/[A-Za-z\-0-9]+\/emancipation/).test(window.location.pathname))) {
return
}
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const defineCaseContactsTable = function () {
)
}

$('document').ready(() => {
$(() => { // JQuery's callback for the DOM loading
const asyncNotificationsElement = $('#async-notifications')

if (asyncNotificationsElement.length) {
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/display_app_metric.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Chart.register(...registerables)

const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']

$(document).ready(function () {
$(() => { // JQuery's callback for the DOM loading
const chartElement = document.getElementById('myChart')

if (chartElement) {
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/emancipations.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global $ */

$('document').ready(() => {
$(() => { // JQuery's callback for the DOM loading
$('table#all-case-emancipations').DataTable({
autoWidth: false,
searching: false,
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function populateFileInput (inputId) {
}
}

$('document').ready(() => {
$(() => { // JQuery's callback for the DOM loading
['volunteer', 'supervisor'].forEach((importType) => {
const inputFileElementId = `${importType}-file`
const inputFileElement = $(`#${inputFileElementId}`)[0]
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/new_casa_case.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const COURT_DATE_TOGGLE_CLASS = 'toggle-court-date-input'
const COURT_DATE_INPUT_ID = 'casa_case_court_dates_attributes_0_date'

$('document').ready(() => {
$(() => { // JQuery's callback for the DOM loading
const courtDateToggle = $(`.${COURT_DATE_TOGGLE_CLASS}`)[0]
const courtDateInput = $(`#${COURT_DATE_INPUT_ID}`)[0]

Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/password_confirmation.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function checkPasswordsAndDisplayPopup (button, password, confirmation, enablePo

// Expects the class name constants above are applied to the correct fields. See
// `app/views/users/edit.html.erb` for usage
$('document').ready(() => {
$(() => { // JQuery's callback for the DOM loading
if ($(`.${SUBMIT_BUTTON_CLASS}`).length > 0) {
const button = $(`.${SUBMIT_BUTTON_CLASS}`)[0]
const password = $(`.${PASSWORD_FIELD_CLASS}`)[0]
Expand Down
1 change: 1 addition & 0 deletions app/javascript/src/plainadmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
}
})
}

overlay?.addEventListener('click', () => {
sidebarNavWrapper.classList.remove('active')
overlay.classList.remove('active')
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/reimbursements.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global $ */

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

const formatOccurredAtDate = (record) => new Date(record.occurred_at.replaceAll('-', ' ')).toDateString()
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/require_communication_preference.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function displayPopUpIfPreferencesIsInvalid () {
}
}

$('document').ready(() => {
$(() => { // JQuery's callback for the DOM loading
const smsToggle = $(`.${SMS_TOGGLE_CLASS}`)[0]
const emailToggle = $(`.${EMAIL_TOGGLE_CLASS}`)[0]

Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/select.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global $ */

$('document').ready(() => {
$(() => { // JQuery's callback for the DOM loading
$('.select2').select2(
{
theme: 'bootstrap-5',
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function toggleSidebar () {
}
}

$('document').ready(() => {
$(() => { // JQuery's callback for the DOM loading
$('#toggle-sidebar-js, #sidebar-js').on('click', toggleSidebar)

// Show group actions dropdown expanded when any of the child is active
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/sms_reactivation_toggle.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$('document').ready(() => {
$(() => { // JQuery's callback for the DOM loading
if ($('#twilio_disabled').length) {
$('#twilio_disabled').removeClass('main-btn danger-btn-outline btn-hover btn-sm my-1')
$('#twilio_disabled').addClass('main-btn deactive-btn btn-sm my-1')
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/tooltip.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* global $ */

$('document').ready(() => {
$(() => { // JQuery's callback for the DOM loading
$('[data-toggle="tooltip"]').tooltip()
})

0 comments on commit f2960ad

Please sign in to comment.