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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a7d9322ff7e374d37c137d366bec17c0728b350eccf87b146655d7704f1e560d
4
- data.tar.gz: 045e0e118d1269095a241ce783ffb08bc282b8e885570341ad57878e4e0e1ac4
3
+ metadata.gz: c3ac70ce33de0d7c3fbfd61650ff031137d8961713e9db94b93f0758ef2eba32
4
+ data.tar.gz: c8853c8169ac8821acafb3d47de20112400bd0e2d3e4c6390c3aec61917978a1
5
5
  SHA512:
6
- metadata.gz: 4d4594294bf08a6822a7b4a4d0bb8d777fdaed41fe0024d3fa29a5741c4c46c63ea921ea7c1742888502c42b5195e7198a23e4a80e8dc4216557e40da1e20953
7
- data.tar.gz: e2e6f019d9e2b19e8fa32f6d3740c2a32473b9e070845b04756e20e53eb2abb9f51b37dd2aa721bbad98a557e90f55eb32054ed36f1a014056be4dfa8d3018a9
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
- <%= component 'tailwinds/table/header', headers: ['Column 1', 'Column 2'] %>
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
- <%= component 'tailwinds/table/header', headers: ['Name', 'Email'] %>
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),
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tramway
4
- VERSION = '0.6.0.1'
4
+ VERSION = '0.6.0.2'
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.6.0.1
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-26 00:00:00.000000000 Z
12
+ date: 2025-10-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: anyway_config