stimulus-rails 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/app/assets/javascripts/stimulus-importmap-autoloader.js +1 -1
- data/app/assets/javascripts/stimulus.js +1924 -2
- data/lib/stimulus/manifest.rb +12 -8
- data/lib/stimulus/version.rb +1 -1
- metadata +2 -5
- data/app/assets/javascripts/stimulus@2.js +0 -1699
- data/app/assets/javascripts/stimulus@3.0.0-beta.1.js +0 -2058
- data/app/assets/javascripts/stimulus@3.0.0-beta.2.js +0 -2034
data/lib/stimulus/manifest.rb
CHANGED
@@ -3,21 +3,25 @@ module Stimulus::Manifest
|
|
3
3
|
|
4
4
|
def generate_from(controllers_path)
|
5
5
|
extract_controllers_from(controllers_path).collect do |controller_path|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
import_and_register_controller(controllers_path, controller_path)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def import_and_register_controller(controllers_path, controller_path)
|
11
|
+
module_path = controller_path.relative_path_from(controllers_path).to_s.remove(".js")
|
12
|
+
controller_class_name = module_path.camelize.gsub(/::/, "__")
|
13
|
+
tag_name = module_path.remove("_controller").gsub(/_/, "-").gsub(/\//, "--")
|
14
|
+
|
15
|
+
<<-JS
|
11
16
|
|
12
17
|
import #{controller_class_name} from "./#{module_path}"
|
13
18
|
application.register("#{tag_name}", #{controller_class_name})
|
14
|
-
|
15
|
-
end
|
19
|
+
JS
|
16
20
|
end
|
17
21
|
|
18
22
|
def extract_controllers_from(directory)
|
19
23
|
(directory.children.select { |e| e.to_s =~ /_controller.js$/ } +
|
20
24
|
directory.children.select(&:directory?).collect { |d| extract_controllers_from(d) }
|
21
|
-
).flatten
|
25
|
+
).flatten.sort
|
22
26
|
end
|
23
27
|
end
|
data/lib/stimulus/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stimulus-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Stephenson
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-09-
|
13
|
+
date: 2021-09-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -38,9 +38,6 @@ files:
|
|
38
38
|
- app/assets/javascripts/stimulus-autoloader.js
|
39
39
|
- app/assets/javascripts/stimulus-importmap-autoloader.js
|
40
40
|
- app/assets/javascripts/stimulus.js
|
41
|
-
- app/assets/javascripts/stimulus@2.js
|
42
|
-
- app/assets/javascripts/stimulus@3.0.0-beta.1.js
|
43
|
-
- app/assets/javascripts/stimulus@3.0.0-beta.2.js
|
44
41
|
- lib/generators/stimulus/USAGE
|
45
42
|
- lib/generators/stimulus/stimulus_generator.rb
|
46
43
|
- lib/generators/stimulus/templates/controller.js.tt
|