Skip to content

Commit

Permalink
fixing jquery double loading issue
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamfall committed Nov 16, 2023
1 parent a002379 commit 3e11936
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 37 deletions.
4 changes: 1 addition & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ gem 'sprockets', '~> 3.7.2'
gem 'sprockets-rails', '>= 2.0.0'
gem 'slim-rails', '~> 3.2.0'
gem 'coffee-rails', '5.0'
gem 'jquery-rails', '4.4.0'
gem 'jquery-rails', '~> 4.4'
gem 'jquery-ui-rails', '6.0.1'
gem 'bootstrap-sass', '~> 3.4'
gem 'govuk_frontend_toolkit', '~> 3.1.0'
Expand Down Expand Up @@ -159,8 +159,6 @@ group :development do
gem 'rubocop', '~> 0.52', require: false
# When need to copy model with nested associations
gem 'amoeba', '3.0.0'
# for RailsPanel Chrome extension
gem 'meta_request'
gem 'listen'

# Fixes https://github.com/rails/rails/issues/26658#issuecomment-255590071
Expand Down
22 changes: 7 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ GEM
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
thread_safe (~> 0.3, >= 0.3.1)
base64 (0.1.1)
base64 (0.2.0)
bcrypt (3.1.19)
bigdecimal (3.1.4)
bindex (0.8.1)
Expand All @@ -142,7 +142,6 @@ GEM
browser (2.4.0)
builder (3.2.4)
byebug (11.1.3)
callsite (0.0.11)
capybara (3.39.2)
addressable
matrix
Expand Down Expand Up @@ -240,7 +239,7 @@ GEM
activesupport (>= 5.0)
request_store (>= 1.0)
ruby2_keywords
drb (2.1.1)
drb (2.2.0)
ruby2_keywords
email_validator (2.2.4)
activemodel
Expand All @@ -249,7 +248,7 @@ GEM
erubi (1.12.0)
et-orbi (1.2.7)
tzinfo
execjs (2.8.1)
execjs (2.9.1)
factory_bot (6.2.1)
activesupport (>= 5.0.0)
factory_bot_rails (6.2.0)
Expand Down Expand Up @@ -353,7 +352,7 @@ GEM
reline (>= 0.3.8)
jbuilder (2.10.2)
activesupport (>= 5.0.0)
jquery-rails (4.4.0)
jquery-rails (4.6.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
Expand Down Expand Up @@ -405,10 +404,6 @@ GEM
marcel (1.0.2)
matrix (0.4.2)
memoist (0.16.2)
meta_request (0.3.0)
callsite
rack-contrib
railties
method_source (1.0.0)
mime-types (3.5.1)
mime-types-data (~> 3.2015)
Expand All @@ -420,7 +415,7 @@ GEM
i18n (>= 0.6.4, <= 2)
multi_json (1.15.0)
multipart-post (2.3.0)
mutex_m (0.1.2)
mutex_m (0.2.0)
net-imap (0.4.3)
date
net-protocol
Expand Down Expand Up @@ -494,8 +489,6 @@ GEM
rack-canonical-host (1.2.0)
addressable (> 0, < 3)
rack (>= 1, < 4)
rack-contrib (2.3.0)
rack (~> 2.0)
rack-cors (1.1.1)
rack (>= 2.0.0)
rack-mini-profiler (3.1.1)
Expand Down Expand Up @@ -556,7 +549,7 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
rb-readline (0.5.5)
rdoc (6.5.0)
rdoc (6.6.0)
psych (>= 4.0.0)
redis (5.0.7)
redis-client (>= 0.9.0)
Expand Down Expand Up @@ -804,7 +797,7 @@ DEPENDENCIES
hashie (~> 3.5)
hiredis
jbuilder (~> 2.10.1)
jquery-rails (= 4.4.0)
jquery-rails (~> 4.4)
jquery-ui-rails (= 6.0.1)
js_cookie_rails (= 2.1.4)
json (= 2.3.0)
Expand All @@ -815,7 +808,6 @@ DEPENDENCIES
lograge
mail-notify (~> 1.0)
matrix (~> 0.4.1)
meta_request
nilify_blanks
nokogiri
paper_trail (~> 15.0)
Expand Down
Empty file.
1 change: 1 addition & 0 deletions app/assets/javascripts/add_jquery_ujs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "jquery_ujs"
8 changes: 4 additions & 4 deletions app/assets/javascripts/application-admin.js.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#= require jquery
#= require jquery_ujs
#= require jquery3
#= require jquery-ujs
#= require bootstrap-sprockets
#= require vendor/file_upload/jquery.ui.widget
#= require vendor/file_upload/jquery.iframe-transport
Expand All @@ -26,9 +26,9 @@
#= require vendor/jquery-debounce
#= require clean-paste

$(document).ready(() ->
$( ->
$("html").removeClass("no-js").addClass("js")
($ ".timepicker").timePicker()
($ ".datepicker").datepicker({dateFormat: "dd/mm/yy"})
($ ".timepicker").timePicker()
($ "select.select2").select2({width: "style"})
)
3 changes: 1 addition & 2 deletions app/assets/javascripts/application.js.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#= require jquery3
#= require jquery_ujs
#= require jquery-ujs
#= require vendor/file_upload/jquery.ui.widget
#= require vendor/file_upload/jquery.iframe-transport
#= require vendor/file_upload/jquery.fileupload
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/twofactor.js.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#= require jquery
#= require jquery3
#= require jquery_ujs
#= require bootstrap-sprockets
#= require devise_authy
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/components/session_timeout.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import MicroModal from 'micromodal';
import 'jquery/src/jquery';
// import 'jquery/src/jquery';

export default function() {
var dialogElement = document.getElementById("timeout_dialog");
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/packs/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const frontend = require("govuk-frontend/govuk/all")
require.context('govuk-frontend/govuk/assets/images', true)
import './application.scss';

import 'jquery/src/jquery';
// import 'jquery/src/jquery';
import MicroModal from 'micromodal';

import AccessibleAutocomplete from '../vendor/accessible-autocomplete.min';
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
"css-loader": "^5.2.6",
"css-minimizer-webpack-plugin": "^3.0.2",
"govuk-frontend": "^3.13.0",
"jquery": "^3.6.0",
"jquery": "^3.6.1",
"jquery-migrate": "^1.4.1",
"jquery-ujs": "^1.2.3",
"js-cookie": "^3.0.1",
"micromodal": "^0.4.6",
"mini-css-extract-plugin": "^2.0.0",
"mini-css-extract-plugin": "^2.7.6",
"node-sass": "^7.0.0",
"sass": "^1.35.1",
"sass-loader": "^12.1.0",
Expand Down
77 changes: 69 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,11 @@
version "7.0.11"
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3"

"@types/json-schema@^7.0.9":
version "7.0.15"
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841"
integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==

"@types/minimatch@*":
version "3.0.4"
resolved "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.4.tgz"
Expand Down Expand Up @@ -1053,10 +1058,24 @@ ajv-errors@^1.0.0:
version "1.0.1"
resolved "https://registry.npmjs.org/ajv-errors/-/ajv-errors-1.0.1.tgz"

ajv-formats@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ajv-formats/-/ajv-formats-2.1.1.tgz#6e669400659eb74973bbf2e33327180a0996b520"
integrity sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==
dependencies:
ajv "^8.0.0"

ajv-keywords@^3.1.0, ajv-keywords@^3.5.2:
version "3.5.2"
resolved "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz"

ajv-keywords@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-5.1.0.tgz#69d4d385a4733cdbeab44964a1170a88f87f0e16"
integrity sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==
dependencies:
fast-deep-equal "^3.1.3"

ajv@^6.1.0, ajv@^6.12.3, ajv@^6.12.4, ajv@^6.12.5:
version "6.12.6"
resolved "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz"
Expand All @@ -1066,6 +1085,16 @@ ajv@^6.1.0, ajv@^6.12.3, ajv@^6.12.4, ajv@^6.12.5:
json-schema-traverse "^0.4.1"
uri-js "^4.2.2"

ajv@^8.0.0, ajv@^8.9.0:
version "8.12.0"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.12.0.tgz#d1a0527323e22f53562c567c00991577dfbe19d1"
integrity sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==
dependencies:
fast-deep-equal "^3.1.1"
json-schema-traverse "^1.0.0"
require-from-string "^2.0.2"
uri-js "^4.2.2"

alphanum-sort@^1.0.2:
version "1.0.2"
resolved "https://registry.npmjs.org/alphanum-sort/-/alphanum-sort-1.0.2.tgz"
Expand Down Expand Up @@ -2251,7 +2280,7 @@ extsprintf@^1.2.0:
version "1.4.0"
resolved "https://registry.npmjs.org/extsprintf/-/extsprintf-1.4.0.tgz"

fast-deep-equal@^3.1.1:
fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3:
version "3.1.3"
resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz"

Expand Down Expand Up @@ -2975,9 +3004,20 @@ jest-worker@^27.0.2:
merge-stream "^2.0.0"
supports-color "^8.0.0"

jquery@^3.6.0:
version "3.6.0"
resolved "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz"
jquery-migrate@^1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/jquery-migrate/-/jquery-migrate-1.4.1.tgz#85152f3ec99a95625f4f7d0bcf62e9b8638f5a76"
integrity sha512-RwIqqAaEC1gQ9KFtdw69wse2bUGQnGNwbkZBkCwSCYkAICMlpVxAbHmfvWaS7SfLGJrYd13FZTuuQgZ6gBotJQ==

jquery-ujs@^1.2.3:
version "1.2.3"
resolved "https://registry.yarnpkg.com/jquery-ujs/-/jquery-ujs-1.2.3.tgz#dcac6026ab7268e5ee41faf9d31c997cd4ddd603"
integrity sha512-59wvfx5vcCTHMeQT1/OwFiAj+UffLIwjRIoXdpO7Z7BCFGepzq9T9oLVeoItjTqjoXfUrHJvV7QU6pUR+UzOoA==

jquery@^3.6.1:
version "3.7.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.7.1.tgz#083ef98927c9a6a74d05a6af02806566d16274de"
integrity sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==

js-base64@^2.1.8:
version "2.6.4"
Expand Down Expand Up @@ -3018,6 +3058,11 @@ json-schema-traverse@^0.4.1:
version "0.4.1"
resolved "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz"

json-schema-traverse@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2"
integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==

[email protected]:
version "0.2.3"
resolved "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz"
Expand Down Expand Up @@ -3280,11 +3325,12 @@ min-indent@^1.0.0:
version "1.0.1"
resolved "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz"

mini-css-extract-plugin@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.0.0.tgz"
mini-css-extract-plugin@^2.7.6:
version "2.7.6"
resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-2.7.6.tgz#282a3d38863fddcd2e0c220aaed5b90bc156564d"
integrity sha512-Qk7HcgaPkGG6eD77mLvZS1nmxlao3j+9PkrT9Uc7HAE1id3F41+DdBRYRYkbyfNRGzm8/YWtzhw7nVPmwhqTQw==
dependencies:
schema-utils "^3.0.0"
schema-utils "^4.0.0"

minimalistic-assert@^1.0.0:
version "1.0.1"
Expand Down Expand Up @@ -4230,6 +4276,11 @@ require-directory@^2.1.1:
version "2.1.1"
resolved "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz"

require-from-string@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909"
integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==

require-main-filename@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz"
Expand Down Expand Up @@ -4365,6 +4416,16 @@ schema-utils@^3.0, schema-utils@^3.0.0, schema-utils@^3.1.0:
ajv "^6.12.5"
ajv-keywords "^3.5.2"

schema-utils@^4.0.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-4.2.0.tgz#70d7c93e153a273a805801882ebd3bff20d89c8b"
integrity sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==
dependencies:
"@types/json-schema" "^7.0.9"
ajv "^8.9.0"
ajv-formats "^2.1.1"
ajv-keywords "^5.1.0"

scss-tokenizer@^0.2.3:
version "0.2.3"
resolved "https://registry.npmjs.org/scss-tokenizer/-/scss-tokenizer-0.2.3.tgz"
Expand Down

0 comments on commit 3e11936

Please sign in to comment.