Skip to content

Commit e45a741

Browse files
committed
Remove turbo frame tags from new and edit pages
We don't have to use turbo_frames on these pages since we are not loading content into it but always do a page visit to /new and /edit routes, and when server responds with 422 and templates with validation errors we can just place relevant "id" on the topmost element of the page so its content will be replaced with turbo stream.
1 parent d56fbe2 commit e45a741

File tree

2 files changed

+31
-35
lines changed

2 files changed

+31
-35
lines changed
Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
1-
<%= turbo_frame_tag :resource_form, target: "_top" do %>
2-
<%= page do %>
3-
<%= page_header do %>
4-
<%= page_header_back(back_url) %>
5-
<%= page_header_title(@store.name) %>
6-
<%= page_header_actions do %>
7-
<%= render component("ui/button").discard(path: back_url) %>
8-
<%= render component("ui/button").save(form: form_id) %>
9-
<% end %>
1+
<%= page id: :resource_form do %>
2+
<%= page_header do %>
3+
<%= page_header_back(back_url) %>
4+
<%= page_header_title(@store.name) %>
5+
<%= page_header_actions do %>
6+
<%= render component("ui/button").discard(path: back_url) %>
7+
<%= render component("ui/button").save(form: form_id) %>
108
<% end %>
9+
<% end %>
1110

12-
<%= render component("stores/form").new(store: @store, url: form_url, id: form_id) %>
11+
<%= render component("stores/form").new(store: @store, url: form_url, id: form_id) %>
1312

14-
<%= page_footer do %>
15-
<div class="flex justify-between w-full">
16-
<% unless @store.default %>
17-
<%= form_for @store, url: solidus_admin.store_path(@store), method: :delete do %>
18-
<%= render component("ui/button").delete(
19-
"data-controller": "confirm",
20-
"data-confirm-text-value": t("spree.are_you_sure")
21-
) %>
22-
<% end %>
13+
<%= page_footer do %>
14+
<div class="flex justify-between w-full">
15+
<% unless @store.default %>
16+
<%= form_for @store, url: solidus_admin.store_path(@store), method: :delete do %>
17+
<%= render component("ui/button").delete(
18+
"data-controller": "confirm",
19+
"data-confirm-text-value": t("spree.are_you_sure")
20+
) %>
2321
<% end %>
22+
<% end %>
2423

25-
<%= render component("ui/button").save(form: form_id) %>
26-
</div>
27-
<% end %>
24+
<%= render component("ui/button").save(form: form_id) %>
25+
</div>
2826
<% end %>
2927
<% end %>
Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
<%= turbo_frame_tag :resource_form, target: "_top" do %>
2-
<%= page do %>
3-
<%= page_header do %>
4-
<%= page_header_back(back_url) %>
5-
<%= page_header_title(t('.title')) %>
6-
<%= page_header_actions do %>
7-
<%= render component("ui/button").discard(path: back_url) %>
8-
<%= render component("ui/button").save(form: form_id) %>
9-
<% end %>
1+
<%= page id: :resource_form do %>
2+
<%= page_header do %>
3+
<%= page_header_back(back_url) %>
4+
<%= page_header_title(t('.title')) %>
5+
<%= page_header_actions do %>
6+
<%= render component("ui/button").discard(path: back_url) %>
7+
<%= render component("ui/button").save(form: form_id) %>
108
<% end %>
9+
<% end %>
1110

12-
<%= render component("stores/form").new(store: @store, url: form_url, id: form_id) %>
11+
<%= render component("stores/form").new(store: @store, url: form_url, id: form_id) %>
1312

14-
<%= page_footer do %>
15-
<%= render component("ui/button").save(form: form_id) %>
16-
<% end %>
13+
<%= page_footer do %>
14+
<%= render component("ui/button").save(form: form_id) %>
1715
<% end %>
1816
<% end %>

0 commit comments

Comments
 (0)