tramway 1.0.1.2 → 1.0.1.3
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 +4 -0
- data/config/routes.rb +9 -4
- data/lib/tramway/configs/entity.rb +4 -3
- 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: 63be607c08e52f57b726d9f5c84f719febc22e35c0fb5d711f4c855268917203
|
|
4
|
+
data.tar.gz: 004a821c356a9f2e0e9503ddef030b3502510b4d9d9d72fe44ac1725443ee4b6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0c53956b38f0110ea92c4d39e6c97e932534276a1d4d7cb11ca9087910ac4659861f3743c87416f480e57f5a3df3639434c7a5b7e921b80098e3efbf01b42c5a
|
|
7
|
+
data.tar.gz: b179d2f0c46930bdab407ac94a99f0eb33f361eb0833850ede97a6fcbdccba9090c68edbbbd453f6b318bc69f9c965b732f9f1d0a58f985e720bfae520646d14
|
data/README.md
CHANGED
|
@@ -567,6 +567,10 @@ Read [behave_as_ar](https://github.com/Purple-Magic/tramway#behave_as_ar) sectio
|
|
|
567
567
|
|
|
568
568
|
### Tramway Navbar
|
|
569
569
|
|
|
570
|
+
#### Running tramway_navbar without arguments
|
|
571
|
+
|
|
572
|
+
When you call `tramway_navbar` without passing any arguments, it renders a navbar that lists buttons linking to all entities configured with a page index in `config/initializers/tramway.rb`.
|
|
573
|
+
|
|
570
574
|
Tramway provides DSL for rendering Tailwind Navgiation bar.
|
|
571
575
|
|
|
572
576
|
```ruby
|
data/config/routes.rb
CHANGED
|
@@ -12,10 +12,15 @@ Tramway::Engine.routes.draw do
|
|
|
12
12
|
resource_name = segments.pop
|
|
13
13
|
|
|
14
14
|
define_resource = proc do
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
entity.pages.each do |page|
|
|
16
|
+
case page.action
|
|
17
|
+
when 'index'
|
|
18
|
+
get resource_name.pluralize, to: '/tramway/entities#index', defaults: { entity: }, as: resource_name.pluralize
|
|
19
|
+
when 'show'
|
|
20
|
+
get "#{resource_name.pluralize}/:id", to: '/tramway/entities#show', defaults: { entity: },
|
|
21
|
+
as: resource_name.singularize
|
|
22
|
+
end
|
|
23
|
+
end
|
|
19
24
|
end
|
|
20
25
|
|
|
21
26
|
if segments.empty?
|
|
@@ -13,7 +13,8 @@ module Tramway
|
|
|
13
13
|
attribute? :namespace, Types::Coercible::String
|
|
14
14
|
|
|
15
15
|
# Route Struct contains implemented in Tramway CRUD and helpful routes for the entity
|
|
16
|
-
|
|
16
|
+
ACTIONS = %i[index show].freeze
|
|
17
|
+
RouteStruct = Struct.new(*ACTIONS)
|
|
17
18
|
|
|
18
19
|
# HumanName Struct contains human names forms for the entity
|
|
19
20
|
HumanNameStruct = Struct.new(:single, :plural)
|
|
@@ -53,9 +54,9 @@ module Tramway
|
|
|
53
54
|
end
|
|
54
55
|
|
|
55
56
|
def route_helper_methods
|
|
56
|
-
|
|
57
|
+
ACTIONS.map do |action|
|
|
57
58
|
page(action).present? ? send("#{action}_helper_method") : nil
|
|
58
|
-
end
|
|
59
|
+
end
|
|
59
60
|
end
|
|
60
61
|
|
|
61
62
|
def build_helper_method(base_name, route: nil, namespace: nil, plural: false)
|
data/lib/tramway/version.rb
CHANGED