backstage 0.1.8 → 0.1.10

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: a95cb9d0fe59db65f803f3a94cfd9988cc6236fc5d00343f9c48c7b8814e631e
4
- data.tar.gz: 5e0315f646f94ebaa48b940fdbfb5d6c5d81b234d05cb3979c68f5d491a3cf43
3
+ metadata.gz: d8d5018436566611adae93216ace1303f8ae4ed22af25015099291bf4b042290
4
+ data.tar.gz: 14af0f649cdb30c48cc3aaae389892f5e533894e1ab61339f342b55316be7367
5
5
  SHA512:
6
- metadata.gz: 84443088f024a1753e5fe91a4316ee8584c926cb89c37fd0120abf638eec19dcdd576c9e74f5e8422b992337f0cfa7e67eb860bb47975adcf2280de504c7dc6e
7
- data.tar.gz: 4a956b36f185f3b1b0fc0110bbf053de67699e3c7fdcee2ffbd0d1664e36ce8f929b39a941ada0e3beca0abf2d98dd10f53b9b84e5853f351cfd2f2212d2f712
6
+ metadata.gz: 71d2b10bbb890c1a372a23bfde83eb78aa7e8773485dcbbcc48db3d1b438e485a16ebea095f1f322a461939af9e8d57cf8bcd6271a6062fc197793489e9bbe04
7
+ data.tar.gz: 7f767a0c986971fb1916194fc969df576d3fd2b315d39f1196fe92c65ccd4fbf90b356f267072a9bda02e59a2bbd17b1f3d16c2db6f122327ed92f934d3bd482
data/CHANGELOG.md CHANGED
@@ -7,6 +7,19 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.10] — 2026-05-25
11
+
12
+ ### Fixed
13
+
14
+ - Dashboard pages now use the same windowed pagination (5 pages around current + first/last links) as resource index pages; pagination logic extracted into a shared `backstage/shared/_pagination` partial
15
+ - Sidebar no longer renders on index, dashboard, or new-record pages; proc-based sidebar links were crashing with `NoMethodError` when `@record` was nil — sidebar is now guarded with `record&.persisted?`
16
+
17
+ ## [0.1.9] — 2026-05-24
18
+
19
+ ### Fixed
20
+
21
+ - `belongs_to` and `field` no longer append to `index_fields` when `fields(...)` has already been called explicitly; previously calling `c.fields :name, :address` then `c.field :col, as: :tristate_boolean` would silently add the new field back onto the index list
22
+
10
23
  ## [0.1.8] — 2026-05-23
11
24
 
12
25
  ### Fixed
@@ -27,10 +27,4 @@
27
27
  </tbody>
28
28
  </table>
29
29
 
30
- <% if @total_pages > 1 %>
31
- <nav>
32
- <% (1..@total_pages).each do |p| %>
33
- <%= link_to p, url_for(page: p), class: (p == @page ? "current" : nil) %>
34
- <% end %>
35
- </nav>
36
- <% end %>
30
+ <%= render "backstage/shared/pagination" %>
@@ -52,16 +52,4 @@
52
52
  </tbody>
53
53
  </table>
54
54
 
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 %>
58
- <nav>
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) %>
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) %>
66
- </nav>
67
- <% end %>
55
+ <%= render "backstage/shared/pagination" %>
@@ -0,0 +1,13 @@
1
+ <% if @total_pages > 1 %>
2
+ <% window_start = [[@page - 2, 2].max, @total_pages - 4].min
3
+ window_end = [[@page + 2, @total_pages - 1].min, 5].max %>
4
+ <nav>
5
+ <%= link_to "1", url_for(page: 1), class: (@page == 1 ? "current" : nil) %>
6
+ <% if window_start > 2 %> &hellip;<% end %>
7
+ <% (window_start..window_end).each do |p| %>
8
+ &nbsp;<%= link_to p, url_for(page: p), class: (p == @page ? "current" : nil) %>
9
+ <% end %>
10
+ <% if window_end < @total_pages - 1 %> &hellip;<% end %>
11
+ &nbsp;<%= link_to @total_pages, url_for(page: @total_pages), class: (@page == @total_pages ? "current" : nil) %>
12
+ </nav>
13
+ <% end %>
@@ -46,7 +46,7 @@
46
46
  </main>
47
47
  <% sidebar = defined?(@resource_config) && @resource_config&.sidebar_config
48
48
  record = defined?(@record) ? @record : nil %>
49
- <% if sidebar&.links&.any? %>
49
+ <% if sidebar&.links&.any? && record&.persisted? %>
50
50
  <aside>
51
51
  <ul>
52
52
  <% sidebar.links.each do |link| %>
@@ -31,6 +31,7 @@ module Backstage
31
31
  attr_reader :sidebar_config
32
32
 
33
33
  def fields(*names)
34
+ @index_fields_explicit = true
34
35
  @index_fields = names.map { |n| find_or_build_field(n) }
35
36
  end
36
37
 
@@ -63,7 +64,7 @@ module Backstage
63
64
  @edit_fields.reject! { |f| f.name == fk_field.name }
64
65
  @index_fields.reject! { |f| f.name == fk_field.name || f.name == index_field.name }
65
66
  @edit_fields << fk_field
66
- @index_fields << index_field
67
+ @index_fields << index_field unless @index_fields_explicit
67
68
  end
68
69
 
69
70
  def field(name, **opts)
@@ -76,7 +77,7 @@ module Backstage
76
77
  else
77
78
  new_field = Field.new(sym, type || :string, opts)
78
79
  @edit_fields << new_field
79
- @index_fields << new_field
80
+ @index_fields << new_field unless @index_fields_explicit
80
81
  end
81
82
  end
82
83
 
@@ -1,3 +1,3 @@
1
1
  module Backstage
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.10"
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.8
4
+ version: 0.1.10
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-23 00:00:00.000000000 Z
11
+ date: 2026-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -58,6 +58,7 @@ files:
58
58
  - app/views/backstage/resources/edit.html.erb
59
59
  - app/views/backstage/resources/index.html.erb
60
60
  - app/views/backstage/resources/new.html.erb
61
+ - app/views/backstage/shared/_pagination.html.erb
61
62
  - app/views/layouts/backstage/backstage.html.erb
62
63
  - config/routes.rb
63
64
  - lib/backstage.rb