tramway 4.1.1 → 4.1.2
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 +27 -1
- data/lib/tramway/configs/entity.rb +1 -0
- data/lib/tramway/navbar.rb +2 -1
- data/lib/tramway/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: aba7799f773e66098f92d1471963e6fe5da4079b095264c249dc4545a1a84a00
|
|
4
|
+
data.tar.gz: 98866e7d39aa6d9a31eb9b750949d69ccd16cd2d2f8cb2421f9eb9b96b450046
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 27c456947b97709869bf23bab9eb3f72b4f30799766755fd53c58dad2ec070f0df73b574c16cea5983d3f560983ee9adb0194d84535553ba89d1748a90490005
|
|
7
|
+
data.tar.gz: b3b705af11f591965764edac7608d8af72e156d1a78d029a887e96b20b30945818df89f4ea947a0f6d945f06f90bf6db702b1a8951597c5cadb9f196c45e6227
|
data/README.md
CHANGED
|
@@ -177,6 +177,30 @@ Tramway.configure do |config|
|
|
|
177
177
|
end
|
|
178
178
|
```
|
|
179
179
|
|
|
180
|
+
**icon**
|
|
181
|
+
|
|
182
|
+
Set `icon` on an entity to render a Font Awesome class string before its auto-generated link in the Tramway Navbar
|
|
183
|
+
(the entity-based items rendered when `tramway_navbar` is called with `with_entities: true`, the default — see
|
|
184
|
+
[Icons on navbar items](#icons-on-navbar-items)):
|
|
185
|
+
|
|
186
|
+
*config/initializers/tramway.rb*
|
|
187
|
+
```ruby
|
|
188
|
+
Tramway.configure do |config|
|
|
189
|
+
config.entities = [
|
|
190
|
+
{
|
|
191
|
+
name: :campaign,
|
|
192
|
+
namespace: :admin,
|
|
193
|
+
icon: 'fa-solid fa-bullhorn',
|
|
194
|
+
pages: [
|
|
195
|
+
{ action: :index }
|
|
196
|
+
]
|
|
197
|
+
}
|
|
198
|
+
]
|
|
199
|
+
end
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Entities without an `icon` keep rendering as plain text links.
|
|
203
|
+
|
|
180
204
|
**scope**
|
|
181
205
|
|
|
182
206
|
By default, Tramway lists all records for an entity on the index page. You can narrow the records displayed by providing a
|
|
@@ -1058,7 +1082,9 @@ will render [this](https://play.tailwindcss.com/UZPTCudFw5)
|
|
|
1058
1082
|
|
|
1059
1083
|
#### Icons on navbar items
|
|
1060
1084
|
|
|
1061
|
-
`nav.item` accepts an optional `icon:` option with a Font Awesome class string, rendered before the item's label
|
|
1085
|
+
`nav.item` accepts an optional `icon:` option with a Font Awesome class string, rendered before the item's label.
|
|
1086
|
+
This also applies to the auto-generated entity links described in [Define entities with options](#define-entities-with-options) —
|
|
1087
|
+
set `icon` on an entity in `config/initializers/tramway.rb` to add an icon to its link without writing a custom `nav.item` call.
|
|
1062
1088
|
|
|
1063
1089
|
```ruby
|
|
1064
1090
|
nav.left do
|
|
@@ -11,6 +11,7 @@ module Tramway
|
|
|
11
11
|
attribute? :pages, Types::Array.of(Tramway::Configs::Entities::Page).default([].freeze)
|
|
12
12
|
attribute? :route, Tramway::Configs::Entities::Route
|
|
13
13
|
attribute? :namespace, Types::Coercible::String
|
|
14
|
+
attribute? :icon, Types::Coercible::String
|
|
14
15
|
|
|
15
16
|
# Route Struct contains implemented in Tramway CRUD and helpful routes for the entity
|
|
16
17
|
ACTIONS = %i[index show new create edit update destroy].freeze
|
data/lib/tramway/navbar.rb
CHANGED
|
@@ -59,7 +59,8 @@ module Tramway
|
|
|
59
59
|
entities.each do |entity|
|
|
60
60
|
next if entity.routes.index.blank?
|
|
61
61
|
|
|
62
|
-
item entity.human_name.plural, Tramway::Engine.routes.url_helpers.public_send(entity.routes.index)
|
|
62
|
+
item entity.human_name.plural, Tramway::Engine.routes.url_helpers.public_send(entity.routes.index),
|
|
63
|
+
icon: entity.icon
|
|
63
64
|
end
|
|
64
65
|
|
|
65
66
|
reset_filling
|
data/lib/tramway/version.rb
CHANGED