stimulus_tag_helper 0.2.1 → 0.3.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e14706b60764f1c964d28e6aee33ccbd1bd0ae37276f54551c2cef6382c3043
|
4
|
+
data.tar.gz: b2d6259c7ad45568e8b38fd2410a5cb4f7a2a2624d82fbd98ca9c1f638735f5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30df03a48c9a2b28c8fdd84192c175756bcca535d14c4dc737b32e9afae027a8c95cbc110728e3a828466fe840894675e76937bdb24dedf57236017fc94a0b5e
|
7
|
+
data.tar.gz: 7270c3d1959724d3a481d805f0bdd87f4243f525c18ac01298b71fe7c89521453945e0d13d830afd71513b3a5fcbad6967750b6097ad5fa0dce19b264847792e
|
@@ -6,9 +6,14 @@ module StimulusTagHelper
|
|
6
6
|
delegate :properties, :aliases, :attribute_method_name_for, :property_method_name_for, to: StimulusTagHelper
|
7
7
|
end
|
8
8
|
|
9
|
-
|
9
|
+
attr_reader :identifier, :template, :tag, :tag_options
|
10
|
+
|
11
|
+
# all the options are tag options of now
|
12
|
+
def initialize(identifier:, template:, tag: nil, **tag_options)
|
10
13
|
@identifier = identifier
|
11
14
|
@template = template
|
15
|
+
@tag = tag
|
16
|
+
@tag_options = tag_options
|
12
17
|
end
|
13
18
|
|
14
19
|
properties.each do |name|
|
@@ -18,7 +23,7 @@ module StimulusTagHelper
|
|
18
23
|
|
19
24
|
class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
|
20
25
|
def #{name}(*args, **kwargs) # def values(*args, **kwargs)
|
21
|
-
|
26
|
+
template.stimulus_#{attribute_method_name}(*args.unshift(identifier), **kwargs) # template.stimulus_values_attributes(*args.unshift(identifier), **kwargs)
|
22
27
|
end # end
|
23
28
|
|
24
29
|
alias_method :#{alias_name}, :#{name} # alias_method :value, :values
|
@@ -26,7 +31,7 @@ module StimulusTagHelper
|
|
26
31
|
alias_method :#{alias_name}_attribute, :#{name} # alias_method :value_attribute, :values
|
27
32
|
|
28
33
|
def #{property_method_name}(*args, **kwargs) # def values_properties(*args, **kwargs)
|
29
|
-
|
34
|
+
template.stimulus_#{property_method_name}(*args.unshift(identifier), **kwargs) # template.stimulus_values_properties(*args.unshift(identifier), **kwargs)
|
30
35
|
end # end
|
31
36
|
|
32
37
|
alias_method :#{alias_name}_property, :#{property_method_name} # alias_method :value_property, :values_properties
|
@@ -34,7 +39,19 @@ module StimulusTagHelper
|
|
34
39
|
end
|
35
40
|
|
36
41
|
def attributes(**attributes)
|
37
|
-
|
42
|
+
template.stimulus_attributes(identifier, **attributes)
|
43
|
+
end
|
44
|
+
|
45
|
+
def properties(**properties)
|
46
|
+
template.stimulus_properties(identifier, **properties)
|
47
|
+
end
|
48
|
+
|
49
|
+
def capture(&block)
|
50
|
+
return template.capture(self, &block) unless tag
|
51
|
+
|
52
|
+
template.stimulus_controller_tag(identifier, tag: tag, **tag_options) do
|
53
|
+
template.capture(self, &block)
|
54
|
+
end
|
38
55
|
end
|
39
56
|
end
|
40
57
|
end
|
data/lib/stimulus_tag_helper.rb
CHANGED
@@ -44,16 +44,10 @@ module StimulusTagHelper
|
|
44
44
|
STRING
|
45
45
|
end
|
46
46
|
|
47
|
-
def stimulus_controller(identifier, tag: nil, **
|
48
|
-
|
49
|
-
|
50
|
-
builder
|
51
|
-
|
52
|
-
return capture(builder, &block) unless tag
|
53
|
-
|
54
|
-
stimulus_controller_tag(identifier, tag: tag, **args) do
|
55
|
-
capture(builder, &block)
|
56
|
-
end
|
47
|
+
def stimulus_controller(identifier, tag: nil, **options, &block)
|
48
|
+
builder = StimulusControllerBuilder.new(identifier: identifier, tag: tag, template: self, **options)
|
49
|
+
return builder unless block
|
50
|
+
builder.capture(&block)
|
57
51
|
end
|
58
52
|
|
59
53
|
# controller arg is used to add additional stimulus controllers to the element
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stimulus_tag_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Topchii
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|