props_template 0.20.0 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -4
- data/lib/props_template/extensions/deferment.rb +2 -2
- data/lib/props_template/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23e014144b689057bd6e6cc96a007b17263a2eab2a84890dd822056c2a4e258d
|
4
|
+
data.tar.gz: bba7578e983913d2eeeb15fc12026bb66b25c6da5a8df52c4d2003e8615a2eba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1adee8973b67e46c8c2169a7664ec92c0ee52e21451108b449888b8a8dd89221b46d2918da2ace75e016530a7654ce03a513f4f761cb2f6fa938dd76d4a18ed
|
7
|
+
data.tar.gz: 2bc87b68c92e21f4755bf4a41c8ea1290bbfcd94f570fa2cf98b86fc2eecaa9ae83eae0f58042c3ae18cfd9c9f0d0c54caa23b5cff4c92814dfd81b3e306baa0
|
data/README.md
CHANGED
@@ -71,7 +71,24 @@ end
|
|
71
71
|
gem 'props_template'
|
72
72
|
```
|
73
73
|
|
74
|
-
and run `bundle
|
74
|
+
and run `bundle`.
|
75
|
+
|
76
|
+
Add the [core ext](#array-core-extension) to an initializer.
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
require 'props_template/core_ext'
|
80
|
+
```
|
81
|
+
|
82
|
+
|
83
|
+
And create a file in your `app/views` folder like so:
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
# app/views/posts/index.json.props
|
87
|
+
|
88
|
+
json.greetings "hello world"
|
89
|
+
```
|
90
|
+
|
91
|
+
You can also add a [layout](#layouts).
|
75
92
|
|
76
93
|
## API
|
77
94
|
|
@@ -247,7 +264,7 @@ Returns all deferred nodes used by the [deferment](#deferment) option.
|
|
247
264
|
```ruby
|
248
265
|
json.deferred json.deferred!
|
249
266
|
|
250
|
-
# => [{url: '/some_url?
|
267
|
+
# => [{url: '/some_url?props_at=outer.inner', path: 'outer.inner', type: 'auto'}]
|
251
268
|
```
|
252
269
|
|
253
270
|
This method provides metadata about deferred nodes to the frontend ([BreezyJS][1])
|
@@ -420,7 +437,7 @@ The default behavior for deferements is to use the index of the collection to
|
|
420
437
|
identify an element.
|
421
438
|
|
422
439
|
**Note** If you are using this library with [BreezyJS][1], the `:auto` options will
|
423
|
-
generate `?
|
440
|
+
generate `?props_at=a.b.c.0.title` for `json.deferred!`.
|
424
441
|
|
425
442
|
If you wish to use an attribute to identify the element. You must:
|
426
443
|
|
@@ -453,7 +470,7 @@ end
|
|
453
470
|
```
|
454
471
|
|
455
472
|
If you are using [BreezyJS][1], BreezyJS will, it will automatically kick off
|
456
|
-
`remote(?
|
473
|
+
`remote(?props_at=posts.some_id=1.contact)` and `remote(?props_at=posts.some_id=2.contact)`.
|
457
474
|
|
458
475
|
## Traversing
|
459
476
|
|
@@ -47,8 +47,8 @@ module Props
|
|
47
47
|
path = @base.traveled_path.join('.')
|
48
48
|
uri = ::URI.parse(request_path)
|
49
49
|
qry = ::URI.decode_www_form(uri.query || '')
|
50
|
-
.reject{|x| x[0] == '
|
51
|
-
.push(["
|
50
|
+
.reject{|x| x[0] == 'props_at' }
|
51
|
+
.push(["props_at", path])
|
52
52
|
|
53
53
|
uri.query = ::URI.encode_www_form(qry)
|
54
54
|
|
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.
|
4
|
+
version: 0.21.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:
|
11
|
+
date: 2022-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -84,7 +84,7 @@ homepage: https://github.com/thoughtbot/props_template/
|
|
84
84
|
licenses:
|
85
85
|
- MIT
|
86
86
|
metadata: {}
|
87
|
-
post_install_message:
|
87
|
+
post_install_message:
|
88
88
|
rdoc_options: []
|
89
89
|
require_paths:
|
90
90
|
- lib
|
@@ -99,8 +99,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: '0'
|
101
101
|
requirements: []
|
102
|
-
rubygems_version: 3.1.
|
103
|
-
signing_key:
|
102
|
+
rubygems_version: 3.1.4
|
103
|
+
signing_key:
|
104
104
|
specification_version: 4
|
105
105
|
summary: A fast JSON builder
|
106
106
|
test_files:
|