bulma-phlex 0.4.0 → 0.5.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 +4 -4
- data/README.md +115 -10
- data/lib/bulma-phlex.rb +3 -1
- data/lib/bulma_phlex/rails/card_helper.rb +34 -0
- data/lib/bulma_phlex/rails/table_helper.rb +24 -0
- data/lib/bulma_phlex/railtie.rb +20 -0
- data/lib/bulma_phlex/version.rb +1 -1
- data/lib/components/bulma/card.rb +6 -19
- data/lib/components/bulma/dropdown.rb +1 -1
- data/lib/components/bulma/level.rb +1 -1
- data/lib/components/bulma/navigation_bar.rb +2 -2
- data/lib/components/bulma/navigation_bar_dropdown.rb +1 -1
- data/lib/components/bulma/pagination.rb +1 -1
- data/lib/components/bulma/table.rb +40 -4
- data/lib/components/bulma/tabs.rb +1 -1
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b94a61e80c3da2fb0b776323e40e381322aab22eb9e6fa9493d495d21df8f30
|
4
|
+
data.tar.gz: 8650e8b839631a6e642eb0e04ca33178f67006cdb848144d33f1e32359242653
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7dfa409bfa0380dfa15ca8a2d2e0a58b904fb3e75415a497c15e0276f7422a4e5425044421b99545a3decfedaa7dc8f76b342a2addcb56020165aca309671d6
|
7
|
+
data.tar.gz: 7096d053b2c05c2da6ec7306bc4b4fe469d2e8ce4ab5fbf924b756c0b4962831e496e6d2c03ea3ea8ce6f5b46f5ce67cc950a8575fbda17a53537435eb208ceb
|
data/README.md
CHANGED
@@ -6,6 +6,22 @@
|
|
6
6
|
|
7
7
|
This gem provides a set of ready-to-use [Phlex](https://github.com/phlex-ruby/phlex) components for common [Bulma](https://bulma.io/) components and elements, making it easy to build beautiful, responsive interfaces with a clean, Ruby-focused API.
|
8
8
|
|
9
|
+
## Table of Contents
|
10
|
+
|
11
|
+
- [Installation](#installation)
|
12
|
+
- [Usage](#usage)
|
13
|
+
- [Card](#card)
|
14
|
+
- [Dropdown](#dropdown)
|
15
|
+
- [Level](#level)
|
16
|
+
- [NavigationBar](#navigationbar)
|
17
|
+
- [Pagination](#pagination)
|
18
|
+
- [Table](#table)
|
19
|
+
- [Tabs](#tabs)
|
20
|
+
- [Development](#development)
|
21
|
+
- [Contributing](#contributing)
|
22
|
+
- [License](#license)
|
23
|
+
- [Credits](#credits)
|
24
|
+
|
9
25
|
## Installation
|
10
26
|
|
11
27
|
Add this line to your application's Gemfile:
|
@@ -54,7 +70,7 @@ Use the Phlex components in your Rails views or any Ruby application that suppor
|
|
54
70
|
[Cards](https://bulma.io/documentation/components/card/) are flexible containers that can display various types of content including headers and content sections.
|
55
71
|
|
56
72
|
```ruby
|
57
|
-
|
73
|
+
Bulma::Card() do |card|
|
58
74
|
card.head("Card Title")
|
59
75
|
card.content do
|
60
76
|
"This is some card content"
|
@@ -62,12 +78,27 @@ render Components::Bulma::Card.new do |card|
|
|
62
78
|
end
|
63
79
|
```
|
64
80
|
|
81
|
+
#### Rails Feature: Turbo Frame Content
|
82
|
+
|
83
|
+
When the `turbo-rails` and `phlex-rails` gems are installed, the Card component also provides method `turbo_frame_content`, which allows the content to be deferred to a turbo frame. The method accepts the same parameters as [the Turbo Rails helper method `turbo_frame_tag`](https://github.com/hotwired/turbo-rails?tab=readme-ov-file#decompose-with-turbo-frames), with the addition of the following two attributes:
|
84
|
+
|
85
|
+
- pending_message (default: "Loading...")
|
86
|
+
- pending_icon (default: "fas fa-spinner fa-pulse")
|
87
|
+
|
88
|
+
```ruby
|
89
|
+
Bulma::Card() do |card|
|
90
|
+
card.head("Product Info")
|
91
|
+
card.turbo_frame_content("product", src: product_path(@product), pending_message: "Loading product...")
|
92
|
+
end
|
93
|
+
```
|
94
|
+
|
95
|
+
|
65
96
|
### Dropdown
|
66
97
|
|
67
98
|
The [Dropdown](https://bulma.io/documentation/components/dropdown/) component provides a flexible dropdown menu for navigation or actions. It supports both click-to-toggle (default, requires a Stimulus controller) and hoverable modes, as well as alignment and icon customization.
|
68
99
|
|
69
100
|
```ruby
|
70
|
-
|
101
|
+
Bulma::Dropdown("Next Actions...") do |dropdown|
|
71
102
|
dropdown.link "View Profile", "/profile"
|
72
103
|
dropdown.link "Go to Settings", "/settings"
|
73
104
|
dropdown.divider
|
@@ -96,7 +127,7 @@ end
|
|
96
127
|
The [Level](https://bulma.io/documentation/layout/level/) component provides a flexible horizontal layout system with left and right alignment.
|
97
128
|
|
98
129
|
```ruby
|
99
|
-
|
130
|
+
Bulma::Level() do |level|
|
100
131
|
level.left do
|
101
132
|
button(class: "button") { "Left" }
|
102
133
|
end
|
@@ -115,7 +146,7 @@ end
|
|
115
146
|
The [NavigationBar](https://bulma.io/documentation/components/navbar/) component provides a responsive navigation header with support for branding, navigation links, and dropdown menus.
|
116
147
|
|
117
148
|
```ruby
|
118
|
-
|
149
|
+
Bulma::NavigationBar() do |navbar|
|
119
150
|
navbar.brand_item "My App", "/"
|
120
151
|
|
121
152
|
navbar.left do |menu|
|
@@ -145,7 +176,7 @@ The [Pagination](https://bulma.io/documentation/components/pagination/) componen
|
|
145
176
|
@products = Product.page(params[:page]).per(20)
|
146
177
|
|
147
178
|
# In the view:
|
148
|
-
|
179
|
+
Bulma::Pagination(@products, ->(page) { products_path(page: page) })
|
149
180
|
```
|
150
181
|
|
151
182
|
### Table
|
@@ -155,14 +186,13 @@ The [Table](https://bulma.io/documentation/elements/table/) component provides a
|
|
155
186
|
```ruby
|
156
187
|
users = User.all
|
157
188
|
|
158
|
-
|
189
|
+
Bulma::Table(users, fullwidth: true, hoverable: true) do |table|
|
159
190
|
table.column "Name" do |user|
|
160
191
|
user.full_name
|
161
192
|
end
|
162
193
|
|
163
|
-
|
164
|
-
|
165
|
-
end
|
194
|
+
# use the symbol-to-proc shortcut!
|
195
|
+
table.column "Email", &:email
|
166
196
|
|
167
197
|
table.column "Actions" do |user|
|
168
198
|
link_to "Edit", edit_user_path(user), class: "button is-small"
|
@@ -170,6 +200,77 @@ render Components::Bulma::Table.new(users) do |table|
|
|
170
200
|
end
|
171
201
|
```
|
172
202
|
|
203
|
+
**Constructor Keyword Arguments:**
|
204
|
+
|
205
|
+
- `rows`: the data for the table as an enumerable (anything that responds to `each`)
|
206
|
+
- `id`: the Id for the table element (defaults to "table")
|
207
|
+
- `bordered`: adds the `is-bordered` class (boolean, defaults to false)
|
208
|
+
- `striped`: adds the `is-striped` class (boolean, defaults to false)
|
209
|
+
- `narrow`: adds the `is-narrow` class (boolean, defaults to false)
|
210
|
+
- `hoverable`: adds the `is-hoverable` class (boolean, defaults to false)
|
211
|
+
- `fullwidth`: adds the `is-fullwidth` class (boolean, defaults to false)
|
212
|
+
|
213
|
+
**Arguments for `column` Method:**
|
214
|
+
|
215
|
+
The `column` method takes the column name and any html attributes to be assigned to the table cell element. The block will be called with the row as the parameter.
|
216
|
+
|
217
|
+
#### Additional Column Types
|
218
|
+
|
219
|
+
Instead of calling `column`, you can also invoke the following methods to add amount, date, and icon columns:
|
220
|
+
|
221
|
+
**Arguments for `amount_column` (Rails only):**
|
222
|
+
|
223
|
+
- name: content for the `th` element
|
224
|
+
- `currency` (keyword): options that will be passed to [Rails helper number_to_currency](https://api.rubyonrails.org/classes/ActiveSupport/NumberHelper.html#method-i-number_to_currency, uses Rails defaults)
|
225
|
+
|
226
|
+
```ruby
|
227
|
+
table.amount_column("Payment Amount") { |row| row.payment_amount }
|
228
|
+
table.amount_column("Total", currency: { unit: "€" }, class: "is-bold", &:total)
|
229
|
+
```
|
230
|
+
|
231
|
+
**Arguments for `date_column`:**
|
232
|
+
|
233
|
+
- name: content for the `th` element
|
234
|
+
- `format` (keyword): the formatting options (will be passed to `strftime`, defaults to "%Y-%m-%d")
|
235
|
+
|
236
|
+
```ruby
|
237
|
+
table.date_column("Due Date", format: "%B %d, %Y") { |row| row.due_date }
|
238
|
+
```
|
239
|
+
|
240
|
+
**Arguments for `conditional_icon`:**
|
241
|
+
|
242
|
+
The icon column is intended to show a boolean flag: a yes / no or an on / off. When the value is true the icon shows and when the value is false it does not.
|
243
|
+
|
244
|
+
- name: content for the `th` element
|
245
|
+
- `icon_class` (keyword): the icon to show (defaults to the Font Awesome check mark: "fas fa-check")
|
246
|
+
|
247
|
+
```ruby
|
248
|
+
table.conditional_icon("Completed?", &:complete)
|
249
|
+
table.conditional_icon("Approved?", icon_class: "fas fa-thumbs-up") { |row| row.status == "Approved" }
|
250
|
+
```
|
251
|
+
|
252
|
+
#### Pagination
|
253
|
+
|
254
|
+
If the table should be paginated, invoke method `paginate` with a block that will return a path given a page number.
|
255
|
+
|
256
|
+
```ruby
|
257
|
+
table.paginate do |page_number|
|
258
|
+
products_path(page: { number: page_number })
|
259
|
+
end
|
260
|
+
```
|
261
|
+
|
262
|
+
In order to support pagination, the `rows` argument passed into the constructor must repond with integers to the following:
|
263
|
+
|
264
|
+
- current_page
|
265
|
+
- total_pages
|
266
|
+
- per_page
|
267
|
+
- total_count
|
268
|
+
- previous_page (can be nil)
|
269
|
+
- next_page (can be nil)
|
270
|
+
|
271
|
+
This generates the [Bulma pagination](https://bulma.io/documentation/components/pagination/) component, providing navigation controls for paginated content.
|
272
|
+
|
273
|
+
|
173
274
|
### Tabs
|
174
275
|
|
175
276
|
The [Tabs](https://bulma.io/documentation/components/tabs/) component provides a way to toggle between different content sections using tabbed navigation, with support for icons and active state management.
|
@@ -177,7 +278,7 @@ The [Tabs](https://bulma.io/documentation/components/tabs/) component provides a
|
|
177
278
|
Behavior of the tabs can be driven by the data attributes, which are assigned by the object passed in as the `data_attributes_builder`. By default, this will use the `StimulusDataAttributes` class with the controller name `bulma--tabs`. The controller is not provided by this library, but you can create your own Stimulus controller to handle the tab switching logic. Here is [an implementation of a Stimulus controller for Bulma tabs](https://github.com/RockSolt/bulma-rails-helpers/blob/main/app/javascript/controllers/bulma/tabs_controller.js).
|
178
279
|
|
179
280
|
```ruby
|
180
|
-
|
281
|
+
Bulma::Tabs(tabs_class: "is-boxed", contents_class: "ml-4") do |tabs|
|
181
282
|
tabs.tab(id: "profile", title: "Profile", active: true) do
|
182
283
|
"Profile content goes here"
|
183
284
|
end
|
@@ -219,3 +320,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/RockSo
|
|
219
320
|
## License
|
220
321
|
|
221
322
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
323
|
+
|
324
|
+
## Credits
|
325
|
+
|
326
|
+
This leverages the [Bulma CSS library](https://bulma.io/documentation/) and [Phlex](https://www.phlex.fun/) but is not endorsed or certified by either. We are fans of the both and this makes using them together easier.
|
data/lib/bulma-phlex.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "phlex"
|
4
3
|
require "bulma_phlex/version"
|
4
|
+
require "phlex"
|
5
5
|
|
6
6
|
require "components/bulma"
|
7
7
|
require "components/bulma/base"
|
@@ -15,3 +15,5 @@ require "components/bulma/table"
|
|
15
15
|
require "components/bulma/tabs"
|
16
16
|
require "components/bulma/tab_components/content"
|
17
17
|
require "components/bulma/tab_components/tab"
|
18
|
+
|
19
|
+
require "bulma_phlex/railtie" if defined?(Rails::Railtie)
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BulmaPhlex
|
4
|
+
module Rails
|
5
|
+
# # Card Helper
|
6
|
+
#
|
7
|
+
# This module provides method `turbo_frame_content` to create a card with a turbo frame as its content.
|
8
|
+
module CardHelper
|
9
|
+
extend ActiveSupport::Concern
|
10
|
+
|
11
|
+
included do
|
12
|
+
include Phlex::Rails::Helpers::TurboFrameTag
|
13
|
+
end
|
14
|
+
|
15
|
+
# Renders a Bulma-styled card with a Turbo Frame as its content. This uses the same signatures as
|
16
|
+
# `turbo_frame_tag`, with the addition of two optional attributes: `pending_message` and `pending_icon`.
|
17
|
+
#
|
18
|
+
# The two pending attributes have the following defaults:
|
19
|
+
# - pending_message: "Loading..."
|
20
|
+
# - pending_icon: "fas fa-spinner fa-pulse"
|
21
|
+
def turbo_frame_content(*ids, src: nil, target: nil, **attributes)
|
22
|
+
pending_message = attributes.delete(:pending_message) || "Loading..."
|
23
|
+
pending_icon = attributes.delete(:pending_icon) || "fas fa-spinner fa-pulse"
|
24
|
+
|
25
|
+
content do
|
26
|
+
turbo_frame_tag ids, src: src, target: target, **attributes do
|
27
|
+
span(class: "icon") { i class: pending_icon }
|
28
|
+
span { plain pending_message }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BulmaPhlex
|
4
|
+
module Rails
|
5
|
+
# # Table Helper
|
6
|
+
#
|
7
|
+
# This module provides method `amount_column` to create an amount column in a table.
|
8
|
+
module TableHelper
|
9
|
+
extend ActiveSupport::Concern
|
10
|
+
|
11
|
+
included do
|
12
|
+
include Phlex::Rails::Helpers::NumberToCurrency
|
13
|
+
end
|
14
|
+
|
15
|
+
def amount_column(header, currency: {}, **html_attributes, &content)
|
16
|
+
html_attributes[:class] = [html_attributes[:class], "has-text-right"].compact.join(" ")
|
17
|
+
|
18
|
+
column(header, **html_attributes) do |row|
|
19
|
+
number_to_currency(content.call(row), **currency)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bulma_phlex/rails/card_helper"
|
4
|
+
require "bulma_phlex/rails/table_helper"
|
5
|
+
|
6
|
+
module BulmaPhlex
|
7
|
+
# # Railtie for BulmaPhlex
|
8
|
+
#
|
9
|
+
# This Railtie adds Rails-specific features to the BulmaPhlex library.
|
10
|
+
class Railtie < ::Rails::Railtie
|
11
|
+
initializer "bulma_phlex" do
|
12
|
+
ActiveSupport.on_load(:action_view) do
|
13
|
+
if defined?(Phlex::Rails)
|
14
|
+
Components::Bulma::Card.include(BulmaPhlex::Rails::CardHelper) if defined?(Turbo)
|
15
|
+
Components::Bulma::Table.include(BulmaPhlex::Rails::TableHelper)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/bulma_phlex/version.rb
CHANGED
@@ -11,7 +11,7 @@ module Components
|
|
11
11
|
# ## Example
|
12
12
|
#
|
13
13
|
# ```ruby
|
14
|
-
#
|
14
|
+
# Bulma::Card() do |card|
|
15
15
|
# card.head("Card Title")
|
16
16
|
# card.content do
|
17
17
|
# "This is some card content"
|
@@ -19,6 +19,11 @@ module Components
|
|
19
19
|
# end
|
20
20
|
# ```
|
21
21
|
#
|
22
|
+
# ## Rails Feature: Turbo Frame Content
|
23
|
+
#
|
24
|
+
# If the project includes Rails and the Phlex::Rails gem, the `BulmaPhlex::Rails::CardHelper` module
|
25
|
+
# provides a `turbo_frame_content` method to create a card with a turbo frame
|
26
|
+
# as its content. This allows for dynamic loading of card content.
|
22
27
|
class Card < Components::Bulma::Base
|
23
28
|
def view_template(&)
|
24
29
|
div(class: "card", &)
|
@@ -35,24 +40,6 @@ module Components
|
|
35
40
|
div(class: "content", &)
|
36
41
|
end
|
37
42
|
end
|
38
|
-
|
39
|
-
if defined?(Phlex::Rails)
|
40
|
-
include Phlex::Rails::Helpers::TurboFrameTag
|
41
|
-
|
42
|
-
# this copies the signature of the turbo_frame_tag helper,
|
43
|
-
# with the addition of a pending_message attribute
|
44
|
-
def turbo_frame_content(*ids, src: nil, target: nil, **attributes)
|
45
|
-
pending_message = attributes.delete(:pending_message) || "Loading..."
|
46
|
-
pending_icon = attributes.delete(:pending_icon) || "fas fa-spinner fa-pulse"
|
47
|
-
|
48
|
-
content do
|
49
|
-
turbo_frame_tag ids, src: src, target: target, **attributes do
|
50
|
-
span(class: "icon") { i class: pending_icon }
|
51
|
-
span { plain pending_message }
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
43
|
end
|
57
44
|
end
|
58
45
|
end
|
@@ -25,7 +25,7 @@ module Components
|
|
25
25
|
# ## Example
|
26
26
|
#
|
27
27
|
# ```ruby
|
28
|
-
#
|
28
|
+
# Bulma::Dropdown("Next Actions...") do |dropdown|
|
29
29
|
# dropdown.link "View Profile", "/profile"
|
30
30
|
# dropdown.link "Go to Settings", "/settings"
|
31
31
|
# dropdown.divider
|
@@ -11,7 +11,7 @@ module Components
|
|
11
11
|
# ## Example
|
12
12
|
#
|
13
13
|
# ```ruby
|
14
|
-
#
|
14
|
+
# Bulma::NavigationBar() do |navbar|
|
15
15
|
# navbar.brand do
|
16
16
|
# a(href: "/", class: "navbar-item") { "My App" }
|
17
17
|
# end
|
@@ -26,7 +26,7 @@ module Components
|
|
26
26
|
#
|
27
27
|
# div(class: "navbar-item has-dropdown is-hoverable") do
|
28
28
|
# a(class: "navbar-link") { "Account" }
|
29
|
-
#
|
29
|
+
# Bulma::NavigationBarDropdown() do |dropdown|
|
30
30
|
# dropdown.item "Sign In", "/login"
|
31
31
|
# dropdown.item "Register", "/register"
|
32
32
|
# end
|
@@ -19,7 +19,7 @@ module Components
|
|
19
19
|
# @products = Product.page(params[:page]).per(20)
|
20
20
|
#
|
21
21
|
# # In the view:
|
22
|
-
#
|
22
|
+
# Bulma::Pagination(@products, ->(page) { products_path(page: page) })
|
23
23
|
# ```
|
24
24
|
#
|
25
25
|
class Pagination < Components::Bulma::Base
|
@@ -13,7 +13,7 @@ module Components
|
|
13
13
|
# ```ruby
|
14
14
|
# users = User.all
|
15
15
|
#
|
16
|
-
#
|
16
|
+
# Bulma::Table(users) do |table|
|
17
17
|
# table.column "Name" do |user|
|
18
18
|
# user.full_name
|
19
19
|
# end
|
@@ -29,16 +29,16 @@ module Components
|
|
29
29
|
# ```
|
30
30
|
#
|
31
31
|
class Table < Components::Bulma::Base
|
32
|
-
def initialize(rows,
|
33
|
-
@id = id || id_from_array_or_arel(rows)
|
32
|
+
def initialize(rows, id_or_options = nil, **options)
|
34
33
|
@rows = rows
|
34
|
+
@id, @table_class = parse_id_and_options(id_or_options, options, rows)
|
35
35
|
@columns = []
|
36
36
|
end
|
37
37
|
|
38
38
|
def view_template(&)
|
39
39
|
vanish(&)
|
40
40
|
|
41
|
-
table(id: @id, class:
|
41
|
+
table(id: @id, class: @table_class) do
|
42
42
|
thead do
|
43
43
|
@columns.each do |column|
|
44
44
|
table_header(column)
|
@@ -63,12 +63,38 @@ module Components
|
|
63
63
|
@columns << { header:, html_attributes:, content: }
|
64
64
|
end
|
65
65
|
|
66
|
+
def date_column(header, format: "%Y-%m-%d", **html_attributes, &content)
|
67
|
+
column(header, **html_attributes) do |row|
|
68
|
+
content.call(row)&.strftime(format)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def conditional_icon(header, icon_class: "fas fa-check", **html_attributes, &content)
|
73
|
+
html_attributes[:class] = [html_attributes[:class], "has-text-centered"].compact.join(" ")
|
74
|
+
|
75
|
+
column(header, **html_attributes) do |row|
|
76
|
+
icon_span(icon_class) if content.call(row)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
66
80
|
def paginate(&path_builder)
|
67
81
|
@path_builder = path_builder
|
68
82
|
end
|
69
83
|
|
70
84
|
private
|
71
85
|
|
86
|
+
def parse_id_and_options(id_or_options, options, rows)
|
87
|
+
if id_or_options.is_a?(String)
|
88
|
+
id = id_or_options
|
89
|
+
opts = options
|
90
|
+
else
|
91
|
+
opts = (id_or_options || {}).merge(options)
|
92
|
+
id = opts.delete(:id) || id_from_array_or_arel(rows)
|
93
|
+
end
|
94
|
+
table_class = "table #{parse_table_classes(opts)}"
|
95
|
+
[id, table_class]
|
96
|
+
end
|
97
|
+
|
72
98
|
def id_from_array_or_arel(rows)
|
73
99
|
if rows.respond_to? :model
|
74
100
|
rows.model.model_name.plural
|
@@ -77,6 +103,16 @@ module Components
|
|
77
103
|
else
|
78
104
|
rows.first.model_name.plural
|
79
105
|
end
|
106
|
+
rescue StandardError
|
107
|
+
"table"
|
108
|
+
end
|
109
|
+
|
110
|
+
def parse_table_classes(options)
|
111
|
+
options.slice(*%i[bordered striped narrow hoverable fullwidth])
|
112
|
+
.transform_keys { |key| "is-#{key}" }
|
113
|
+
.select { |_, value| value }
|
114
|
+
.keys
|
115
|
+
.join(" ")
|
80
116
|
end
|
81
117
|
|
82
118
|
# this derives a th class from the column html attributes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bulma-phlex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todd Kummer
|
@@ -90,6 +90,9 @@ files:
|
|
90
90
|
- README.md
|
91
91
|
- Rakefile
|
92
92
|
- lib/bulma-phlex.rb
|
93
|
+
- lib/bulma_phlex/rails/card_helper.rb
|
94
|
+
- lib/bulma_phlex/rails/table_helper.rb
|
95
|
+
- lib/bulma_phlex/railtie.rb
|
93
96
|
- lib/bulma_phlex/version.rb
|
94
97
|
- lib/components/bulma.rb
|
95
98
|
- lib/components/bulma/base.rb
|