compony 0.3.1 → 0.3.3
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/CHANGELOG.md +9 -0
- data/VERSION +1 -1
- data/compony.gemspec +4 -4
- data/doc/ComponentGenerator.html +3 -3
- data/doc/Components.html +3 -3
- data/doc/ComponentsGenerator.html +3 -3
- data/doc/Compony/Component.html +138 -45
- data/doc/Compony/ComponentMixins/Default/Labelling.html +3 -3
- data/doc/Compony/ComponentMixins/Default/Standalone/ResourcefulVerbDsl.html +3 -3
- data/doc/Compony/ComponentMixins/Default/Standalone/StandaloneDsl.html +3 -3
- data/doc/Compony/ComponentMixins/Default/Standalone/VerbDsl.html +3 -3
- data/doc/Compony/ComponentMixins/Default/Standalone.html +3 -3
- data/doc/Compony/ComponentMixins/Default.html +3 -3
- data/doc/Compony/ComponentMixins/Resourceful.html +3 -3
- data/doc/Compony/ComponentMixins.html +3 -3
- data/doc/Compony/Components/Button.html +4 -4
- data/doc/Compony/Components/Destroy.html +4 -4
- data/doc/Compony/Components/Edit.html +20 -20
- data/doc/Compony/Components/Form.html +4 -4
- data/doc/Compony/Components/New.html +4 -4
- data/doc/Compony/Components/WithForm.html +4 -4
- data/doc/Compony/Components.html +3 -3
- data/doc/Compony/ControllerMixin.html +3 -3
- data/doc/Compony/Engine.html +3 -3
- data/doc/Compony/MethodAccessibleHash.html +3 -3
- data/doc/Compony/ModelFields/Anchormodel.html +3 -3
- data/doc/Compony/ModelFields/Association.html +3 -3
- data/doc/Compony/ModelFields/Attachment.html +3 -3
- data/doc/Compony/ModelFields/Base.html +3 -3
- data/doc/Compony/ModelFields/Boolean.html +3 -3
- data/doc/Compony/ModelFields/Color.html +3 -3
- data/doc/Compony/ModelFields/Currency.html +3 -3
- data/doc/Compony/ModelFields/Date.html +3 -3
- data/doc/Compony/ModelFields/Datetime.html +3 -3
- data/doc/Compony/ModelFields/Decimal.html +3 -3
- data/doc/Compony/ModelFields/Email.html +3 -3
- data/doc/Compony/ModelFields/Float.html +3 -3
- data/doc/Compony/ModelFields/Integer.html +3 -3
- data/doc/Compony/ModelFields/Percentage.html +3 -3
- data/doc/Compony/ModelFields/Phone.html +3 -3
- data/doc/Compony/ModelFields/RichText.html +3 -3
- data/doc/Compony/ModelFields/String.html +3 -3
- data/doc/Compony/ModelFields/Text.html +3 -3
- data/doc/Compony/ModelFields/Time.html +3 -3
- data/doc/Compony/ModelFields/Url.html +3 -3
- data/doc/Compony/ModelFields.html +3 -3
- data/doc/Compony/ModelMixin.html +3 -3
- data/doc/Compony/NaturalOrdering.html +3 -3
- data/doc/Compony/RequestContext.html +72 -5
- data/doc/Compony/Version.html +3 -3
- data/doc/Compony/ViewHelpers.html +3 -3
- data/doc/Compony.html +3 -3
- data/doc/ComponyController.html +3 -3
- data/doc/_index.html +4 -4
- data/doc/file.README.html +3 -3
- data/doc/frames.html +10 -5
- data/doc/index.html +3 -3
- data/doc/method_list.html +96 -80
- data/doc/top-level-namespace.html +3 -3
- data/lib/compony/component.rb +14 -3
- data/lib/compony/components/edit.rb +4 -0
- data/lib/compony/request_context.rb +8 -1
- metadata +3 -3
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Top Level Namespace
|
8
8
|
|
9
|
-
— Documentation by YARD 0.9.
|
9
|
+
— Documentation by YARD 0.9.36
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -102,9 +102,9 @@
|
|
102
102
|
</div>
|
103
103
|
|
104
104
|
<div id="footer">
|
105
|
-
Generated on
|
105
|
+
Generated on Mon Jun 3 15:20:40 2024 by
|
106
106
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
107
|
-
0.9.
|
107
|
+
0.9.36 (ruby-3.2.2).
|
108
108
|
</div>
|
109
109
|
|
110
110
|
</div>
|
data/lib/compony/component.rb
CHANGED
@@ -141,9 +141,20 @@ module Compony
|
|
141
141
|
# Removes a content block. Use this in subclasses if a content block defined in the parent should be removed from the child.
|
142
142
|
# @param [Symbol,String] name Name of the content block that should be removed
|
143
143
|
def remove_content(name)
|
144
|
-
|
145
|
-
existing_index
|
146
|
-
|
144
|
+
existing_index = @content_blocks.find_index { |el| el.name == name.to_sym }
|
145
|
+
if existing_index.nil?
|
146
|
+
return false
|
147
|
+
else
|
148
|
+
@content_blocks.delete_at(existing_index)
|
149
|
+
return true
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
# DSL method
|
154
|
+
# Removes a content block and fails if the content block was not found.
|
155
|
+
# @param [Symbol,String] name Name of the content block that should be removed
|
156
|
+
def remove_content!(name)
|
157
|
+
remove_content(name) || fail("Content block #{name.inspect} not found for removal in #{inspect}.")
|
147
158
|
end
|
148
159
|
|
149
160
|
# Renders the component using the controller passsed to it and returns it as a string.
|
@@ -35,6 +35,10 @@ module Compony
|
|
35
35
|
Compony.button(:show, @data.send(data_class.owner_model_attr), icon: :xmark, color: :secondary, label: I18n.t('compony.cancel'))
|
36
36
|
end
|
37
37
|
|
38
|
+
content :label do
|
39
|
+
h2 component.label
|
40
|
+
end
|
41
|
+
|
38
42
|
content do
|
39
43
|
concat form_comp.render(controller, data: @data)
|
40
44
|
end
|
@@ -45,7 +45,9 @@ module Compony
|
|
45
45
|
# Renders a content block from the current component.
|
46
46
|
def content(name)
|
47
47
|
name = name.to_sym
|
48
|
-
content_block = component.content_blocks.find { |el| el.name == name }
|
48
|
+
content_block = component.content_blocks.find { |el| el.name == name }
|
49
|
+
return false if content_block.nil?
|
50
|
+
|
49
51
|
# We have to clear Rails' output_buffer to prevent double rendering of blocks. To achieve this, a fresh render context is instanciated.
|
50
52
|
concat controller.render_to_string(
|
51
53
|
type: :dyny,
|
@@ -54,6 +56,11 @@ module Compony
|
|
54
56
|
Compony::RequestContext.new(render_component, render_controller, helpers: self, locals: local_assigns).evaluate_with_backfire(&render_block.payload)
|
55
57
|
RUBY
|
56
58
|
)
|
59
|
+
return true
|
60
|
+
end
|
61
|
+
|
62
|
+
def content!(name)
|
63
|
+
content(name) || fail("Content block #{name.inspect} not found in #{component.inspect}.")
|
57
64
|
end
|
58
65
|
end
|
59
66
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: compony
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sandro Kalbermatter
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-06-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: yard
|
@@ -330,7 +330,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
330
330
|
- !ruby/object:Gem::Version
|
331
331
|
version: '0'
|
332
332
|
requirements: []
|
333
|
-
rubygems_version: 3.5.
|
333
|
+
rubygems_version: 3.5.11
|
334
334
|
signing_key:
|
335
335
|
specification_version: 4
|
336
336
|
summary: Compony is a Gem that allows you to write your Rails application in component-style
|