tramway 0.6.1.6 → 1.0.0.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 +4 -4
- data/README.md +32 -1
- data/app/components/tailwind_component.rb +1 -1
- data/app/components/tailwinds/base_component.rb +1 -1
- data/app/components/tailwinds/containers/narrow_component.rb +1 -1
- data/app/components/tailwinds/form/label_component.rb +1 -1
- data/app/components/tailwinds/pagination/base.rb +1 -1
- data/app/components/tailwinds/pagination/gap_component.rb +1 -1
- data/app/components/tailwinds/table/cell_component.rb +1 -1
- data/app/components/tailwinds/table/header_component.rb +1 -1
- data/app/components/tailwinds/table/row/preview_component.rb +1 -1
- data/app/components/tailwinds/table/row_component.html.haml +1 -1
- data/app/components/tailwinds/table/row_component.rb +1 -1
- data/app/components/tailwinds/table_component.rb +1 -1
- data/app/components/tramway/base_component.rb +15 -0
- data/app/components/tramway/entity_component.html.haml +1 -0
- data/app/components/tramway/entity_component.rb +28 -0
- data/app/controllers/tramway/entities_controller.rb +5 -1
- data/app/helpers/tramway/application_helper.rb +2 -0
- data/app/views/tramway/entities/_list.html.haml +6 -6
- data/app/views/tramway/entities/show.html.haml +15 -0
- data/config/routes.rb +9 -2
- data/config/tailwind.config.js +1 -0
- data/lib/tramway/base_decorator.rb +5 -1
- data/lib/tramway/configs/entities/route.rb +1 -2
- data/lib/tramway/configs/entity.rb +31 -16
- data/lib/tramway/decorators/class_helper.rb +9 -1
- data/lib/tramway/helpers/navbar_helper.rb +6 -6
- data/lib/tramway/navbar.rb +8 -6
- data/lib/tramway/version.rb +1 -1
- metadata +6 -4
- data/app/components/tramway/component/base.rb +0 -13
- data/app/views/tramway/entities/_entity.html.haml +0 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4ae5cf80f64299d99f74c529026b79d86560dc9de06ef48b5e2034e0cf586781
|
|
4
|
+
data.tar.gz: 8c7a9206caca2076a929c6f1d5f54680e7efb637f615a9513be2d2d720eaaf2a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8e74f1aa07fe82961906725383afbe2ca3b2ee307c0aecb04687f4e49db726aec9796a9bab6fd9dac9b61801a91ddf31f4d746591ac725cdf0e158beddc10c67
|
|
7
|
+
data.tar.gz: 3b0fc24f6e0f5f24540b85ec151af179b4bedd292713e8035932c11346e12d2ba685382d12a86e5deb97a5dd3e85ef5a8ff2e7c5a3aba9b6f676897a1adfc2a2
|
data/README.md
CHANGED
|
@@ -73,7 +73,7 @@ end
|
|
|
73
73
|
|
|
74
74
|
```ruby
|
|
75
75
|
class UserDecorator < Tramway::BaseDecorator
|
|
76
|
-
def self.
|
|
76
|
+
def self.index_attributes
|
|
77
77
|
[:id, :email, :created_at]
|
|
78
78
|
end
|
|
79
79
|
end
|
|
@@ -176,6 +176,37 @@ end
|
|
|
176
176
|
In this example, the `Campaign` entity will display only records returned by the `active` scope on its index page, while all
|
|
177
177
|
other pages continue to show every record unless another scope is specified.
|
|
178
178
|
|
|
179
|
+
**show page**
|
|
180
|
+
|
|
181
|
+
To render a show page for an entity, declare a `:show` action inside the `pages` array in
|
|
182
|
+
`config/initializers/tramway.rb`. Tramway will generate the route and render a table using the attributes returned by the
|
|
183
|
+
decorator's `self.show_attributes` method.
|
|
184
|
+
|
|
185
|
+
```ruby
|
|
186
|
+
Tramway.configure do |config|
|
|
187
|
+
config.entities = [
|
|
188
|
+
{
|
|
189
|
+
name: :campaign,
|
|
190
|
+
pages: [
|
|
191
|
+
{ action: :index },
|
|
192
|
+
{ action: :show }
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
]
|
|
196
|
+
end
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
```ruby
|
|
200
|
+
class CampaignDecorator < Tramway::BaseDecorator
|
|
201
|
+
def self.show_attributes
|
|
202
|
+
%i[name status starts_at]
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
With this configuration in place, visiting the show page displays a two-column table where the left column contains the
|
|
208
|
+
localized attribute names and the right column renders their values.
|
|
209
|
+
|
|
179
210
|
**route_helper**
|
|
180
211
|
|
|
181
212
|
To get routes Tramway generated just Tramway::Engine.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
require 'view_component'
|
|
4
4
|
|
|
5
5
|
# Base TailwindComponent. Contains base features for all tailwind components
|
|
6
|
-
class TailwindComponent < Tramway::
|
|
6
|
+
class TailwindComponent < Tramway::BaseComponent
|
|
7
7
|
option :input
|
|
8
8
|
option :attribute
|
|
9
9
|
option :value, optional: true
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Tailwinds
|
|
4
4
|
module Table
|
|
5
5
|
# Component for rendering a header in a table
|
|
6
|
-
class HeaderComponent < Tramway::
|
|
6
|
+
class HeaderComponent < Tramway::BaseComponent
|
|
7
7
|
option :headers, optional: true, default: -> { [] }
|
|
8
8
|
option :columns, optional: true, default: -> { 3 }
|
|
9
9
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
- if cells.any?
|
|
2
2
|
= row_tag class: desktop_row_classes(cells.count), **options do
|
|
3
3
|
- cells.each do |(_, value)|
|
|
4
|
-
.div-table-cell.px-6.py-4.font-medium.text-gray-900.
|
|
4
|
+
.div-table-cell.px-6.py-4.font-medium.text-gray-900.dark:text-white.text-xs.sm:text-base
|
|
5
5
|
= value
|
|
6
6
|
|
|
7
7
|
- else
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Tailwinds
|
|
4
4
|
module Table
|
|
5
5
|
# Component for rendering a row in a table
|
|
6
|
-
class RowComponent < Tramway::
|
|
6
|
+
class RowComponent < Tramway::BaseComponent
|
|
7
7
|
option :cells, optional: true, default: -> { [] }
|
|
8
8
|
option :href, optional: true
|
|
9
9
|
option :options, optional: true, default: -> { {} }
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'tramway/helpers/component_helper'
|
|
4
|
+
require 'tramway/helpers/decorate_helper'
|
|
5
|
+
require 'tramway/helpers/views_helper'
|
|
6
|
+
|
|
7
|
+
module Tramway
|
|
8
|
+
# You can use this class as a base for all your components
|
|
9
|
+
class BaseComponent < ViewComponent::Base
|
|
10
|
+
extend Dry::Initializer[undefined: false]
|
|
11
|
+
include Tramway::Helpers::ComponentHelper
|
|
12
|
+
include Tramway::Helpers::DecorateHelper
|
|
13
|
+
include Tramway::Helpers::ViewsHelper
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
= tramway_row cells:, href:
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Tramway
|
|
4
|
+
# Component for displaying an entity row in a list
|
|
5
|
+
#
|
|
6
|
+
class EntityComponent < Tramway::BaseComponent
|
|
7
|
+
option :item
|
|
8
|
+
option :entity
|
|
9
|
+
|
|
10
|
+
def decorated_item
|
|
11
|
+
tramway_decorate item, namespace: entity.namespace
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def href
|
|
15
|
+
if entity.pages.find { _1.action == 'show' }.present?
|
|
16
|
+
Tramway::Engine.routes.url_helpers.public_send entity.routes.show, decorated_item.id
|
|
17
|
+
else
|
|
18
|
+
decorated_item.show_path
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def cells
|
|
23
|
+
decorated_item.class.index_attributes.reduce({}) do |hash, attribute|
|
|
24
|
+
hash.merge! attribute => decorated_item.public_send(attribute)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'tramway/helpers/component_helper'
|
|
4
|
+
require 'tramway/helpers/views_helper'
|
|
4
5
|
require 'kaminari/helpers/tag'
|
|
5
6
|
|
|
6
7
|
module Tramway
|
|
@@ -8,6 +9,7 @@ module Tramway
|
|
|
8
9
|
module ApplicationHelper
|
|
9
10
|
include Tramway::Decorators::ClassHelper
|
|
10
11
|
include Tramway::Helpers::ComponentHelper
|
|
12
|
+
include Tramway::Helpers::ViewsHelper
|
|
11
13
|
|
|
12
14
|
def page_title
|
|
13
15
|
@model_class.model_name.human.pluralize # rubocop:disable Rails/HelperInstanceVariable
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
- decorator = Tramway::Decorators::ClassHelper.decorator_class_name(@model_class, @namespace)
|
|
2
|
-
-
|
|
2
|
+
- index_attributes = decorator.constantize.index_attributes
|
|
3
3
|
|
|
4
4
|
.mt-8.w-full
|
|
5
5
|
- content_for :title, page_title
|
|
@@ -13,15 +13,15 @@
|
|
|
13
13
|
.flex.justify-end.mt-2
|
|
14
14
|
= decorator.constantize.index_header_content.call(@entities) if decorator.constantize.index_header_content.present?
|
|
15
15
|
|
|
16
|
-
- if
|
|
16
|
+
- if index_attributes.empty?
|
|
17
17
|
%p.text-center.mt-10
|
|
18
|
-
You should fill class-level method `self.
|
|
18
|
+
You should fill class-level method `self.index_attributes` inside your
|
|
19
19
|
= decorator
|
|
20
20
|
- else
|
|
21
|
-
=
|
|
22
|
-
=
|
|
21
|
+
= tramway_table do
|
|
22
|
+
= tramway_header headers: index_attributes.map { |attribute| @model_class.human_attribute_name(attribute) }
|
|
23
23
|
- @entities.each do |item|
|
|
24
|
-
=
|
|
24
|
+
= component 'tramway/entity', entity: @entity, item: item
|
|
25
25
|
|
|
26
26
|
- if Tramway.config.pagination[:enabled]
|
|
27
27
|
.flex.mt-4
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
= tramway_container do
|
|
2
|
+
%h1.text-2xl.font-bold.mb-4
|
|
3
|
+
= @entity.title
|
|
4
|
+
|
|
5
|
+
- if @entity.show_attributes.empty?
|
|
6
|
+
%p.text-center.mt-10
|
|
7
|
+
You should fill object-level method `show_attributes` inside your
|
|
8
|
+
= @entity.class.name
|
|
9
|
+
= tramway_table do
|
|
10
|
+
- @entity.show_attributes.each do |attribute|
|
|
11
|
+
= tramway_row do
|
|
12
|
+
= tramway_cell do
|
|
13
|
+
= @model_class.human_attribute_name(attribute)
|
|
14
|
+
= tramway_cell do
|
|
15
|
+
= @entity.public_send(attribute)
|
data/config/routes.rb
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
# rubocop:disable Metrics/BlockLength
|
|
3
4
|
Tramway::Engine.routes.draw do
|
|
4
5
|
Tramway.config.entities.each do |entity|
|
|
5
|
-
|
|
6
|
+
if entity.namespace.present?
|
|
7
|
+
entity.namespace.split('/') + entity.name.split('/')
|
|
8
|
+
else
|
|
9
|
+
entity.name.split('/')
|
|
10
|
+
end => segments
|
|
11
|
+
|
|
6
12
|
resource_name = segments.pop
|
|
7
13
|
|
|
8
14
|
define_resource = proc do
|
|
9
15
|
resources resource_name.pluralize.to_sym,
|
|
10
|
-
only:
|
|
16
|
+
only: entity.pages.map(&:action),
|
|
11
17
|
controller: '/tramway/entities',
|
|
12
18
|
defaults: { entity: entity }
|
|
13
19
|
end
|
|
@@ -29,3 +35,4 @@ Tramway::Engine.routes.draw do
|
|
|
29
35
|
end
|
|
30
36
|
end
|
|
31
37
|
end
|
|
38
|
+
# rubocop:enable Metrics/BlockLength
|
data/config/tailwind.config.js
CHANGED
|
@@ -48,7 +48,7 @@ module Tramway
|
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
-
def
|
|
51
|
+
def index_attributes
|
|
52
52
|
[]
|
|
53
53
|
end
|
|
54
54
|
|
|
@@ -67,6 +67,10 @@ module Tramway
|
|
|
67
67
|
|
|
68
68
|
def show_path = nil
|
|
69
69
|
|
|
70
|
+
def show_attributes
|
|
71
|
+
[]
|
|
72
|
+
end
|
|
73
|
+
|
|
70
74
|
# :reek:ManualDispatch { enabled: false } because there is the idea to manual dispatch
|
|
71
75
|
def method_missing(method_name, *, &)
|
|
72
76
|
url_helpers = Rails.application.routes.url_helpers
|
|
@@ -6,11 +6,10 @@ module Tramway
|
|
|
6
6
|
# Route struct describes rules for route management
|
|
7
7
|
#
|
|
8
8
|
class Route < Dry::Struct
|
|
9
|
-
attribute? :namespace, Types::Coercible::String
|
|
10
9
|
attribute? :route_method, Types::Coercible::String
|
|
11
10
|
|
|
12
11
|
def helper_method_by(underscored_name)
|
|
13
|
-
"#{
|
|
12
|
+
"#{route_method || underscored_name}_path"
|
|
14
13
|
end
|
|
15
14
|
end
|
|
16
15
|
end
|
|
@@ -10,24 +10,26 @@ module Tramway
|
|
|
10
10
|
attribute :name, Types::Coercible::String
|
|
11
11
|
attribute? :pages, Types::Array.of(Tramway::Configs::Entities::Page).default([].freeze)
|
|
12
12
|
attribute? :route, Tramway::Configs::Entities::Route
|
|
13
|
+
attribute? :namespace, Types::Coercible::String
|
|
13
14
|
|
|
14
15
|
# Route Struct contains implemented in Tramway CRUD and helpful routes for the entity
|
|
15
|
-
RouteStruct = Struct.new(:index)
|
|
16
|
+
RouteStruct = Struct.new(:index, :show)
|
|
16
17
|
|
|
17
18
|
# HumanName Struct contains human names forms for the entity
|
|
18
19
|
HumanNameStruct = Struct.new(:single, :plural)
|
|
19
20
|
|
|
20
21
|
def routes
|
|
21
|
-
RouteStruct.new(
|
|
22
|
+
RouteStruct.new(*route_helper_methods)
|
|
22
23
|
end
|
|
23
24
|
|
|
24
25
|
def human_name
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
if model_class.present?
|
|
27
|
+
model_name = model_class.model_name.human
|
|
28
|
+
|
|
29
|
+
[model_name, pluralized(model_name)]
|
|
30
|
+
else
|
|
31
|
+
[name.capitalize, name.pluralize.capitalize]
|
|
32
|
+
end => single, plural
|
|
31
33
|
|
|
32
34
|
HumanNameStruct.new(single, plural)
|
|
33
35
|
end
|
|
@@ -50,16 +52,29 @@ module Tramway
|
|
|
50
52
|
nil
|
|
51
53
|
end
|
|
52
54
|
|
|
53
|
-
def
|
|
54
|
-
|
|
55
|
+
def route_helper_methods
|
|
56
|
+
%i[index show].map do |action|
|
|
57
|
+
page(action).present? ? send("#{action}_helper_method") : nil
|
|
58
|
+
end.compact
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def build_helper_method(base_name, route: nil, namespace: nil, plural: false)
|
|
62
|
+
if plural
|
|
63
|
+
base_name.to_s.parameterize.underscore.pluralize
|
|
64
|
+
else
|
|
65
|
+
base_name.to_s.parameterize.underscore
|
|
66
|
+
end => underscored
|
|
55
67
|
|
|
56
|
-
method_name =
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
68
|
+
method_name = route.present? ? route.helper_method_by(underscored) : "#{underscored}_path"
|
|
69
|
+
namespace.present? ? "#{namespace}_#{method_name}" : method_name
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def show_helper_method
|
|
73
|
+
build_helper_method(name, route:, namespace:, plural: false)
|
|
74
|
+
end
|
|
61
75
|
|
|
62
|
-
|
|
76
|
+
def index_helper_method
|
|
77
|
+
build_helper_method(name, route:, namespace:, plural: true)
|
|
63
78
|
end
|
|
64
79
|
|
|
65
80
|
def route_helper_engine
|
|
@@ -15,7 +15,7 @@ module Tramway
|
|
|
15
15
|
class_name = decorator_class_name(object_or_array, namespace)
|
|
16
16
|
class_name.constantize
|
|
17
17
|
rescue NameError
|
|
18
|
-
raise NameError, "You should define #{
|
|
18
|
+
raise NameError, "You should define #{class_name_for_error(object_or_array, namespace)} decorator class."
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -50,6 +50,14 @@ module Tramway
|
|
|
50
50
|
|
|
51
51
|
klass_name
|
|
52
52
|
end
|
|
53
|
+
|
|
54
|
+
def class_name_for_error(object_or_array, namespace)
|
|
55
|
+
object = object_or_array.respond_to?(:first) ? object_or_array.first : object_or_array
|
|
56
|
+
|
|
57
|
+
base_class_name = "#{object.class.name}Decorator"
|
|
58
|
+
|
|
59
|
+
namespace.present? ? "#{namespace}::#{base_class_name}" : base_class_name
|
|
60
|
+
end
|
|
53
61
|
end
|
|
54
62
|
end
|
|
55
63
|
end
|
|
@@ -25,12 +25,12 @@ module Tramway
|
|
|
25
25
|
def assign_navbar_items(options)
|
|
26
26
|
navbar_items = @navbar.items
|
|
27
27
|
navbar_items.each do |(key, value)|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
case key
|
|
29
|
+
when :left, :right
|
|
30
|
+
:"#{key}_items"
|
|
31
|
+
else
|
|
32
|
+
key
|
|
33
|
+
end => key_to_merge
|
|
34
34
|
|
|
35
35
|
options.merge! key_to_merge => value
|
|
36
36
|
end
|
data/lib/tramway/navbar.rb
CHANGED
|
@@ -38,11 +38,11 @@ module Tramway
|
|
|
38
38
|
def item(text_or_url, url = nil, **, &)
|
|
39
39
|
raise 'You cannot provide an argument and a code block at the same time' if provided_url_and_block?(url, &)
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
if url.present?
|
|
42
|
+
render_ignoring_block(text_or_url, url, **)
|
|
43
|
+
else
|
|
44
|
+
render_using_block(text_or_url, **, &)
|
|
45
|
+
end => rendered_item
|
|
46
46
|
|
|
47
47
|
@items[@filling] << rendered_item
|
|
48
48
|
end
|
|
@@ -53,7 +53,9 @@ module Tramway
|
|
|
53
53
|
filling_side :left
|
|
54
54
|
|
|
55
55
|
entities.each do |entity|
|
|
56
|
-
|
|
56
|
+
next if entity.routes.index.blank?
|
|
57
|
+
|
|
58
|
+
item entity.human_name.plural, Tramway::Engine.routes.url_helpers.public_send(entity.routes.index)
|
|
57
59
|
end
|
|
58
60
|
|
|
59
61
|
reset_filling
|
data/lib/tramway/version.rb
CHANGED
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.
|
|
4
|
+
version: 1.0.0.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-
|
|
12
|
+
date: 2025-11-01 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: anyway_config
|
|
@@ -205,7 +205,9 @@ files:
|
|
|
205
205
|
- app/components/tailwinds/table/row_component.rb
|
|
206
206
|
- app/components/tailwinds/table_component.html.haml
|
|
207
207
|
- app/components/tailwinds/table_component.rb
|
|
208
|
-
- app/components/tramway/
|
|
208
|
+
- app/components/tramway/base_component.rb
|
|
209
|
+
- app/components/tramway/entity_component.html.haml
|
|
210
|
+
- app/components/tramway/entity_component.rb
|
|
209
211
|
- app/controllers/tramway/entities_controller.rb
|
|
210
212
|
- app/helpers/tramway/application_helper.rb
|
|
211
213
|
- app/views/kaminari/_first_page.html.haml
|
|
@@ -215,9 +217,9 @@ files:
|
|
|
215
217
|
- app/views/kaminari/_page.html.haml
|
|
216
218
|
- app/views/kaminari/_paginator.html.haml
|
|
217
219
|
- app/views/kaminari/_prev_page.html.haml
|
|
218
|
-
- app/views/tramway/entities/_entity.html.haml
|
|
219
220
|
- app/views/tramway/entities/_list.html.haml
|
|
220
221
|
- app/views/tramway/entities/index.html.haml
|
|
222
|
+
- app/views/tramway/entities/show.html.haml
|
|
221
223
|
- app/views/tramway/layouts/application.html.haml
|
|
222
224
|
- config/routes.rb
|
|
223
225
|
- config/tailwind.config.js
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'tramway/helpers/component_helper'
|
|
4
|
-
|
|
5
|
-
module Tramway
|
|
6
|
-
module Component
|
|
7
|
-
# You can use this class as a base for all your components
|
|
8
|
-
class Base < ViewComponent::Base
|
|
9
|
-
extend Dry::Initializer[undefined: false]
|
|
10
|
-
include Tramway::Helpers::ComponentHelper
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
- decorator = decorator_class_name(entity, @namespace)
|
|
2
|
-
- decorated_object = decorator.constantize.decorate(entity)
|
|
3
|
-
= component 'tailwinds/table/row', cells: decorator.constantize.list_attributes.reduce({}) { |hash, attribute| hash.merge! attribute => decorated_object.public_send(attribute) }, href: decorated_object.show_path
|