kombu 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -10
- data/lib/kombu/railtie.rb +1 -1
- data/lib/kombu/renderable.rb +1 -0
- data/lib/kombu/test/rspec/matchers/component_rendered_matcher.rb +1 -1
- data/lib/kombu/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: beffa2569dcdfb458ec9b1a98e74cf2fe4ef919a92124ef67bb93b6832f06e6f
|
4
|
+
data.tar.gz: 36d8b77da7d196fb6fb47805269d8d66e40cf48c0e7fe2ee0467219134594362
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41de058d8b887a84b8e792ace99a5b9b1bf7d7dfc5a0f0ed492fb5f409d52dba97b9ffc86b8dda3689f872d65e4f26db72f5e10c01b28e8b0c5c7f99a150aaa9
|
7
|
+
data.tar.gz: 44cf7506831721be91b666b12a4b297a37d6da88be20cb2c153cbdda2999a41527233344d7b7704681ddcceeb2b3c67f7b03100845e5111c58c73e8234134364
|
data/README.md
CHANGED
@@ -17,8 +17,8 @@ Please configure the following settings according to your application.
|
|
17
17
|
|
18
18
|
```ruby
|
19
19
|
Rails.application.configure do
|
20
|
-
# NOTE: (OPTIONAL) id of the element (div) to mount (default: `
|
21
|
-
# config.kombu.default_mount_element_id = '
|
20
|
+
# NOTE: (OPTIONAL) id of the element (div) to mount (default: `app`)
|
21
|
+
# config.kombu.default_mount_element_id = 'app'
|
22
22
|
|
23
23
|
# NOTE: (REQUIIRED) Specify a proc that generates a tag that reads a javascript entry.
|
24
24
|
# See `lib/kombu/renderable.rb` for instance variables provided by kombu that can be used within proc.
|
@@ -52,12 +52,28 @@ class ArticlesController < ApplicationController
|
|
52
52
|
include Kombu::Renderable
|
53
53
|
|
54
54
|
def index
|
55
|
-
|
56
|
-
|
57
|
-
kombu_render_component('article-index-page', attributes: { 'title':
|
55
|
+
title = 'Articles'
|
56
|
+
articles = [{ id: 1, title: 'artile1', body: 'body1' }, { id: 2, title: 'artile2', body: 'body2' }]
|
57
|
+
kombu_render_component('article-index-page', attributes: { 'title': title, ':articles': articles.to_json })
|
58
58
|
# NOTE: The following html is rendered.
|
59
|
-
# <div id="
|
60
|
-
|
59
|
+
# <div id="app"><artile-index-page title="Articles" :articles="[{"id":1,"title":"artile1","body":"body1"},{"id":2,"title":"artile2","body":"body2"}]"></artile-index-page></div>
|
60
|
+
end
|
61
|
+
end
|
62
|
+
```
|
63
|
+
|
64
|
+
You can also use the input hidden as shown below to pass the initial data json without using component.(ex. React)
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
class ArticlesController < ApplicationController
|
68
|
+
include Kombu::Renderable
|
69
|
+
|
70
|
+
def index
|
71
|
+
title = 'Articles'
|
72
|
+
articles = [{ id: 1, title: 'artile1', body: 'body1' }, { id: 2, title: 'artile2', body: 'body2' }]
|
73
|
+
initial_value = { title: title, articles: articles }
|
74
|
+
kombu_render_component('input', attributes: { 'type': 'hidden', 'id': 'initial-data', 'value': initial_value.to_json })
|
75
|
+
# NOTE: The following html is rendered.
|
76
|
+
# <div id="app"><input type="hidden" value='{"title":"Articles","articles":[{"id":1,"title":"artile1","body":"body1"},{"id":2,"title":"artile2","body":"body2"}]}' /></div>
|
61
77
|
end
|
62
78
|
end
|
63
79
|
```
|
@@ -82,9 +98,9 @@ class ArticlesController < ApplicationController
|
|
82
98
|
include ComponentRenderable
|
83
99
|
|
84
100
|
def index
|
85
|
-
|
86
|
-
|
87
|
-
render_component('article-index-page', attributes: { 'title':
|
101
|
+
title = 'Articles'
|
102
|
+
articles = [{ id: 1, title: 'artile1', body: 'body1' }, { id: 2, title: 'artile2', body: 'body2' }]
|
103
|
+
render_component('article-index-page', attributes: { 'title': title, ':articles': articles.to_json })
|
88
104
|
end
|
89
105
|
end
|
90
106
|
```
|
data/lib/kombu/railtie.rb
CHANGED
data/lib/kombu/renderable.rb
CHANGED
@@ -25,7 +25,7 @@ module Kombu
|
|
25
25
|
return failure_component_message unless component_match?
|
26
26
|
return failure_attributes_message unless attributes_match?
|
27
27
|
return failure_entry_message unless entry_match?
|
28
|
-
|
28
|
+
failure_mount_element_id_message unless mount_element_id_match?
|
29
29
|
end
|
30
30
|
|
31
31
|
private
|
data/lib/kombu/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kombu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- madogiwa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: '0'
|
64
64
|
requirements: []
|
65
|
-
rubygems_version: 3.
|
65
|
+
rubygems_version: 3.5.9
|
66
66
|
signing_key:
|
67
67
|
specification_version: 4
|
68
68
|
summary: Kombu provides the ability to render the specified component directly from
|