props_template 0.31.0 → 0.33.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70f4fab3905ff69848d013d7c338bdcd2c83d87a946e6a23dc28ef1361bb69bf
4
- data.tar.gz: 441cea11b9c19da3e2179771f7e6df2d370e79e7888955f4401daae96b4088a1
3
+ metadata.gz: b586e88a8525a50dca7c4c045c965e150db70214dcd409c8f548eb00f2b229c9
4
+ data.tar.gz: 03f66f95514d80127c949b2aa6de035885718887d5ca300a6052e2b7b1215f2a
5
5
  SHA512:
6
- metadata.gz: a61229bdb5f3c4e61a66a508b371a3e3d74ddffd0091b03b1bed47ba34d36f5e2a7d128fc8e8980fab992f2c784dce670687af72ab9c75af58a5e590898daac9
7
- data.tar.gz: 1fdda8df4b8c30f41b3ce5c4537c90f129f7ef7ee853fffa4e3b8dc5afbfdbc64ebf9017ec332ad66d863fd16b5cd16fcaf44431aeb1315793ceb6b5490d349d
6
+ metadata.gz: d328e82015fb1079fc6593f9441b30259bbfe54b414ce260f6522e66754537e7cb8b5449c2bdcd835b6df4a8246d5dedfb318faefeccb8a270b0419a2453de2a
7
+ data.tar.gz: 1066e3c36218fc2c5d87f8a309439c0fc01f44ef4a60c5fe173076ab6f2c5b662fb92e8c75b95ce20797760b173ac58f615baded52aea272b5d36e4706b41952
data/README.md CHANGED
@@ -71,7 +71,8 @@ gem 'props_template'
71
71
 
72
72
  and run `bundle`.
73
73
 
74
- Add the [core ext](#array-core-extension) to an initializer.
74
+ Optionally add the [core ext](#array-core-extension) to an initializer if you
75
+ want to [dig](#traverse) into your templates.
75
76
 
76
77
  ```ruby
77
78
  require 'props_template/core_ext'
@@ -1,6 +1,12 @@
1
1
  module Props
2
2
  module LayoutPatch
3
3
  def render_template(view, template, layout_name, locals)
4
+ unless view.respond_to? :active_template_virtual_path
5
+ view.instance_eval <<~RUBY, __FILE__, __LINE__ + 1
6
+ def active_template_virtual_path; "#{template.virtual_path}";end
7
+ RUBY
8
+ end
9
+
4
10
  if template.respond_to?(:handler) && template.handler == Props::Handler && layout_name
5
11
  prepend_formats(template.format)
6
12
  render_props_template(view, template, layout_name, locals)
@@ -11,6 +17,7 @@ module Props
11
17
 
12
18
  def render_props_template(view, template, path, locals)
13
19
  layout = resolve_layout(path, locals.keys, [formats.first])
20
+
14
21
  body = if layout
15
22
  layout.render(view, locals) do |json|
16
23
  template.render(view, locals)
@@ -10,5 +10,18 @@ module Props
10
10
  require "props_template/layout_patch"
11
11
  end
12
12
  end
13
+
14
+ module ::ActionController
15
+ module ApiRendering
16
+ include ActionView::Rendering
17
+ end
18
+ end
19
+
20
+ ActiveSupport.on_load :action_controller do
21
+ if name == "ActionController::API"
22
+ include ActionController::Helpers
23
+ include ActionController::ImplicitRender
24
+ end
25
+ end
13
26
  end
14
27
  end
@@ -1,3 +1,3 @@
1
1
  module Props
2
- VERSION = "0.31.0".freeze
2
+ VERSION = "0.33.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: props_template
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.31.0
4
+ version: 0.33.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johny Ho
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-07 00:00:00.000000000 Z
11
+ date: 2024-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 6.0.0
19
+ version: 6.1.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 6.0.0
26
+ version: 6.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: actionview
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 6.0.0
33
+ version: 6.1.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 6.0.0
40
+ version: 6.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: oj
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -80,7 +80,7 @@ homepage: https://github.com/thoughtbot/props_template/
80
80
  licenses:
81
81
  - MIT
82
82
  metadata: {}
83
- post_install_message:
83
+ post_install_message:
84
84
  rdoc_options: []
85
85
  require_paths:
86
86
  - lib
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  version: '0'
97
97
  requirements: []
98
98
  rubygems_version: 3.1.6
99
- signing_key:
99
+ signing_key:
100
100
  specification_version: 4
101
101
  summary: A fast JSON builder
102
102
  test_files: []