props_template 0.21.1 → 0.22.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe0d4afac65f1f86e1adfdcc956cc21d6df96a54e55e1ab26c8fa450c6a2a7be
4
- data.tar.gz: ea96579bc3d06512867d4c11ee619051a205d64e814e5fe643debd5085d2b56e
3
+ metadata.gz: 536af22bcde36c372950f99d9bc6a71ce5767c2a7f2736641554613e71d0e52d
4
+ data.tar.gz: a271f7be2ba091d137aa10fbae9143b6ec53789cfefe94f9936ad8fc594273b5
5
5
  SHA512:
6
- metadata.gz: 363ed26b474344ec9e17b328521d10a2e226761272e80f49e72b32e6943f47e3e970d7939e0923548984e96a1cb361ff3e74beebfa058dabe86db4a683e48746
7
- data.tar.gz: d99478adad2b0980ce471f992c32d8a8fb0ee4348c469cb7e25b3752c6e44c0181f4beb31bc14a65efafe4d3250588ad8b0d9713eade62ee48107a3072dafbfa
6
+ metadata.gz: '0038a530eeaeebdcc541cfbd36d807f7b40d4324a04d290971c2dd8f9996daf2d39e8e4f2db226de89bc86f1641ae15902637fc623fe5a6a82dd89ccb88a6313'
7
+ data.tar.gz: c52fc5c39f851665cf81393d86bed834f3c9c239b2135d887dc6ccc1979437b521443c975250fc911b883959d3558a9fada74ff7a6593712520cdd982a9e1d83
data/README.md CHANGED
@@ -257,8 +257,8 @@ may still need to implement `member_by`.
257
257
  ### json.deferred!
258
258
  Returns all deferred nodes used by the [deferment](#deferment) option.
259
259
 
260
- **Note** This is a [BreezyJS][1] specific functionality and is used in
261
- `application.json.props` when first running `rails breezy:install:web`
260
+ **Note** This is a [SuperglueJS][1] specific functionality and is used in
261
+ `application.json.props` when first running `rails superglue:install:web`
262
262
 
263
263
 
264
264
  ```ruby
@@ -267,7 +267,7 @@ json.deferred json.deferred!
267
267
  # => [{url: '/some_url?props_at=outer.inner', path: 'outer.inner', type: 'auto'}]
268
268
  ```
269
269
 
270
- This method provides metadata about deferred nodes to the frontend ([BreezyJS][1])
270
+ This method provides metadata about deferred nodes to the frontend ([SuperglueJS][1])
271
271
  to fetch missing data in a second round trip.
272
272
 
273
273
  ### json.fragments!
@@ -276,8 +276,8 @@ option.
276
276
 
277
277
  ```ruby json.fragments json.fragments! ```
278
278
 
279
- **Note** This is a [BreezyJS][1] specific functionality and is used in
280
- `application.json.props` when first running `rails breezy:install:web`
279
+ **Note** This is a [SuperglueJS][1] specific functionality and is used in
280
+ `application.json.props` when first running `rails superglue:install:web`
281
281
 
282
282
  ## Options
283
283
  Options Functionality such as Partials, Deferements, and Caching can only be
@@ -311,7 +311,7 @@ end
311
311
  ```
312
312
 
313
313
  ### Partial Fragments
314
- **Note** This is a [BreezyJS][1] specific functionality.
314
+ **Note** This is a [SuperglueJS][1] specific functionality.
315
315
 
316
316
  A fragment identifies a partial output across multiple pages. It can be used to
317
317
  update cross cutting concerns like a header bar.
@@ -393,7 +393,7 @@ tabbed content that does not load until you click the tab.
393
393
  When your client receives the payload, you may issue a second request to the
394
394
  same endpoint to fetch any missing nodes. See [traversing nodes](#traversing)
395
395
 
396
- There is also an `defer: :auto` option that you can use with [BreezyJS][1]. [BreezyJS][1]
396
+ There is also an `defer: :auto` option that you can use with [SuperglueJS][1]. [SuperglueJS][1]
397
397
  will use the metadata from `json.deferred!` to issue a `remote` dispatch to fetch
398
398
  the missing node and immutably graft it at the appropriate keypath in your Redux
399
399
  store.
@@ -417,7 +417,7 @@ end
417
417
 
418
418
  A auto option is available:
419
419
 
420
- **Note** This is a [BreezyJS][1] specific functionality.
420
+ **Note** This is a [SuperglueJS][1] specific functionality.
421
421
 
422
422
  ```ruby
423
423
  json.dashboard(defer: :auto) do
@@ -436,14 +436,14 @@ json.defers json.deferred!
436
436
  The default behavior for deferements is to use the index of the collection to
437
437
  identify an element.
438
438
 
439
- **Note** If you are using this library with [BreezyJS][1], the `:auto` options will
439
+ **Note** If you are using this library with [SuperglueJS][1], the `:auto` options will
440
440
  generate `?props_at=a.b.c.0.title` for `json.deferred!`.
441
441
 
442
442
  If you wish to use an attribute to identify the element. You must:
443
443
 
444
444
  1. Use the `:key` option on `json.array!`. This key refers to an attribute on
445
445
  your collection item, and is used for `defer: :auto` to generate a keypath for
446
- [BreezyJS][1]. If you are NOT using BreezyJS, you do not need to do this.
446
+ [SuperglueJS][1]. If you are NOT using SuperglueJS, you do not need to do this.
447
447
 
448
448
  2. Implement `member_at`, on the [collection](#jsonarray). This will be called
449
449
  by PropsTemplate to when [searching nodes](#traversing)
@@ -469,7 +469,7 @@ json.posts
469
469
  end
470
470
  ```
471
471
 
472
- If you are using [BreezyJS][1], BreezyJS will, it will automatically kick off
472
+ If you are using [SuperglueJS][1], SuperglueJS will, it will automatically kick off
473
473
  `remote(?props_at=posts.some_id=1.contact)` and `remote(?props_at=posts.some_id=2.contact)`.
474
474
 
475
475
  ## Traversing
@@ -596,4 +596,4 @@ See the [CONTRIBUTING] document. Thank you, [contributors]!
596
596
  Thanks to [turbostreamer](https://github.com/malomalo/turbostreamer) for the
597
597
  inspiration.
598
598
 
599
- [1]: https://github.com/thoughtbot/breezy
599
+ [1]: https://github.com/thoughtbot/superglue
@@ -1,11 +1,3 @@
1
- require 'props_template/base'
2
- require 'props_template/extensions/partial_renderer'
3
- require 'props_template/extensions/cache'
4
- require 'props_template/extensions/deferment'
5
- require 'props_template/extension_manager'
6
- require 'active_support/core_ext/string/output_safety'
7
- require 'active_support/core_ext/array'
8
-
9
1
  module Props
10
2
  class BaseWithExtensions < Base
11
3
  attr_reader :builder, :context, :fragments, :traveled_path, :deferred, :stream
@@ -28,6 +20,10 @@ module Props
28
20
  @em.fragments
29
21
  end
30
22
 
23
+ def traveled_path!
24
+ @traveled_path.join(".")
25
+ end
26
+
31
27
  def set_block_content!(options = {})
32
28
  return super if !@em.has_extensions(options)
33
29
 
@@ -1,8 +1,3 @@
1
- require 'props_template/extensions/partial_renderer'
2
- require 'props_template/extensions/cache'
3
- require 'props_template/extensions/deferment'
4
- require 'props_template/extensions/fragment'
5
-
6
1
  module Props
7
2
  class ExtensionManager
8
3
  attr_reader :base, :builder, :context
@@ -17,14 +17,12 @@ module Props
17
17
 
18
18
  class Partialer
19
19
  INVALID_PARTIAL_MESSAGE = "The partial name must be a string, but received (%s)."
20
- OPTION_AS_ERROR_MESSAGE = "The value (%s) of the option `as` is not a valid Ruby identifier; " \
20
+ OPTION_AS_ERROR_MESSAGE = "The value (%s) of the option `as` is not a valid Ruby identifier; " \
21
21
  "make sure it starts with lowercase letter, " \
22
22
  "and is followed by any combination of letters, numbers and underscores."
23
23
  IDENTIFIER_ERROR_MESSAGE = "The partial name (%s) is not a valid Ruby identifier; " \
24
24
  "make sure your partial name starts with underscore."
25
25
 
26
- INVALID_PARTIAL_MESSAGE = "The partial name must be a string, but received (%s)."
27
-
28
26
 
29
27
  def initialize(base, context, builder)
30
28
  @context = context
@@ -1,5 +1,3 @@
1
- require 'props_template/extensions/partial_renderer'
2
-
3
1
  module Props
4
2
  class Searcher
5
3
  attr_reader :builder, :context, :fragments, :traveled_path
@@ -1,3 +1,3 @@
1
1
  module Props
2
- VERSION = "0.21.1".freeze
2
+ VERSION = "0.22.0".freeze
3
3
  end
@@ -1,4 +1,12 @@
1
+ require 'props_template/base'
2
+ require 'props_template/extensions/partial_renderer'
3
+ require 'props_template/extensions/cache'
4
+ require 'props_template/extensions/deferment'
5
+ require 'props_template/extensions/fragment'
1
6
  require 'props_template/base_with_extensions'
7
+ require 'props_template/extension_manager'
8
+ require 'active_support/core_ext/string/output_safety'
9
+ require 'active_support/core_ext/array'
2
10
  require 'props_template/searcher'
3
11
  require 'props_template/handler'
4
12
  require 'props_template/version'
@@ -17,6 +25,7 @@ module Props
17
25
  :deferred!,
18
26
  :fragments!,
19
27
  :set_block_content!,
28
+ :traveled_path!,
20
29
  to: :builder!
21
30
 
22
31
  def initialize(context = nil, options = {})
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.21.1
4
+ version: 0.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johny Ho
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-06 00:00:00.000000000 Z
11
+ date: 2022-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport