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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 157c85b21871fba844d2da67a40213a63b7613a9110e5fd8e72b430eea52c1cb
4
- data.tar.gz: 19448d06038afe21efe938b9abe4db4eca02bb37c79b63a6d3dabc303fbff362
3
+ metadata.gz: aba7799f773e66098f92d1471963e6fe5da4079b095264c249dc4545a1a84a00
4
+ data.tar.gz: 98866e7d39aa6d9a31eb9b750949d69ccd16cd2d2f8cb2421f9eb9b96b450046
5
5
  SHA512:
6
- metadata.gz: d0c54e34d0017715e2b4d0b0f351abebf0f02a3029cc4762bf40c07abd0198e8945b7b1bf3e474051263afddb9a65e518fa8febdae127b323e755c67c814049f
7
- data.tar.gz: 8acef7a5b516284dfa3d44901cf059f8c9632aedc41bf2bbe1a93f8c7b840bb6988f424449e9fde2f53558e0f78a5dba2cc02b61d478669bdb05318d33d6102e
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
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tramway
4
- VERSION = '4.1.1'
4
+ VERSION = '4.1.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.1
4
+ version: 4.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - kalashnikovisme