Skip to content

Commit

Permalink
[Fix #28] adopt new Turbo Integration Point
Browse files Browse the repository at this point in the history
Minimum required Turbo Version: v8.0.6
  • Loading branch information
OutlawAndy committed Oct 1, 2024
1 parent 17fcaf1 commit dce6e5a
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 31 deletions.
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"name": "@rolemodel/turbo-confirm",
"type": "module",
"version": "2.0.2",
"version": "2.1.0",
"description": "Drop-in upgrade for Rails' data-turbo-confirm feature to support custom HTML dialogs.",
"main": "src/index.js",
"dependencies": {
"@hotwired/turbo": ">= 8.0.6"
},
"directories": {
"lib": "src/lib"
},
Expand Down Expand Up @@ -33,7 +36,7 @@
},
"homepage": "https://github.com/RoleModel/turbo-confirm#readme",
"devDependencies": {
"@playwright/test": "^1.42.1",
"@playwright/test": "^1.47",
"@types/node": "^20.11.30"
}
}
7 changes: 3 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import { dispatch, TurboConfirmError } from './lib/utils.js'
import { TurboConfirm } from './lib/TurboConfirm.js'

const start = (options) => {
const tc = new TurboConfirm(options)

if (!window.Turbo) throw TurboConfirmError.noTurbo()
const tc = new TurboConfirm(options)

window.Turbo.setConfirmMethod(async (message, formElement, submitter) => {
window.Turbo.config.forms.confirm = async (message, formElement, submitter) => {
const response = await tc.confirm(message, formElement, submitter)

if (response) {
Expand All @@ -16,7 +15,7 @@ const start = (options) => {
}

return response
})
}
}

export default { start }
Expand Down
2 changes: 1 addition & 1 deletion test/dummy/.ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.1
3.3.5
7 changes: 6 additions & 1 deletion test/dummy/Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source "https://rubygems.org"

ruby "3.3.1"
ruby file: ".ruby-version"

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.1.3", ">= 7.1.3.2"
Expand Down Expand Up @@ -32,6 +32,11 @@ gem "tzinfo-data", platforms: %i[ windows jruby ]
# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false

# will be removed from stdlib in Ruby 3.5
gem "ostruct"
gem "fiddle"
gem "logger"

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[ mri windows ]
Expand Down
8 changes: 7 additions & 1 deletion test/dummy/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ GEM
reline (>= 0.3.8)
drb (2.2.1)
erubi (1.12.0)
fiddle (1.1.2)
foreman (0.87.2)
globalid (1.2.1)
activesupport (>= 6.1)
Expand All @@ -109,6 +110,7 @@ GEM
reline (>= 0.4.2)
jsbundling-rails (1.3.0)
railties (>= 6.0.0)
logger (1.6.0)
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
Expand Down Expand Up @@ -144,6 +146,7 @@ GEM
racc (~> 1.4)
nokogiri (1.16.5-x86_64-linux)
racc (~> 1.4)
ostruct (0.6.0)
psych (5.1.2)
stringio
puma (6.4.3)
Expand Down Expand Up @@ -243,8 +246,11 @@ DEPENDENCIES
bootsnap
cssbundling-rails
debug
fiddle
foreman
jsbundling-rails
logger
ostruct
puma (>= 5.0)
rails (~> 7.1.3, >= 7.1.3.2)
rolemodel_rails!
Expand All @@ -257,7 +263,7 @@ DEPENDENCIES
web-console

RUBY VERSION
ruby 3.3.1p55
ruby 3.3.5p100

BUNDLED WITH
2.5.7
16 changes: 8 additions & 8 deletions test/dummy/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -501,17 +501,17 @@
integrity sha512-eGeIqNOQpXoPAIP7tC1+1Yc1yl1xnwYqg+3mzqxyrbE5pg5YFBZcA6YoTiByJB6DKAEsiWtl6tjTJS4IYtbB7A==

"@hotwired/turbo-rails@^8.0.4":
version "8.0.4"
resolved "https://registry.yarnpkg.com/@hotwired/turbo-rails/-/turbo-rails-8.0.4.tgz#d224f524a9e33fe687cec5d706054eb6fe13fa5b"
integrity sha512-GHCv5+B2VzYZZvMFpg/g9JLx/8pl/8chcubSB7T+Xn1zYOMqAKB6cT80vvWUzxdwfm/2KfaRysfDz+BmvtjFaw==
version "8.0.10"
resolved "https://registry.yarnpkg.com/@hotwired/turbo-rails/-/turbo-rails-8.0.10.tgz#28b0c1243868d9efc4a71f4a2ff7d97ee9cefbfa"
integrity sha512-BkERfjTbNwMb9/YQi0RL9+f9zkD+dZH2klEONtGwXrIE3O9BE1937Nn9++koZpDryD4XN3zE5U5ibyWoYJAWBg==
dependencies:
"@hotwired/turbo" "^8.0.4"
"@hotwired/turbo" "^8.0.6"
"@rails/actioncable" "^7.0"

"@hotwired/turbo@^8.0.4":
version "8.0.4"
resolved "https://registry.yarnpkg.com/@hotwired/turbo/-/turbo-8.0.4.tgz#5c5361c06a37cdf10dcba4223f1afd0ca1c75091"
integrity sha512-mlZEFUZrJnpfj+g/XeCWWuokvQyN68WvM78JM+0jfSFc98wegm259vCbC1zSllcspRwbgXK31ibehCy5PA78/Q==
"@hotwired/turbo@>=8.0.6", "@hotwired/turbo@^8.0.6":
version "8.0.10"
resolved "https://registry.yarnpkg.com/@hotwired/turbo/-/turbo-8.0.10.tgz#d95569d259f0daad6e824ee1ada877ff94beb72b"
integrity sha512-xen1YhNQirAHlA8vr/444XsTNITC1Il2l/Vx4w8hAWPpI5nQO78mVHNsmFuayETodzPwh25ob2TgfCEV/Loiog==

"@jest/schemas@^29.6.3":
version "29.6.3"
Expand Down
33 changes: 19 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
# yarn lockfile v1


"@playwright/test@^1.42.1":
version "1.42.1"
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.42.1.tgz#9eff7417bcaa770e9e9a00439e078284b301f31c"
integrity sha512-Gq9rmS54mjBL/7/MvBaNOBwbfnh7beHvS6oS4srqXFcQHpQCV1+c8JXWE8VLPyRDhgS3H8x8A7hztqI9VnwrAQ==
"@hotwired/turbo@>=8.0.6":
version "8.0.10"
resolved "https://registry.yarnpkg.com/@hotwired/turbo/-/turbo-8.0.10.tgz#d95569d259f0daad6e824ee1ada877ff94beb72b"
integrity sha512-xen1YhNQirAHlA8vr/444XsTNITC1Il2l/Vx4w8hAWPpI5nQO78mVHNsmFuayETodzPwh25ob2TgfCEV/Loiog==

"@playwright/test@^1.47":
version "1.47.2"
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.47.2.tgz#dbe7051336bfc5cc599954214f9111181dbc7475"
integrity sha512-jTXRsoSPONAs8Za9QEQdyjFn+0ZQFjCiIztAIF6bi1HqhBzG9Ma7g1WotyiGqFSBRZjIEqMdT8RUlbk1QVhzCQ==
dependencies:
playwright "1.42.1"
playwright "1.47.2"

"@types/node@^20.11.30":
version "20.11.30"
Expand All @@ -21,17 +26,17 @@ [email protected]:
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==

playwright-core@1.42.1:
version "1.42.1"
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.42.1.tgz#13c150b93c940a3280ab1d3fbc945bc855c9459e"
integrity sha512-mxz6zclokgrke9p1vtdy/COWBH+eOZgYUVVU34C73M+4j4HLlQJHtfcqiqqxpP0o8HhMkflvfbquLX5dg6wlfA==
playwright-core@1.47.2:
version "1.47.2"
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.47.2.tgz#7858da9377fa32a08be46ba47d7523dbd9460a4e"
integrity sha512-3JvMfF+9LJfe16l7AbSmU555PaTl2tPyQsVInqm3id16pdDfvZ8TTZ/pyzmkbDrZTQefyzU7AIHlZqQnxpqHVQ==

playwright@1.42.1:
version "1.42.1"
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.42.1.tgz#79c828b51fe3830211137550542426111dc8239f"
integrity sha512-PgwB03s2DZBcNRoW+1w9E+VkLBxweib6KTXM0M3tkiT4jVxKSi6PmVJ591J+0u10LUrgxB7dLRbiJqO5s2QPMg==
playwright@1.47.2:
version "1.47.2"
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.47.2.tgz#155688aa06491ee21fb3e7555b748b525f86eb20"
integrity sha512-nx1cLMmQWqmA3UsnjaaokyoUpdVaaDhJhMoxX2qj3McpjnsqFHs516QAKYhqHAgOP+oCFTEOCOAaD1RgD/RQfA==
dependencies:
playwright-core "1.42.1"
playwright-core "1.47.2"
optionalDependencies:
fsevents "2.3.2"

Expand Down

0 comments on commit dce6e5a

Please sign in to comment.