backstage 0.1.5 → 0.1.7

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: 302e4efe20bf1c65309c3383599db9d46a775a8ab3374f3949f5e56ff9179a2f
4
- data.tar.gz: 186490d4fd99db3b0878c628bd8e90295741fe3fe73920e1574a113865a0dc0f
3
+ metadata.gz: 299892c49e9544efa4a908a1f18987df7a998dc2610613193a0ac98f09ebf7cf
4
+ data.tar.gz: 1702ab9733dafa533dbfb76b15d2743ff04b4ef732111326f1f6e4e41f25daab
5
5
  SHA512:
6
- metadata.gz: 1fb812d791a742f1d3dbaf65a766eb46e3a46028eded82bfbcfa8236d81035570995e21ad0e504f5421368e240b6342d8022dce9cf0f2f58b642223daf85659f
7
- data.tar.gz: 5ad2bd2bafca2ce45238986e5d2c78405109c4ac36f7266e4104574c812620677f778d750fa9629f87d26a52849bcd71cfe572dc1262552ae2e365bc58434dab
6
+ metadata.gz: 143cefd654e33c48e0f0f56515fb02987dc4ecd6815708c8a5bdb9c3ff7bb967206d8a317470f0976d29794a2ea725464c39b790e2bfe37a057a4d2a586b856a
7
+ data.tar.gz: 42af0a9d020df3c28c2dfb3d088f59097c291bb14fc5fafb24ecb52662b94f007b768a9d6c846a87e62840fb373be7450c09ab30c98416ebfe848b6cf8bdba37
data/CHANGELOG.md CHANGED
@@ -7,6 +7,23 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.7] — 2026-05-19
11
+
12
+ ### Changed
13
+
14
+ - Pagination now shows a windowed range of 5 pages centred on the current page, plus permanent first and last page links, instead of listing every page number
15
+ - Page links are spaced apart to prevent them running together
16
+
17
+ ## [0.1.6] — 2026-05-19
18
+
19
+ ### Added
20
+
21
+ - `belongs_to` associations now render as a linked display name on the index page (e.g. "Alice" linking to the related record's edit page) instead of the raw foreign key integer
22
+
23
+ ### Fixed
24
+
25
+ - `AutoDiscovery#build` now assigns independent arrays to `index_fields` and `edit_fields`; previously they shared the same object, causing edits to one to silently affect the other
26
+
10
27
  ## [0.1.5] — 2026-05-19
11
28
 
12
29
  ### Fixed
@@ -34,6 +34,13 @@
34
34
  <td>
35
35
  <% if field.enum? %>
36
36
  <%= record.public_send(field.name).to_s.humanize %>
37
+ <% elsif field.belongs_to? %>
38
+ <% related = record.public_send(field.association.name)
39
+ col = field.association.display_column
40
+ label = related&.public_send(col) %>
41
+ <% if related %>
42
+ <%= link_to label, edit_resource_path(resource: related.class.model_name.plural, id: related.id) %>
43
+ <% end %>
37
44
  <% else %>
38
45
  <%= record.public_send(field.name) %>
39
46
  <% end %>
@@ -46,9 +53,15 @@
46
53
  </table>
47
54
 
48
55
  <% if @total_pages > 1 %>
56
+ <% window_start = [[@page - 2, 2].max, @total_pages - 4].min
57
+ window_end = [[@page + 2, @total_pages - 1].min, 5].max %>
49
58
  <nav>
50
- <% (1..@total_pages).each do |p| %>
51
- <%= link_to p, url_for(page: p), class: (p == @page ? "current" : nil) %>
59
+ <%= link_to "1", url_for(page: 1), class: (@page == 1 ? "current" : nil) %>
60
+ <% if window_start > 2 %> &hellip;<% end %>
61
+ <% (window_start..window_end).each do |p| %>
62
+ &nbsp;<%= link_to p, url_for(page: p), class: (p == @page ? "current" : nil) %>
52
63
  <% end %>
64
+ <% if window_end < @total_pages - 1 %> &hellip;<% end %>
65
+ &nbsp;<%= link_to @total_pages, url_for(page: @total_pages), class: (@page == @total_pages ? "current" : nil) %>
53
66
  </nav>
54
67
  <% end %>
@@ -26,7 +26,7 @@ module Backstage
26
26
  config.display_column = detect_display_column
27
27
  fields = column_fields + enum_fields
28
28
  config.index_fields = fields
29
- config.edit_fields = fields
29
+ config.edit_fields = fields.dup
30
30
  config
31
31
  end
32
32
 
@@ -59,9 +59,11 @@ module Backstage
59
59
  assoc = AssociationConfig.new(name, :belongs_to, opts)
60
60
  @associations << assoc
61
61
  fk_field = Field.new(assoc.foreign_key, :belongs_to, association: assoc)
62
+ index_field = Field.new(name.to_sym, :belongs_to, association: assoc)
62
63
  @edit_fields.reject! { |f| f.name == fk_field.name }
63
- @index_fields.reject! { |f| f.name == fk_field.name }
64
+ @index_fields.reject! { |f| f.name == fk_field.name || f.name == index_field.name }
64
65
  @edit_fields << fk_field
66
+ @index_fields << index_field
65
67
  end
66
68
 
67
69
  def field(name, **opts)
@@ -1,3 +1,3 @@
1
1
  module Backstage
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backstage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gareth James
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-05-19 00:00:00.000000000 Z
11
+ date: 2026-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties