bs5_expandable_list_group 0.3.1 → 0.4.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: 30a9741e2db343705798e530a281b129e13ee85b96a182c74fd7c8de396aca58
4
- data.tar.gz: d50e37ebe410d65accbe6628a266ea8e5ee09d1ab631be64ae63d589272ba891
3
+ metadata.gz: fb85128dd2e5cbcfadab803722f3641dc1f899d48f7648967790c4c07167e53e
4
+ data.tar.gz: 7e35116c8fd0739e75387b65d99b071d68b4b99de79df9aeb2b538e37a94e9e9
5
5
  SHA512:
6
- metadata.gz: a86b30b077436c266a577acff80896d4ae2eba25184a2e70657737b38d00e75a0ed25b582ed68c99ef620ae59c0c716f8b74353763c73451deedcfd15c57f15c
7
- data.tar.gz: 2b420bd071decfe498f2ae564367250e1d5fb639bfeaa5a9b1dce40cc5abd2e682ad84f39887eda8c539f30281e841a84a1ee134a462ed001d08956267e5f8e0
6
+ metadata.gz: 2020c90cf7b667d478018ed5d508b58167f28303f82bb79e9fb36010499e1e54e5e1bed16c13ce9408b7813363baad4a46322b250d232be895166e0c26eb41e8
7
+ data.tar.gz: 0b380cdc5f32d767177cb16e2bd72b7df0088f41b23eb706591654d37dfd96bd8c035b11a4ea2f6175bc0c04238d4140521d6dd8f42815027a9b37fdd3856351
data/README.md CHANGED
@@ -10,7 +10,7 @@ https://user-images.githubusercontent.com/7672/120296188-27170580-c2c8-11eb-936a
10
10
  ## TL;DR
11
11
 
12
12
  ```erb
13
- <%= render(Bs5::ExpandableListGroupComponent.new) do |c| %>
13
+ <%= bs5_expandable_list_group do |c| %>
14
14
  <% @posts.each do |post| %>
15
15
  <% c.item do |i| %>
16
16
  <%= i.title { post.title } %>
@@ -71,7 +71,7 @@ To render a **Bootstrap 5 expandable list group** you use `render(Bs5::Expandabl
71
71
  Given that you have assigned a list of `Post` instances to `@posts`, to render these `@posts` in a **Bootstrap 5 expandable list group**, you put the following code in your template:
72
72
 
73
73
  ```erb
74
- <%= render(Bs5::ExpandableListGroupComponent.new) do |c| %>
74
+ <%= bs5_expandable_list_group do |c| %>
75
75
  <% @posts.each do |post| %>
76
76
  <% c.item do |i| %>
77
77
  <%= i.title { post.title } %>
@@ -166,7 +166,7 @@ Instead of using the `item`'s methods `title`, `body` and/or `actions` you can j
166
166
  This will render just a [list group item](https://getbootstrap.com/docs/5.0/components/list-group/#basic-example), but will come in handy when you, i.e. show the first 25 items of a longer list and want to present a "Load more" link as last item of the list (for simplicity sake the sample uses a non-working `link_to_next_page` although this is [part of Kaminari](https://github.com/kaminari/kaminari#the-link_to_next_page-and-link_to_previous_page-aliased-to-link_to_prev_page-helper-methods)):
167
167
 
168
168
  ```erb
169
- <%= render(Bs5::ExpandableListGroupComponent.new) do |c| %>
169
+ <%= bs5_expandable_list_group do |c| %>
170
170
  <% @posts.each do |post| %>
171
171
  <% c.item do |i| %>
172
172
  <%= i.title { post.title } %>
@@ -218,7 +218,7 @@ The following options can be passed to `Bs5::ExpandableListGroupComponent.new`:
218
218
  Example:
219
219
 
220
220
  ```erb
221
- <%= render(Bs5::ExpandableListGroupComponent.new(accordion: true, expandable: true) do |c| %>
221
+ <%= bs5_expandable_list_group(accordion: true, expandable: true) do |c| %>
222
222
  ...
223
223
  <% end %>
224
224
  ```
@@ -0,0 +1,9 @@
1
+ module Bs5ExpandableListGroup
2
+ module ViewComponentsHelper
3
+ def bs5_expandable_list_group(*args)
4
+ render ::Bs5::ExpandableListGroupComponent.new(*args) do |c|
5
+ yield c if block_given?
6
+ end
7
+ end
8
+ end
9
+ end
@@ -2,6 +2,11 @@ module Bs5ExpandableListGroup
2
2
  class Engine < ::Rails::Engine
3
3
  isolate_namespace Bs5ExpandableListGroup
4
4
 
5
+ # We don't want the developer to add the helper so we 'automate' this:
6
+ config.to_prepare do
7
+ ActionController::Base.helper(ViewComponentsHelper)
8
+ end
9
+
5
10
  config.generators do |g|
6
11
  g.test_framework :rspec
7
12
  g.assets false
@@ -1,3 +1,3 @@
1
1
  module Bs5ExpandableListGroup
2
- VERSION = '0.3.1'
2
+ VERSION = '0.4.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bs5_expandable_list_group
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Baselier
@@ -110,6 +110,7 @@ files:
110
110
  - app/components/bs5/expandable_list_item_header_title_component.rb
111
111
  - app/controllers/bs5_expandable_list_group/application_controller.rb
112
112
  - app/helpers/bs5_expandable_list_group/application_helper.rb
113
+ - app/helpers/bs5_expandable_list_group/view_components_helper.rb
113
114
  - app/jobs/bs5_expandable_list_group/application_job.rb
114
115
  - app/mailers/bs5_expandable_list_group/application_mailer.rb
115
116
  - app/models/bs5_expandable_list_group/application_record.rb