backstage 0.1.10 → 0.1.11

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: d8d5018436566611adae93216ace1303f8ae4ed22af25015099291bf4b042290
4
- data.tar.gz: 14af0f649cdb30c48cc3aaae389892f5e533894e1ab61339f342b55316be7367
3
+ metadata.gz: da942f19c113814d2f7a5e738b3b7f7ce1cc1e8b23beeaabe8e9ef7e1f0d1b50
4
+ data.tar.gz: 805dedf4003e77e48d6e9bf5eb426d3f24e91fe61297a97eebd3c1f8a858e8f1
5
5
  SHA512:
6
- metadata.gz: 71d2b10bbb890c1a372a23bfde83eb78aa7e8773485dcbbcc48db3d1b438e485a16ebea095f1f322a461939af9e8d57cf8bcd6271a6062fc197793489e9bbe04
7
- data.tar.gz: 7f767a0c986971fb1916194fc969df576d3fd2b315d39f1196fe92c65ccd4fbf90b356f267072a9bda02e59a2bbd17b1f3d16c2db6f122327ed92f934d3bd482
6
+ metadata.gz: 76d4dd10a000b8aeb880f7df124140c351553e44fd98ee3ab42b980cb7abb315297fc959c50a2f3770c48d289db77b28326d4073677046c43dc83cb12022d29d
7
+ data.tar.gz: 800c78a96cc7e9289edff896f5264d0aa73399c4ae30f1ad6557e100213a1c4975f6da1c823fc0f4842744952320f9fe18f3f6a5f1ebe7a3de9b964742c1999a
data/CHANGELOG.md CHANGED
@@ -7,6 +7,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.11] — 2026-05-25
11
+
12
+ ### Fixed
13
+
14
+ - Pagination window no longer generates links below page 1 or above the last page when there are fewer than 6 total pages; window is clamped to the valid inner range and skipped entirely when `total_pages <= 2`
15
+ - Sidebar moved from the layout into the edit view, rendering to the right of the form in a two-column grid; links open in a new tab (`target="_blank"`) and blank URLs (e.g. from a proc returning `""`) are skipped silently
16
+
10
17
  ## [0.1.10] — 2026-05-25
11
18
 
12
19
  ### Fixed
@@ -3,7 +3,8 @@ body { display: grid; grid-template-columns: 200px 1fr; grid-template-rows: auto
3
3
  header { grid-column: 1 / -1; }
4
4
  nav { padding: 1rem; grid-row: 2; grid-column: 1; }
5
5
  main { padding: 1rem; grid-row: 2; grid-column: 2; }
6
- aside { grid-column: 2; padding: 1rem; border-top: 1px solid var(--pico-muted-border-color); }
6
+ .edit-layout { display: grid; grid-template-columns: 1fr 220px; gap: 2rem; align-items: start; }
7
+ .edit-layout aside { border-left: 1px solid var(--pico-muted-border-color); padding-left: 1rem; }
7
8
 
8
9
  /* Override Pico's horizontal nav list */
9
10
  nav ul { flex-direction: column; }
@@ -1,18 +1,35 @@
1
1
  <h1>Edit <%= @resource_config.model_class.model_name.human %></h1>
2
2
 
3
- <%= form_with model: @record, url: resource_path(resource: params[:resource], id: @record.id), method: :patch do |f| %>
4
- <% @resource_config.edit_fields.each do |field| %>
5
- <div>
6
- <%= f.label field.name %>
7
- <%= render partial: field.partial_path, locals: { f: f, field: field, record: @record } %>
8
- </div>
9
- <% end %>
10
- <%= f.submit "Save" %>
11
- <% end %>
3
+ <% sidebar = @resource_config.sidebar_config %>
4
+ <div class="<%= sidebar&.links&.any? ? "edit-layout" : "" %>">
5
+ <div>
6
+ <%= form_with model: @record, url: resource_path(resource: params[:resource], id: @record.id), method: :patch do |f| %>
7
+ <% @resource_config.edit_fields.each do |field| %>
8
+ <div>
9
+ <%= f.label field.name %>
10
+ <%= render partial: field.partial_path, locals: { f: f, field: field, record: @record } %>
11
+ </div>
12
+ <% end %>
13
+ <%= f.submit "Save" %>
14
+ <% end %>
15
+
16
+ <%= link_to "Cancel", resources_path(resource: params[:resource]) %>
12
17
 
13
- <%= link_to "Cancel", resources_path(resource: params[:resource]) %>
18
+ <%= button_to "Delete",
19
+ resource_path(resource: params[:resource], id: @record.id),
20
+ method: :delete,
21
+ data: { confirm_message: "Delete this #{@resource_config.model_class.model_name.human}?" } %>
22
+ </div>
14
23
 
15
- <%= button_to "Delete",
16
- resource_path(resource: params[:resource], id: @record.id),
17
- method: :delete,
18
- data: { confirm_message: "Delete this #{@resource_config.model_class.model_name.human}?" } %>
24
+ <% if sidebar&.links&.any? %>
25
+ <aside>
26
+ <ul>
27
+ <% sidebar.links.each do |link| %>
28
+ <% url = link.url_or_proc.respond_to?(:call) ? link.url_or_proc.call(@record) : link.url_or_proc %>
29
+ <% next if url.blank? %>
30
+ <li><%= link_to link.label, url, target: "_blank" %></li>
31
+ <% end %>
32
+ </ul>
33
+ </aside>
34
+ <% end %>
35
+ </div>
@@ -1,13 +1,15 @@
1
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
2
  <nav>
5
3
  <%= 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) %>
4
+ <% if @total_pages > 2 %>
5
+ <% window_start = [[@page - 2, 2].max, @total_pages - 4].min.clamp(2, @total_pages - 1)
6
+ window_end = [[@page + 2, @total_pages - 1].min, 5].max.clamp(2, @total_pages - 1) %>
7
+ <% if window_start > 2 %> &hellip;<% end %>
8
+ <% (window_start..window_end).each do |p| %>
9
+ &nbsp;<%= link_to p, url_for(page: p), class: (p == @page ? "current" : nil) %>
10
+ <% end %>
11
+ <% if window_end < @total_pages - 1 %> &hellip;<% end %>
9
12
  <% end %>
10
- <% if window_end < @total_pages - 1 %> &hellip;<% end %>
11
13
  &nbsp;<%= link_to @total_pages, url_for(page: @total_pages), class: (@page == @total_pages ? "current" : nil) %>
12
14
  </nav>
13
15
  <% end %>
@@ -44,17 +44,5 @@
44
44
  <main>
45
45
  <%= yield %>
46
46
  </main>
47
- <% sidebar = defined?(@resource_config) && @resource_config&.sidebar_config
48
- record = defined?(@record) ? @record : nil %>
49
- <% if sidebar&.links&.any? && record&.persisted? %>
50
- <aside>
51
- <ul>
52
- <% sidebar.links.each do |link| %>
53
- <% url = link.url_or_proc.respond_to?(:call) ? link.url_or_proc.call(record) : link.url_or_proc %>
54
- <li><%= link_to link.label, url %></li>
55
- <% end %>
56
- </ul>
57
- </aside>
58
- <% end %>
59
47
  </body>
60
48
  </html>
@@ -1,3 +1,3 @@
1
1
  module Backstage
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.11"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backstage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gareth James