theo-rails 0.1.0 → 0.1.2
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/_email_field.html.erb +3 -1
- data/app/views/application/_form_with.html.erb +3 -1
- data/app/views/application/_label.html.erb +3 -1
- data/app/views/application/_number_field.html.erb +3 -1
- data/app/views/application/_select.html.erb +3 -1
- data/app/views/application/_submit.html.erb +3 -1
- data/app/views/application/_text_area.html.erb +3 -1
- data/app/views/application/_text_field.html.erb +3 -1
- data/lib/theo-rails/helpers.rb +18 -0
- data/lib/theo-rails/railtie.rb +2 -1
- data/lib/theo-rails/theo.rb +2 -2
- data/lib/theo-rails.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a47ba0ddf03dcfcfb0f712ada5463e4bc2226ce299b818c41f931eaf37337be1
|
4
|
+
data.tar.gz: c595cc7b8548ccb085f8c11467fe01d611cdd56492bce78097c15d907d2c4e2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8086955a23ee2389321b560033282045a56595366299739b3767454e74121c24b2a3bfd50bff46840984d7ca099a8205d80ebb0e0e6ac8536a81ef2e31e28978
|
7
|
+
data.tar.gz: eccbd592a2d340674a8226d9d77cacabfd47aa99256edd2a6f14350a4408f1ad68efa04215d259244074224713d6282152b53fa42c488ade521ecc59554d2539
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Theo
|
2
|
+
module Rails
|
3
|
+
module Helpers
|
4
|
+
def provide(**args)
|
5
|
+
@theo_context ||= {}
|
6
|
+
@theo_context.merge!(args)
|
7
|
+
|
8
|
+
yield
|
9
|
+
|
10
|
+
@theo_context.except!(args.keys)
|
11
|
+
end
|
12
|
+
|
13
|
+
def inject(key)
|
14
|
+
@theo_context&.[](key)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/theo-rails/railtie.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
module Theo
|
2
2
|
module Rails
|
3
3
|
class Railtie < ::Rails::Railtie
|
4
|
-
initializer 'initialize theo
|
4
|
+
initializer 'initialize theo' do
|
5
5
|
ActiveSupport.on_load(:action_view) do
|
6
6
|
::ActionView::Template.register_template_handler :theo, :'erb.theo', Theo.new
|
7
|
+
include ::Theo::Rails::Helpers
|
7
8
|
end
|
8
9
|
end
|
9
10
|
end
|
data/lib/theo-rails/theo.rb
CHANGED
@@ -42,12 +42,12 @@ module Theo
|
|
42
42
|
collection = ", collection: #{collection}#{as}"
|
43
43
|
end
|
44
44
|
|
45
|
-
|
45
|
+
yields = "|#{attributes.delete(:yields)}|" if attributes[:yields]
|
46
46
|
|
47
47
|
attributes.transform_values! { |value| attribute(value) }
|
48
48
|
|
49
49
|
if content
|
50
|
-
output = "<%= render '#{partial}', {#{attributes.map {|k,v| "'#{k}': #{v}"}.join(', ')}} do #{
|
50
|
+
output = "<%= render '#{partial}', {#{attributes.map {|k,v| "'#{k}': #{v}"}.join(', ')}} do #{yields || ''} %>#{process(content)}<% end %>"
|
51
51
|
else
|
52
52
|
output = "<%= render partial: '#{partial}'#{collection}, locals: {#{attributes.map {|k,v| "'#{k}': #{v}"}.join(', ')}} %>"
|
53
53
|
end
|
data/lib/theo-rails.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jarek Lipski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: HTML-like template language for Rails with natural partial syntax
|
14
14
|
email: jarek@jareklipski.com
|
@@ -26,6 +26,7 @@ files:
|
|
26
26
|
- app/views/application/_text_field.html.erb
|
27
27
|
- lib/theo-rails.rb
|
28
28
|
- lib/theo-rails/engine.rb
|
29
|
+
- lib/theo-rails/helpers.rb
|
29
30
|
- lib/theo-rails/railtie.rb
|
30
31
|
- lib/theo-rails/theo.rb
|
31
32
|
homepage: https://github.com/loomchild/theo-rails
|