element_component 0.7.0 → 0.8.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 +4 -4
- data/AGENTS.md +2 -2
- data/README.md +83 -83
- data/examples/alert_example.rb +10 -10
- data/examples/badge_example.rb +2 -2
- data/examples/breadcrumb_example.rb +14 -10
- data/examples/button_example.rb +2 -2
- data/examples/button_group_example.rb +3 -3
- data/examples/card_example.rb +13 -13
- data/examples/carousel_example.rb +26 -24
- data/examples/close_button_example.rb +2 -2
- data/examples/dropdown_example.rb +46 -38
- data/examples/list_group_example.rb +26 -18
- data/examples/modal_example.rb +23 -21
- data/examples/nav_example.rb +25 -23
- data/examples/navbar_example.rb +38 -30
- data/examples/pagination_example.rb +16 -16
- data/examples/progress_example.rb +12 -12
- data/examples/spinner_example.rb +2 -2
- data/examples/table_example.rb +3 -3
- data/lib/element_component/components/dropdown.rb +1 -1
- data/lib/element_component/element.rb +5 -3
- data/lib/element_component/version.rb +1 -1
- metadata +1 -1
|
@@ -33,7 +33,7 @@ module ElementComponent
|
|
|
33
33
|
btn = Element.new("button", "aria-expanded": "false", "data-bs-toggle": "dropdown",
|
|
34
34
|
class: "btn btn-#{variant} dropdown-toggle", type: "button", **btn_attributes)
|
|
35
35
|
btn.add_content(label) if label
|
|
36
|
-
|
|
36
|
+
block&.call(self)
|
|
37
37
|
add_content(btn)
|
|
38
38
|
end
|
|
39
39
|
self
|
|
@@ -11,7 +11,7 @@ module ElementComponent
|
|
|
11
11
|
|
|
12
12
|
add_attribute!(attribute)
|
|
13
13
|
reset_contents!
|
|
14
|
-
|
|
14
|
+
block&.call(self)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def add_content!(content)
|
|
@@ -82,9 +82,11 @@ module ElementComponent
|
|
|
82
82
|
|
|
83
83
|
after_render(@html) if respond_to? "after_render"
|
|
84
84
|
|
|
85
|
-
@html
|
|
85
|
+
defined?(ActiveSupport::SafeBuffer) ? @html.html_safe : @html
|
|
86
86
|
end
|
|
87
87
|
|
|
88
|
+
def render_in(view_context, &block) = render
|
|
89
|
+
|
|
88
90
|
private
|
|
89
91
|
|
|
90
92
|
def build
|
|
@@ -105,7 +107,7 @@ module ElementComponent
|
|
|
105
107
|
in Element
|
|
106
108
|
content.render
|
|
107
109
|
in Proc
|
|
108
|
-
result =
|
|
110
|
+
result = content.call(self)
|
|
109
111
|
if result.equal?(self)
|
|
110
112
|
""
|
|
111
113
|
elsif result.respond_to?(:render)
|