tramway 0.5.4 → 0.5.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3edafce1c744c1e57499e5682ee75f749dbf5bdefd1a9137d70ccaa95f1381f
4
- data.tar.gz: fbb70ec105b76caad025797238eb09a7e21d5892e90be6b77c1c2858f301c666
3
+ metadata.gz: 0b3a940800b0be153a5c1eb7655a1f4203ac977accf41579e43221766843c0e8
4
+ data.tar.gz: ead462e416c64538748b393652233a4fb755f6c874dcf2d618e027ff4cfa77dc
5
5
  SHA512:
6
- metadata.gz: 4deef971e492a823f04475bc6e915193735844521f8ae65ba8f07da1b1b0edb40e35d944000b648e0c36f1e33d8b2e770b6b62117f52df1a81443fb034132032
7
- data.tar.gz: fcbea51c9f88495f24110ccac4f473a3a76f2583621fb952ec849fc77c690ee081bcba7a4e789c04f1c77bda02c41dac2d607f7c9b5a6572cdd03172cf31ac0c
6
+ metadata.gz: 835993aedeccd2cd7873c3cb12416d5c7c90f45d0cb234926e544a251e6bbc7a889a4a68db36f9adec55b360d246f146701a37307875ad7729f2f029f0e829fe
7
+ data.tar.gz: b78685a91ce1adbb6da37659972a5206b891cccde030a3fb18ee8ba559f49bc73144b5db0636fedc22ed2f9466cab67e74afe0192f0c162283f1009e85ed4886
data/README.md CHANGED
@@ -40,7 +40,7 @@ Tramway.configure do |config|
40
40
  config.entities = [
41
41
  {
42
42
  name: :user,
43
- pages: [:index],
43
+ pages: [{ action: :index }],
44
44
  }
45
45
  ]
46
46
  end
@@ -465,10 +465,22 @@ title_link: Link on Tramway Navbar title. Default: '/'
465
465
  background:
466
466
  color: Css-color. Supports all named CSS colors and HEX colors
467
467
  intensity: Color intensity. Range: **100..950**. Used by Tailwind. Not supported in case of using HEX color in the background.color
468
+ with_entities: Show Tramway Entities index page links to navbar. Default: true
468
469
  ```
469
470
 
470
471
  **NOTE:** `tramway_navbar` method called without arguments and block of code will render only [Tramway Entities](https://github.com/Purple-Magic/tramway#tramway-entities) links on the left.
471
472
 
473
+ In case you want to hide entity links you can pass `with_entities: false`.
474
+
475
+ ```haml
476
+ - if current_user.present?
477
+ = tramway_navbar title: 'WaiWai' do |nav|
478
+ - nav.left do
479
+ - nav.item 'Board', admin_board_path
480
+ - else
481
+ = tramway_navbar title: 'WaiWai', with_entities: false
482
+ ```
483
+
472
484
  #### nav.left and nav.right
473
485
 
474
486
  Tramway navbar provides `left` and `right` methods that puts items to left and right part of navbar.
@@ -16,7 +16,8 @@ module Tramway
16
16
  else
17
17
  model_class.order(id: :desc)
18
18
  end.page(params[:page])
19
- @namespace = entity.route.namespace
19
+
20
+ @namespace = entity.route&.namespace
20
21
  end
21
22
 
22
23
  private
@@ -30,7 +30,13 @@ module Tramway
30
30
 
31
31
  base_class_name = Tramway::Decorators::NameBuilder.default_decorator_class_name(klass)
32
32
 
33
- namespace.present? ? "#{namespace.to_s.camelize}::#{base_class_name}" : base_class_name
33
+ klass_name = namespace.present? ? "#{namespace.to_s.camelize}::#{base_class_name}" : base_class_name
34
+
35
+ if klass_name.safe_constantize
36
+ klass_name
37
+ else
38
+ raise NameError, "You should define #{klass_name} decorator class in app/decorators/ folder."
39
+ end
34
40
  end
35
41
 
36
42
  # :reek:NilCheck { enabled: false }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tramway
4
- VERSION = '0.5.4'
4
+ VERSION = '0.5.4.1'
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: 0.5.4
4
+ version: 0.5.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - kalashnikovisme
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-06-29 00:00:00.000000000 Z
12
+ date: 2025-07-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: anyway_config