tramway 0.5.1.1 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4ba049579087665a532f06011144ca74a591cb7704769c8a2c69c99aca81aad
4
- data.tar.gz: 44b743f0aa80d9d6b074a325505b66a8c7a019f1c59103fd6ea79e5faf567ed8
3
+ metadata.gz: 168f2a63e4483ba637e614eff3f2e3b2fcd61c52a61da934a6a13883017bbe37
4
+ data.tar.gz: 904bb0981692516905f77867ba1ca878ba9d26f0e1a5bfb6e85718b4210e96d3
5
5
  SHA512:
6
- metadata.gz: 88a6ba5eda48febc6aec0c5c15915ee276161ddedbaa281fed6a65e68b0dc55e4d04e53a6505d68fb9e9a5871249ea2b565ac9d828dbf2b186d8bd11368b663c
7
- data.tar.gz: 25ae018d2242c6adc460e1058489109c2fae3d151243b8240d925ed1a63e0d1e19beef90d3c23cf036d34d207816c316051c8db5d681628ea2bedb0743e1a33f
6
+ metadata.gz: f907d004a4177faa23953d355c4cd081985c83f4187080ac2195833317fc3ab49178d5e504628789aab1de76731339e23883c6e201c97c3b87ffcc717add61a6
7
+ data.tar.gz: 26332774327abca66e8a45f89bc42feea4fbb5cf4c7fd8102448dd996e0b374d80f74188fa81a0666a74431fab6f97686c37ad6921eeffcbb526bc8803bceba7
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
  Unite Ruby on Rails brilliance. Streamline development with Tramway.
3
3
 
4
4
  * [Installation](https://github.com/Purple-Magic/tramway#installation)
5
+ * [Getting Started](https://github.com/Purple-Magic/tramway?tab=readme-ov-file#getting-started)
5
6
  * [Usage](https://github.com/Purple-Magic/tramway#usage)
6
7
  * [Tramway Entities](https://github.com/Purple-Magic/tramway#tramway-entities)
7
8
  * [Tramway Decorators](https://github.com/Purple-Magic/tramway#tramway-decorators)
@@ -3,7 +3,7 @@
3
3
  - cols = cells.count.times.map { |item| "1fr" }.join(",")
4
4
 
5
5
  -# desktop view
6
- = row_tag class: "div-table-row block grid gap-4 bg-white border-b dark:bg-gray-800 dark:border-gray-700 cursor-pointer hover:bg-purple-100 grid-cols-[#{cols}]" do
6
+ = row_tag class: "div-table-row block grid gap-4 bg-white border-b dark:bg-gray-800 dark:border-gray-700 grid-cols-[#{cols}]" do
7
7
  - cells.each do |(_, value)|
8
8
  .div-table-cell.px-6.py-4.font-medium.text-gray-900.whitespace-nowrap.dark:text-white.sm:text-xs.text-base
9
9
  = value
@@ -17,7 +17,7 @@ module Tramway
17
17
  private
18
18
 
19
19
  def model_class
20
- @model_class ||= params[:entity].classify.constantize
20
+ @model_class ||= params[:entity][:name].classify.constantize
21
21
  end
22
22
  end
23
23
  end
data/config/routes.rb CHANGED
@@ -2,6 +2,29 @@
2
2
 
3
3
  Tramway::Engine.routes.draw do
4
4
  Tramway.config.entities.each do |entity|
5
- resources entity.name.pluralize.to_sym, only: entity.pages, controller: :entities, defaults: { entity: entity.name }
5
+ define_resource = lambda do |resource_name, entity| # rubocop:disable Lint/ShadowingOuterLocalVariable
6
+ resources resource_name.pluralize.to_sym,
7
+ only: [:index],
8
+ controller: '/tramway/entities',
9
+ defaults: { entity: }
10
+ end
11
+
12
+ if entity.name.include?('/')
13
+ *namespaces, resource_name = entity.name.split('/')
14
+
15
+ define_namespace = lambda do |index|
16
+ namespace namespaces[index].to_sym do
17
+ if namespaces[index] == namespaces.last
18
+ define_resource.call(resource_name, entity)
19
+ else
20
+ define_namespace.call(namespaces[index + 1])
21
+ end
22
+ end
23
+ end
24
+
25
+ define_namespace.call(0)
26
+ else
27
+ define_resource.call(entity.name, entity)
28
+ end
6
29
  end
7
30
  end
@@ -25,7 +25,16 @@ module.exports = {
25
25
  'text-4xl',
26
26
  'font-bold',
27
27
  'xl:hidden',
28
+ 'grid-cols-[1fr]',
29
+ 'grid-cols-[1fr,1fr]',
28
30
  'grid-cols-[1fr,1fr,1fr]',
31
+ 'grid-cols-[1fr,1fr,1fr,1fr]',
32
+ 'grid-cols-[1fr,1fr,1fr,1fr,1fr]',
33
+ 'grid-cols-[1fr,1fr,1fr,1fr,1fr,1fr]',
34
+ 'grid-cols-[1fr,1fr,1fr,1fr,1fr,1fr,1fr]',
35
+ 'grid-cols-[1fr,1fr,1fr,1fr,1fr,1fr,1fr,1fr]',
36
+ 'grid-cols-[1fr,1fr,1fr,1fr,1fr,1fr,1fr,1fr,1fr]',
37
+ 'grid-cols-[1fr,1fr,1fr,1fr,1fr,1fr,1fr,1fr,1fr,1fr]',
29
38
  'text-right',
30
39
  'w-2/3',
31
40
  'flex',
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tramway
4
- VERSION = '0.5.1.1'
4
+ VERSION = '0.5.1.3'
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.1.1
4
+ version: 0.5.1.3
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-01-20 00:00:00.000000000 Z
12
+ date: 2025-01-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: anyway_config