OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Add turbo power so we can use its custom actions in turbo streams
Oliver Günther42e0fb40089c
diff --git a/Gemfile b/Gemfileindex b25e1db9fef..27235537dd3 100644--- a/Gemfile+++ b/Gemfile@@ -228,6 +228,7 @@ gem "factory_bot", "~> 6.4.0", require: falsegem "factory_bot_rails", "~> 6.4.0", require: falsegem "turbo-rails", "~> 2.0.0"+gem "turbo_power", "~> 0.6.2"gem "httpx"diff --git a/Gemfile.lock b/Gemfile.lockindex 968c99dde96..1f8c83711d9 100644--- a/Gemfile.lock+++ b/Gemfile.lock@@ -1093,6 +1093,8 @@ GEMactionpack (>= 6.0.0)activejob (>= 6.0.0)railties (>= 6.0.0)+ turbo_power (0.6.2)+ turbo-rails (>= 1.3.0)typed_dag (2.0.2)rails (>= 5.0.4)tzinfo (2.0.6)@@ -1347,6 +1349,7 @@ DEPENDENCIEStimecop (~> 0.9.0)ttfunk (~> 1.7.0)turbo-rails (~> 2.0.0)+ turbo_power (~> 0.6.2)turbo_tests!typed_dag (~> 2.0.2)tzinfo-data (~> 1.2024.1)diff --git a/frontend/package-lock.json b/frontend/package-lock.jsonindex 6cc63295333..376fe5fcd15 100644--- a/frontend/package-lock.json+++ b/frontend/package-lock.json@@ -99,6 +99,7 @@"tablesorter": "^2.31.3","ts-action": "^11.0.0","ts-action-operators": "^9.1.2",+ "turbo_power": "^0.6.2","typedjson": "^1.5.1","urijs": "^1.19.11","uuid": "^8.3.2",@@ -20479,6 +20480,15 @@"node": ">=16 || 14 >=14.17"}},+ "node_modules/turbo_power": {+ "version": "0.6.2",+ "resolved": "https://registry.npmjs.org/turbo_power/-/turbo_power-0.6.2.tgz",+ "integrity": "sha512-GCrwi6+rSLVORqb1LwP9pf/jP1Zo5lJgzGbLVu8g79T6LvB/9GGg7VWdLlWB0RvvDE1/+3hm32MPtEL5g89fsg==",+ "license": "MIT",+ "peerDependencies": {+ "@hotwired/turbo": ">= 7.2"+ }+ },"node_modules/type": {"version": "2.7.2","resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz",@@ -37048,6 +37058,11 @@}}},+ "turbo_power": {+ "version": "0.6.2",+ "resolved": "https://registry.npmjs.org/turbo_power/-/turbo_power-0.6.2.tgz",+ "integrity": "sha512-GCrwi6+rSLVORqb1LwP9pf/jP1Zo5lJgzGbLVu8g79T6LvB/9GGg7VWdLlWB0RvvDE1/+3hm32MPtEL5g89fsg=="+ },"type": {"version": "2.7.2","resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz",diff --git a/frontend/package.json b/frontend/package.jsonindex dc84ef4770d..d3abc54e5c5 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -150,6 +150,7 @@"tablesorter": "^2.31.3","ts-action": "^11.0.0","ts-action-operators": "^9.1.2",+ "turbo_power": "^0.6.2","typedjson": "^1.5.1","urijs": "^1.19.11","uuid": "^8.3.2",diff --git a/frontend/src/turbo/setup.ts b/frontend/src/turbo/setup.tsindex 9bd905bbb9a..1cda5f53a90 100644--- a/frontend/src/turbo/setup.ts+++ b/frontend/src/turbo/setup.ts@@ -1,5 +1,6 @@import '../typings/shims.d.ts';import * as Turbo from '@hotwired/turbo';+import TurboPower from 'turbo_power'import { registerDialogStreamAction } from './dialog-stream-action';import { addTurboEventListeners } from './turbo-event-listeners';@@ -8,9 +9,13 @@ Turbo.session.drive = false;// Start turboTurbo.start();+// Register our own actionsaddTurboEventListeners();registerDialogStreamAction();+// Register turbo power actions+TurboPower.initialize(Turbo.StreamActions);+// Error handling when "Content missing" returneddocument.addEventListener('turbo:frame-missing', (event:CustomEvent) => {const { detail: { response, visit } } = event as { detail:{ response:Response, visit:(url:string) => void } };