mensa 0.3.3 → 0.3.4
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/Gemfile.lock +5 -5
- data/README.md +10 -1
- data/app/components/mensa/row_action/component.html.erb +3 -2
- data/app/tables/mensa/action.rb +8 -1
- data/lib/generators/mensa/table_generator.rb +1 -1
- data/lib/mensa/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 194b34ee31bebddc3962cc66e5c789e5369f828eb6087f67f72b54aba97f65d8
|
|
4
|
+
data.tar.gz: 1ead92c4d986f5e69c3d5745fcee27541f8205bf0106bd25f757b7603cdc117f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f5c078859d1c6214b8b65ab36fd077a2c36e2f5b50a69efd0dc20621d6373977be10ed543bc68add8b81338b4322903c3c305a15a0bd47c8ea906d77953c2a9d
|
|
7
|
+
data.tar.gz: 6e68ccdd3ffea1ef460876f61a9d624a8d7de198addad7c712bfac67eac1cc08fbe0874221ba76f241ce5d47c8dec0b09c7950f058865ee232ca540868bea95d
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
mensa (0.3.
|
|
4
|
+
mensa (0.3.3)
|
|
5
5
|
csv
|
|
6
6
|
importmap-rails
|
|
7
7
|
pagy (>= 43)
|
|
@@ -152,7 +152,7 @@ GEM
|
|
|
152
152
|
minitest (6.0.6)
|
|
153
153
|
drb (~> 2.0)
|
|
154
154
|
prism (~> 1.5)
|
|
155
|
-
net-imap (0.6.4)
|
|
155
|
+
net-imap (0.6.4.1)
|
|
156
156
|
date
|
|
157
157
|
net-protocol
|
|
158
158
|
net-pop (0.1.2)
|
|
@@ -183,7 +183,7 @@ GEM
|
|
|
183
183
|
overmind (2.5.1-arm-linux)
|
|
184
184
|
overmind (2.5.1-arm64-darwin)
|
|
185
185
|
overmind (2.5.1-x86_64-darwin)
|
|
186
|
-
pagy (43.5.
|
|
186
|
+
pagy (43.5.6)
|
|
187
187
|
json
|
|
188
188
|
uri
|
|
189
189
|
yaml
|
|
@@ -352,12 +352,12 @@ GEM
|
|
|
352
352
|
unicode-emoji (4.2.0)
|
|
353
353
|
uri (1.1.1)
|
|
354
354
|
useragent (0.16.11)
|
|
355
|
-
view_component (3.
|
|
355
|
+
view_component (3.25.0)
|
|
356
356
|
activesupport (>= 5.2.0, < 8.2)
|
|
357
357
|
concurrent-ruby (~> 1)
|
|
358
358
|
method_source (~> 1.0)
|
|
359
359
|
websocket (1.2.11)
|
|
360
|
-
websocket-driver (0.8.
|
|
360
|
+
websocket-driver (0.8.1)
|
|
361
361
|
base64
|
|
362
362
|
websocket-extensions (>= 0.1.0)
|
|
363
363
|
websocket-extensions (0.1.5)
|
data/README.md
CHANGED
|
@@ -65,6 +65,8 @@ class UserTable < ApplicationTable
|
|
|
65
65
|
title "Delete row"
|
|
66
66
|
link { |user| user_path(user) }
|
|
67
67
|
icon "fa-regular fa-trash"
|
|
68
|
+
# You could also give it a block, which takes the record as an argument, to choose icons dynamically
|
|
69
|
+
# icon { |product| product.inventory? ? "fal fa-shelves" : "fal fa-shelves-empty" }
|
|
68
70
|
link_attributes data: {"turbo-confirm": "Are you sure you want to delete the user?", "turbo-method": :delete}
|
|
69
71
|
show ->(user) { true }
|
|
70
72
|
end
|
|
@@ -173,7 +175,14 @@ $ gem install mensa
|
|
|
173
175
|
Always use `bundle` to install the gem. Next use the install generator to install migrations, add an initializer and do other setup:
|
|
174
176
|
|
|
175
177
|
```bash
|
|
176
|
-
$
|
|
178
|
+
$ rails g mensa:install
|
|
179
|
+
$ rails mensa:install:migrations
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Next you can run the generator to generate a table:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
$ rails g mensa:table:generate <model_name>
|
|
177
186
|
```
|
|
178
187
|
|
|
179
188
|
### Exports
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<% if action.show.call(row.record) %>
|
|
2
2
|
<%= link_to(action.link ? table.original_view_context.instance_exec(row.record, &action.link) : "", {class: "action", title: action.title}.merge(action.link_attributes || {})) do %>
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
|
|
4
|
+
<% if icon = action.icon(row.record) %>
|
|
5
|
+
<i class="fa <%= icon %>"></i>
|
|
5
6
|
<% else %>
|
|
6
7
|
<%= name %>
|
|
7
8
|
<% end %>
|
data/app/tables/mensa/action.rb
CHANGED
|
@@ -21,10 +21,17 @@ module Mensa
|
|
|
21
21
|
@config = config
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
+
def icon(record)
|
|
25
|
+
if @config[:icon].is_a?(Proc)
|
|
26
|
+
@config[:icon].call(record)
|
|
27
|
+
else
|
|
28
|
+
@config[:icon]
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
24
32
|
config_reader :title
|
|
25
33
|
config_reader :link, call: false
|
|
26
34
|
config_reader :link_attributes
|
|
27
|
-
config_reader :icon
|
|
28
35
|
config_reader :show, call: false
|
|
29
36
|
end
|
|
30
37
|
end
|
data/lib/mensa/version.rb
CHANGED