tramway 0.6.0.1 → 0.6.0.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 +4 -4
- data/README.md +28 -2
- data/lib/tramway/helpers/views_helper.rb +8 -0
- data/lib/tramway/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c3ac70ce33de0d7c3fbfd61650ff031137d8961713e9db94b93f0758ef2eba32
|
|
4
|
+
data.tar.gz: c8853c8169ac8821acafb3d47de20112400bd0e2d3e4c6390c3aec61917978a1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 485ff69148ae02c0967fa8d5bb75674b10a515a88c195ab86c7d6346b3710594bc3fb710e7d861d40f29287998c6f9a95ff2ddc63f4c0a14a8c69381179d12d6
|
|
7
|
+
data.tar.gz: ea7258f63f8adab1936e0f71e6a554857a8b650e3fb9182fe481a885a1823dee3ef5008280a849af141cffcfc10ed9324e9c01fd27106097df1af5938d6e57a4
|
data/README.md
CHANGED
|
@@ -148,6 +148,32 @@ Tramway.configure do |config|
|
|
|
148
148
|
end
|
|
149
149
|
```
|
|
150
150
|
|
|
151
|
+
**scope**
|
|
152
|
+
|
|
153
|
+
By default, Tramway lists all records for an entity on the index page. You can narrow the records displayed by providing a
|
|
154
|
+
`scope`. When set, Tramway will call the named scope on the entity before rendering the index view.
|
|
155
|
+
|
|
156
|
+
*config/initializers/tramway.rb*
|
|
157
|
+
```ruby
|
|
158
|
+
Tramway.configure do |config|
|
|
159
|
+
config.entities = [
|
|
160
|
+
{
|
|
161
|
+
name: :campaign,
|
|
162
|
+
route: { namespace: :admin },
|
|
163
|
+
pages: [
|
|
164
|
+
{
|
|
165
|
+
action: :index,
|
|
166
|
+
scope: :active
|
|
167
|
+
}
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
end
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
In this example, the `Campaign` entity will display only records returned by the `active` scope on its index page, while all
|
|
175
|
+
other pages continue to show every record unless another scope is specified.
|
|
176
|
+
|
|
151
177
|
**route_helper**
|
|
152
178
|
|
|
153
179
|
To get routes Tramway generated just Tramway::Engine.
|
|
@@ -559,7 +585,7 @@ implementations.
|
|
|
559
585
|
|
|
560
586
|
```erb
|
|
561
587
|
<%= tramway_table do %>
|
|
562
|
-
<%=
|
|
588
|
+
<%= tramway_header headers: ['Column 1', 'Column 2'] %>
|
|
563
589
|
|
|
564
590
|
<%= tramway_row do %>
|
|
565
591
|
<%= tramway_cell do %>
|
|
@@ -579,7 +605,7 @@ allows you to extend the default styling without losing the sensible defaults pr
|
|
|
579
605
|
|
|
580
606
|
```erb
|
|
581
607
|
<%= tramway_table class: 'max-w-3xl border border-gray-200', data: { controller: 'table' } do %>
|
|
582
|
-
<%=
|
|
608
|
+
<%= tramway_header', headers: ['Name', 'Email'] %>
|
|
583
609
|
|
|
584
610
|
<%= tramway_row do %>
|
|
585
611
|
<%= tramway_cell do %>
|
|
@@ -17,6 +17,14 @@ module Tramway
|
|
|
17
17
|
component 'tailwinds/table', options:, &
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
+
def tramway_header(headers: nil, columns: nil, &)
|
|
21
|
+
component 'tailwinds/table/header',
|
|
22
|
+
headers:,
|
|
23
|
+
columns:,
|
|
24
|
+
options:,
|
|
25
|
+
&
|
|
26
|
+
end
|
|
27
|
+
|
|
20
28
|
def tramway_row(**options, &)
|
|
21
29
|
component 'tailwinds/table/row',
|
|
22
30
|
cells: options.delete(:cells),
|
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.6.0.
|
|
4
|
+
version: 0.6.0.2
|
|
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-10-
|
|
12
|
+
date: 2025-10-27 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: anyway_config
|