theo-rails 0.4.5 → 0.4.7
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/app/views/application/_form_with.html.erb +2 -2
- data/lib/theo-rails/theo.rb +6 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a9443aa5754585dfb06912767c3fe5e8431000789b2be5cf8e537f1246b0cd5
|
4
|
+
data.tar.gz: 487b9b3d1720d687a124c23a362899d19de7092755166148797f58cfbd170d23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 357b54e6e585fd4c199cc50be7e2bdfd048acc8ec57cf4d444243fa3a72cf8e2e7b337886588fc400cae87ff5e0f527bd723cc92195d1c5550e2dabae4d52299
|
7
|
+
data.tar.gz: 4402ff4139b35beb4cc3df13274217c630773a61ded30039bcb29e813671d26d5ed6c9647cd2875cb90f6c4d30febfeb779fb3bbe8e488ec844b861598f8dd7a
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<%# locals: (url: nil, model:
|
2
|
-
<%= form_with url:, model
|
1
|
+
<%# locals: (url: nil, model:false, **attributes) -%>
|
2
|
+
<%= form_with url:, model:, html: attributes do |form| %>
|
3
3
|
<% provide(form:) do %>
|
4
4
|
<%= yield form %>
|
5
5
|
<% end %>
|
data/lib/theo-rails/theo.rb
CHANGED
@@ -46,8 +46,8 @@ module Theo
|
|
46
46
|
|
47
47
|
locals = attributes.empty? ? '' : attributes.map { |k, v| "'#{k}': #{v}" }.join(', ')
|
48
48
|
|
49
|
-
|
50
|
-
is_partial =
|
49
|
+
component = resolve_view_component(partial)
|
50
|
+
is_partial = component.nil?
|
51
51
|
|
52
52
|
if is_partial
|
53
53
|
partial = partial.delete_prefix('_').underscore
|
@@ -65,8 +65,6 @@ module Theo
|
|
65
65
|
output = "<%= render partial: '#{partial}'#{collection}#{locals} %>"
|
66
66
|
end
|
67
67
|
else
|
68
|
-
component = "#{partial}Component"
|
69
|
-
|
70
68
|
if content
|
71
69
|
output = "<%= render #{component}.new(#{locals}) do#{yields} %>#{process(content)}<% end %>"
|
72
70
|
elsif collection
|
@@ -107,11 +105,12 @@ module Theo
|
|
107
105
|
@view_component_loaded ||= Object.const_defined?('ViewComponent')
|
108
106
|
end
|
109
107
|
|
110
|
-
def
|
108
|
+
def resolve_view_component(component)
|
111
109
|
return unless view_component_loaded?
|
112
110
|
|
113
|
-
|
114
|
-
|
111
|
+
# safe_constantize ensures PascalCase
|
112
|
+
klass = component.safe_constantize || "#{component}Component".safe_constantize
|
113
|
+
klass.name if klass && klass < ViewComponent::Base
|
115
114
|
end
|
116
115
|
|
117
116
|
def translate_location(spot, backtrace_location, source)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: theo-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jarek Lipski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|