backstage 0.1.16 → 0.1.18

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: c93addd91e80f76d095d7fd56542ebea748d27be3043cad7affcee189143718e
4
- data.tar.gz: a9df1684acf09fb155e449e612e1e92c117874b581d4161f4b9c4b3749f610b4
3
+ metadata.gz: bd4a99dca95784cecd88484e12b1caa4cc039f8a49d2d931b8d0675f6585edbd
4
+ data.tar.gz: 5ac6646e4111267ea577eef7bbfd9dc5a3b0ea81ca4c52e2073f79c07239de34
5
5
  SHA512:
6
- metadata.gz: 48c81f6f435f100053c573b886ad40f6df175ae871302bbc381c161ade4f99bbe2062505de73133702d8a7c05e679d721e31d0a95f76b6555d3d1923df0f328a
7
- data.tar.gz: 6653ba7832ea040c05081c5f46e9b4f8504503ed7bf117a49c7d111e95d144c56edbf9262f7864eed7d12094c482574e31ad0505a33323ea6141601e9d13d4e3
6
+ metadata.gz: 20bf822e699375f97414d14d0fa8b97b0f416e30fa8321ac9e3a6dfcc64b84c1dbf7b4e8e5f6cce12219c678600aaf1cb280369d9ecbd15cc5daff61a6830486
7
+ data.tar.gz: a6d2bc5524a9054a7d54f22730f9807870e15ee26c14cf9f8abce5832233f6e47b07be4d0e8deba751ee0f3b560274233a59cc5f550af1ff00d3cc06c3be050f
data/CHANGELOG.md CHANGED
@@ -7,6 +7,27 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.18] — 2026-07-18
11
+
12
+ ### Added
13
+
14
+ - Responsive admin layout: left nav collapses behind a hamburger toggle and overlays the page below 768px; edit-page sidebar reflows below the form on narrow viewports
15
+
16
+ ### Changed
17
+
18
+ - Test dummy app now uses Propshaft to serve assets (fixes CSS not loading in system tests)
19
+
20
+ ## [0.1.17] — 2026-06-04
21
+
22
+ ### Added
23
+
24
+ - Flash notice is displayed after a successful create or update
25
+
26
+ ### Fixed
27
+
28
+ - Edit and new forms now render validation error messages inline when save fails
29
+ - Successful update now redirects back to the edit page instead of the index
30
+
10
31
  ## [0.1.16] — 2026-06-02
11
32
 
12
33
  ### Fixed
@@ -9,3 +9,37 @@ main { padding: 1rem; grid-row: 2; grid-column: 2; }
9
9
  /* Override Pico's horizontal nav list */
10
10
  nav ul { flex-direction: column; }
11
11
  nav ul li { display: block; }
12
+
13
+ [data-nav-toggle] { display: none; }
14
+
15
+ @media (max-width: 768px) {
16
+ body { grid-template-columns: 1fr; }
17
+ main { grid-column: 1; }
18
+
19
+ [data-nav-toggle] { display: inline-block; }
20
+
21
+ nav.backstage-nav {
22
+ display: none;
23
+ position: fixed;
24
+ top: 0;
25
+ left: 0;
26
+ width: 240px;
27
+ height: 100vh;
28
+ overflow-y: auto;
29
+ background: var(--pico-background-color);
30
+ box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
31
+ z-index: 100;
32
+ }
33
+
34
+ nav.backstage-nav.nav-open { display: block; }
35
+
36
+ .edit-layout { grid-template-columns: 1fr; }
37
+
38
+ .edit-layout aside {
39
+ border-left: none;
40
+ border-top: 1px solid var(--pico-muted-border-color);
41
+ padding-left: 0;
42
+ padding-top: 1rem;
43
+ margin-top: 1rem;
44
+ }
45
+ }
@@ -40,7 +40,8 @@ module Backstage
40
40
  def create
41
41
  @record = @resource_config.model_class.new(record_params)
42
42
  if @record.save
43
- redirect_to edit_resource_path(resource: params[:resource], id: @record.id)
43
+ redirect_to edit_resource_path(resource: params[:resource], id: @record.id),
44
+ notice: "#{@resource_config.model_class.model_name.human} was successfully created."
44
45
  else
45
46
  render :new, status: :unprocessable_entity
46
47
  end
@@ -48,7 +49,8 @@ module Backstage
48
49
 
49
50
  def update
50
51
  if @record.update(record_params)
51
- redirect_to resources_path(resource: params[:resource])
52
+ redirect_to edit_resource_path(resource: params[:resource], id: @record.id),
53
+ notice: "#{@resource_config.model_class.model_name.human} was successfully saved."
52
54
  else
53
55
  render :edit, status: :unprocessable_entity
54
56
  end
@@ -4,6 +4,15 @@
4
4
  <div<% if sidebar&.links&.any? %> class="edit-layout"<% end %>>
5
5
  <div>
6
6
  <%= form_with model: @record, url: resource_path(resource: params[:resource], id: @record.id), method: :patch do |f| %>
7
+ <% if @record.errors.any? %>
8
+ <div class="error-messages">
9
+ <ul>
10
+ <% @record.errors.full_messages.each do |msg| %>
11
+ <li><%= msg %></li>
12
+ <% end %>
13
+ </ul>
14
+ </div>
15
+ <% end %>
7
16
  <% @resource_config.edit_fields.each do |field| %>
8
17
  <% if field.container? %>
9
18
  <%= render partial: field.partial_path, locals: { f: f, field: field, record: @record } %>
@@ -1,6 +1,15 @@
1
1
  <h1>New <%= @resource_config.model_class.model_name.human %></h1>
2
2
 
3
3
  <%= form_with model: @record, url: resources_path(resource: params[:resource]), method: :post do |f| %>
4
+ <% if @record.errors.any? %>
5
+ <div class="error-messages">
6
+ <ul>
7
+ <% @record.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
4
13
  <% @resource_config.edit_fields.each do |field| %>
5
14
  <% if field.container? %>
6
15
  <%= render partial: field.partial_path, locals: { f: f, field: field, record: @record } %>
@@ -16,6 +16,14 @@
16
16
  }
17
17
  })
18
18
  })
19
+ var navToggle = document.querySelector("[data-nav-toggle]")
20
+ var nav = document.querySelector("nav.backstage-nav")
21
+ if (navToggle && nav) {
22
+ navToggle.addEventListener("click", function() {
23
+ var open = nav.classList.toggle("nav-open")
24
+ navToggle.setAttribute("aria-expanded", open)
25
+ })
26
+ }
19
27
  document.querySelectorAll("[data-multi-select-search]").forEach(function(input) {
20
28
  input.addEventListener("input", function() {
21
29
  var q = input.value.toLowerCase()
@@ -49,9 +57,10 @@
49
57
  </head>
50
58
  <body>
51
59
  <header>
60
+ <button type="button" data-nav-toggle aria-label="Menu" aria-expanded="false">☰</button>
52
61
  <%= link_to "Admin Home", backstage.root_path %>
53
62
  </header>
54
- <nav>
63
+ <nav class="backstage-nav">
55
64
  <ul>
56
65
  <% nav_resources.each do |config| %>
57
66
  <li><%= link_to config.model_class.model_name.human.pluralize,
@@ -60,6 +69,14 @@
60
69
  </ul>
61
70
  </nav>
62
71
  <main>
72
+ <div id="flash">
73
+ <% if flash[:notice] %>
74
+ <p class="notice"><%= flash[:notice] %></p>
75
+ <% end %>
76
+ <% if flash[:alert] %>
77
+ <p class="alert"><%= flash[:alert] %></p>
78
+ <% end %>
79
+ </div>
63
80
  <%= yield %>
64
81
  </main>
65
82
  </body>
@@ -1,3 +1,3 @@
1
1
  module Backstage
2
- VERSION = "0.1.16"
2
+ VERSION = "0.1.18"
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.16
4
+ version: 0.1.18
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-06-02 00:00:00.000000000 Z
11
+ date: 2026-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties