proscenium 0.15.0.beta.5-x86_64-linux → 0.15.0.beta.7-x86_64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/proscenium/ext/proscenium +0 -0
- data/lib/proscenium/importer.rb +20 -3
- data/lib/proscenium/libs/ujs/data_confirm.js +17 -10
- data/lib/proscenium/side_load.rb +13 -1
- data/lib/proscenium/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee3f15d3e012c29b9ccaf4407e4cc2c5cdc44b20a2e880bf1f42a7486f917a84
|
4
|
+
data.tar.gz: 622933b2d4cd21bd1f27b64e1a6659609007c3b2f2dcdab6c7d16f18576925a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64c5a1f1f38d0f0611fd7a30eafbbecfa79c490daedde990af76aea49491df15d862ee42dc43039d4f6530804acf1f87fb5ad793c77b4ee61926be58688abbc7
|
7
|
+
data.tar.gz: d2a61a850cd492f141a77685d3d2fe6ad4d085daf9f417ce333c74257fb8675f158d5026627111e906a585f1752c7f646e27186b29fec57195afe1f6e15b328e
|
Binary file
|
data/lib/proscenium/importer.rb
CHANGED
@@ -61,19 +61,36 @@ module Proscenium
|
|
61
61
|
#
|
62
62
|
# @param filepath [Pathname] Absolute file system path of the Ruby file to sideload.
|
63
63
|
def sideload(filepath, **options)
|
64
|
+
return if !Proscenium.config.side_load || (options[:js] == false && options[:css] == false)
|
65
|
+
|
66
|
+
sideload_js(filepath, **options) unless options[:js] == false
|
67
|
+
sideload_css(filepath, **options) unless options[:css] == false
|
68
|
+
end
|
69
|
+
|
70
|
+
def sideload_js(filepath, **options)
|
64
71
|
return unless Proscenium.config.side_load
|
65
72
|
|
66
73
|
filepath = Rails.root.join(filepath) unless filepath.is_a?(Pathname)
|
67
74
|
filepath = filepath.sub_ext('')
|
68
75
|
|
69
|
-
|
76
|
+
JS_EXTENSIONS.find do |x|
|
70
77
|
if (fp = filepath.sub_ext(x)).exist?
|
71
78
|
import(Resolver.resolve(fp.to_s), sideloaded: true, **options)
|
72
79
|
end
|
73
80
|
end
|
81
|
+
end
|
74
82
|
|
75
|
-
|
76
|
-
|
83
|
+
def sideload_css(filepath, **options)
|
84
|
+
return unless Proscenium.config.side_load
|
85
|
+
|
86
|
+
filepath = Rails.root.join(filepath) unless filepath.is_a?(Pathname)
|
87
|
+
filepath = filepath.sub_ext('')
|
88
|
+
|
89
|
+
CSS_EXTENSIONS.find do |x|
|
90
|
+
if (fp = filepath.sub_ext(x)).exist?
|
91
|
+
import(Resolver.resolve(fp.to_s), sideloaded: true, **options)
|
92
|
+
end
|
93
|
+
end
|
77
94
|
end
|
78
95
|
|
79
96
|
def each_stylesheet(delete: false)
|
@@ -1,16 +1,23 @@
|
|
1
1
|
export default class DataConfirm {
|
2
|
-
onSubmit = event => {
|
3
|
-
if (
|
4
|
-
|
2
|
+
onSubmit = (event) => {
|
3
|
+
if (
|
4
|
+
!event.target.matches("[data-turbo=true]") &&
|
5
|
+
event.submitter &&
|
6
|
+
"confirm" in event.submitter.dataset
|
7
|
+
) {
|
8
|
+
const v = event.submitter.dataset.confirm;
|
5
9
|
|
6
|
-
if (
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
10
|
+
if (
|
11
|
+
v !== "false" &&
|
12
|
+
!confirm(v === "true" || v === "" ? "Are you sure?" : v)
|
13
|
+
) {
|
14
|
+
event.preventDefault();
|
15
|
+
event.stopPropagation();
|
16
|
+
event.stopImmediatePropagation();
|
17
|
+
return false;
|
11
18
|
}
|
12
19
|
}
|
13
20
|
|
14
|
-
return true
|
15
|
-
}
|
21
|
+
return true;
|
22
|
+
};
|
16
23
|
}
|
data/lib/proscenium/side_load.rb
CHANGED
@@ -127,16 +127,28 @@ module Proscenium
|
|
127
127
|
options[k] = obj.instance_eval(&options[k]) if options[k].is_a?(Proc)
|
128
128
|
end
|
129
129
|
|
130
|
+
css_imports = []
|
131
|
+
|
130
132
|
klass = obj.class
|
131
133
|
while klass.respond_to?(:source_path) && klass.source_path && !klass.abstract_class
|
132
134
|
if klass.respond_to?(:sideload)
|
133
135
|
klass.sideload options
|
134
|
-
|
136
|
+
elsif options[:css] == false
|
135
137
|
Importer.sideload klass.source_path, **options
|
138
|
+
else
|
139
|
+
Importer.sideload_js klass.source_path, **options
|
140
|
+
css_imports << klass.source_path
|
136
141
|
end
|
137
142
|
|
138
143
|
klass = klass.superclass
|
139
144
|
end
|
145
|
+
|
146
|
+
# The reason why we sideload CSS after JS is because the order of CSS is important.
|
147
|
+
# Basically, the layout should be loaded before the view so that CSS cascading works i9n the
|
148
|
+
# right direction.
|
149
|
+
css_imports.reverse_each do |it|
|
150
|
+
Importer.sideload_css it, **options
|
151
|
+
end
|
140
152
|
end
|
141
153
|
end
|
142
154
|
end
|
data/lib/proscenium/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proscenium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.0.beta.
|
4
|
+
version: 0.15.0.beta.7
|
5
5
|
platform: x86_64-linux
|
6
6
|
authors:
|
7
7
|
- Joel Moss
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -64,14 +64,14 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 1.
|
67
|
+
version: 1.17.0
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 1.
|
74
|
+
version: 1.17.0
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: oj
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -221,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '0'
|
223
223
|
requirements: []
|
224
|
-
rubygems_version: 3.5.
|
224
|
+
rubygems_version: 3.5.11
|
225
225
|
signing_key:
|
226
226
|
specification_version: 4
|
227
227
|
summary: The engine powering your Rails frontend
|