meta_workflows 0.8.4 → 0.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/meta_workflows/controllers/meta_flash_controller.js +55 -0
- data/app/assets/javascripts/meta_workflows/controllers/redirect_controller.js +7 -1
- data/app/assets/javascripts/meta_workflows_manifest.js +3 -1
- data/app/jobs/meta_workflows/record_redirect_job.rb +11 -4
- data/app/views/meta_workflows/_redirect.html.erb +5 -1
- data/lib/meta_workflows/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b77a7e4c35c915d045693675b711c52ba87a3eac9ba5f16d2dcff556131ebda
|
4
|
+
data.tar.gz: 0d519f2f1e2999a52ecb161a20a3761e9acf441b254303f4607fc225cace5b98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c87dee53a2e8c5f3dfb2f2ec96b1888499a2ce850327910a6062c9e1fede1b727846f29e065a274204c7a233c35e67752665cad46c812227b61256d39588fbca
|
7
|
+
data.tar.gz: 88c0bd57ebc8310bee5dba554672167714159c152dd2952c05566053c6e262b5567c05f04b8ffe5fb22e8bd33e2f15ee5bde8ccd196e2d343fead326b86d5123
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
2
|
+
|
3
|
+
// Auto-initializing flash controller that checks for messages on every page load
|
4
|
+
export default class extends Controller {
|
5
|
+
static targets = []
|
6
|
+
|
7
|
+
connect() {
|
8
|
+
this.checkForFlashMessage()
|
9
|
+
}
|
10
|
+
|
11
|
+
checkForFlashMessage() {
|
12
|
+
const flashMessage = localStorage.getItem('meta_workflows_flash_message')
|
13
|
+
|
14
|
+
if (flashMessage) {
|
15
|
+
this.displayFlashMessage(flashMessage)
|
16
|
+
localStorage.removeItem('meta_workflows_flash_message')
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
displayFlashMessage(message) {
|
21
|
+
const flashDiv = document.createElement('div')
|
22
|
+
flashDiv.style.cssText = `
|
23
|
+
position: fixed;
|
24
|
+
top: 20px;
|
25
|
+
left: 50%;
|
26
|
+
transform: translateX(-50%);
|
27
|
+
background: #10b981;
|
28
|
+
color: white;
|
29
|
+
padding: 12px 16px;
|
30
|
+
border-radius: 6px;
|
31
|
+
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
|
32
|
+
z-index: 9999;
|
33
|
+
opacity: 0;
|
34
|
+
transition: opacity 0.3s ease-in-out;
|
35
|
+
`
|
36
|
+
flashDiv.textContent = message
|
37
|
+
|
38
|
+
document.body.appendChild(flashDiv)
|
39
|
+
|
40
|
+
// Fade in
|
41
|
+
setTimeout(() => {
|
42
|
+
flashDiv.style.opacity = '1'
|
43
|
+
}, 10)
|
44
|
+
|
45
|
+
// Auto-remove after 5 seconds
|
46
|
+
setTimeout(() => {
|
47
|
+
flashDiv.style.opacity = '0'
|
48
|
+
setTimeout(() => {
|
49
|
+
if (flashDiv.parentNode) {
|
50
|
+
flashDiv.parentNode.removeChild(flashDiv)
|
51
|
+
}
|
52
|
+
}, 300)
|
53
|
+
}, 5000)
|
54
|
+
}
|
55
|
+
}
|
@@ -4,11 +4,17 @@ import { Controller } from "@hotwired/stimulus"
|
|
4
4
|
export default class extends Controller {
|
5
5
|
static values = {
|
6
6
|
url: String,
|
7
|
-
delay: { type: Number, default: 500 }
|
7
|
+
delay: { type: Number, default: 500 },
|
8
|
+
message: String
|
8
9
|
}
|
9
10
|
|
10
11
|
connect() {
|
11
12
|
setTimeout(() => {
|
13
|
+
// Store flash message in localStorage if present
|
14
|
+
if (this.hasMessageValue && this.messageValue) {
|
15
|
+
localStorage.setItem('meta_workflows_flash_message', this.messageValue)
|
16
|
+
}
|
17
|
+
|
12
18
|
Turbo.visit(this.urlValue)
|
13
19
|
}, this.delayValue)
|
14
20
|
}
|
@@ -4,10 +4,12 @@
|
|
4
4
|
import LoadingPhrasesController from "./meta_workflows/controllers/loading_phrases_controller"
|
5
5
|
import ResponseScrollController from "./meta_workflows/controllers/response_scroll_controller"
|
6
6
|
import RedirectController from "./meta_workflows/controllers/redirect_controller"
|
7
|
+
import MetaFlashController from "./meta_workflows/controllers/meta_flash_controller"
|
7
8
|
|
8
9
|
// Register controllers with Stimulus
|
9
10
|
const application = window.Stimulus || Application.start()
|
10
11
|
|
11
12
|
application.register("loading-phrases", LoadingPhrasesController)
|
12
13
|
application.register("response-scroll", ResponseScrollController)
|
13
|
-
application.register("redirect", RedirectController)
|
14
|
+
application.register("redirect", RedirectController)
|
15
|
+
application.register("meta-flash", MetaFlashController)
|
@@ -17,18 +17,25 @@ module MetaWorkflows
|
|
17
17
|
record_id = params['redirect_id']
|
18
18
|
record_class = params['redirect_class']
|
19
19
|
redirect_method = params['redirect_method']
|
20
|
+
redirect_message = params['redirect_message']
|
21
|
+
redirect_path_param = params['redirect_path']
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
+
if redirect_path_param.present?
|
24
|
+
redirect_path = Rails.application.routes.url_helpers.send(redirect_path_param.to_s)
|
25
|
+
else
|
26
|
+
record_class_constant = record_class.to_s.safe_constantize
|
27
|
+
record = record_class_constant&.find_by(id: record_id)
|
23
28
|
|
24
|
-
|
29
|
+
redirect_path = Rails.application.routes.url_helpers.send(redirect_method.to_s, record)
|
30
|
+
end
|
25
31
|
|
26
32
|
Turbo::StreamsChannel.broadcast_append_to(
|
27
33
|
turbo_stream_name(@workflow_execution.record),
|
28
34
|
target: target_frame_id(@workflow_execution.record, form: true),
|
29
35
|
partial: meta_redirect,
|
30
36
|
locals: {
|
31
|
-
redirect_path: redirect_path
|
37
|
+
redirect_path: redirect_path,
|
38
|
+
redirect_message: redirect_message
|
32
39
|
}
|
33
40
|
)
|
34
41
|
end
|
@@ -1 +1,5 @@
|
|
1
|
-
<div data-controller="redirect"
|
1
|
+
<div data-controller="redirect"
|
2
|
+
data-redirect-url-value="<%= redirect_path %>"
|
3
|
+
data-redirect-delay-value="0"
|
4
|
+
data-redirect-message-value="<%= local_assigns[:redirect_message] %>">
|
5
|
+
</div>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module MetaWorkflows
|
4
4
|
MAJOR = 0
|
5
5
|
MINOR = 8
|
6
|
-
PATCH =
|
6
|
+
PATCH = 6 # this is automatically incremented by the build process
|
7
7
|
|
8
8
|
VERSION = "#{MetaWorkflows::MAJOR}.#{MetaWorkflows::MINOR}.#{MetaWorkflows::PATCH}".freeze
|
9
9
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meta_workflows
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leonid Medovyy
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2025-06-
|
12
|
+
date: 2025-06-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -115,6 +115,7 @@ files:
|
|
115
115
|
- README.md
|
116
116
|
- Rakefile
|
117
117
|
- app/assets/javascripts/meta_workflows/controllers/loading_phrases_controller.js
|
118
|
+
- app/assets/javascripts/meta_workflows/controllers/meta_flash_controller.js
|
118
119
|
- app/assets/javascripts/meta_workflows/controllers/redirect_controller.js
|
119
120
|
- app/assets/javascripts/meta_workflows/controllers/response_scroll_controller.js
|
120
121
|
- app/assets/javascripts/meta_workflows/controllers/tray_controller.js
|