kombu 0.1.0 → 0.1.1

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: 555b72c094087f10c29ed89696f91d92ac68516aa256fb78b08a1ed7acf8c986
4
- data.tar.gz: 8c23db5a65333c5a6024b572a3f4c06e73151494006e7d0fd69d92cfa251cf87
3
+ metadata.gz: beffa2569dcdfb458ec9b1a98e74cf2fe4ef919a92124ef67bb93b6832f06e6f
4
+ data.tar.gz: 36d8b77da7d196fb6fb47805269d8d66e40cf48c0e7fe2ee0467219134594362
5
5
  SHA512:
6
- metadata.gz: 0f3575fd1fbe1d603eb952a2242f4eaffa60fa2b2e4491e3909e9cdca21ad5ea2d27f90d25619b95ad32195b3157fffe32c295cf0483e1cc2e0c4b5e35b46b05
7
- data.tar.gz: 5bc0893ee1a32b87e43f4c22a4a4c32beba1c0fb002eeca9d86348e4bcd08b6b73640c894e5835ddcdd41bc2962118ab215bffca58f7ea4ba3184123763388a3
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: `vue-root`)
21
- # config.kombu.default_mount_element_id = 'vue-root'
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
- @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 })
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="vue-root"><artile-index-page title="Articles" :articles="[{"id":1,"title":"artile1","body":"body1"},{"id":2,"title":"artile2","body":"body2"}]"></div>
60
- </artile-index-page>
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
- @title = 'Articles'
86
- @articles = [{ id: 1, title: 'artile1', body: 'body1' }, { id: 2, title: 'artile2', body: 'body2' }]
87
- render_component('article-index-page', attributes: { 'title': @title, ':articles': @articles.to_json })
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
@@ -5,7 +5,7 @@ require_relative "configration"
5
5
 
6
6
  module Kombu
7
7
  class Railtie < ::Rails::Railtie
8
- MOUNT_ELEMENT_ID = "vue-root"
8
+ MOUNT_ELEMENT_ID = "app"
9
9
  ENTRY_VIEW_TEMPLATE = <<~ERB
10
10
  <div id="<%= @kombu_mount_element_id %>">
11
11
  <%= kombu_component_tag %>
@@ -22,6 +22,7 @@ module Kombu
22
22
  end
23
23
 
24
24
  def kombu_component_tag
25
+ return "" if @kombu_component.nil?
25
26
  tag(@kombu_component, @kombu_attributes)
26
27
  end
27
28
 
@@ -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
- return failure_mount_element_id_message unless mount_element_id_match?
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
@@ -1,3 +1,3 @@
1
1
  module Kombu
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
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: 2023-06-25 00:00:00.000000000 Z
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.4.1
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