Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Humanize Page type names.

Matthew Kennedyc4ff1fea2e0d
diff --git a/backend/app/helpers/spree/admin/cms_page_helper.rb b/backend/app/helpers/spree/admin/cms_page_helper.rb
index d36d48d9c8..38837e0fa7 100644
--- a/backend/app/helpers/spree/admin/cms_page_helper.rb
+++ b/backend/app/helpers/spree/admin/cms_page_helper.rb
@@ -31,6 +31,11 @@ module Spree
formatted_types
end
+
+ def humanize_cms_page_type(page)
+ last_word = page.type.split('::', 4).last
+ last_word.gsub(/(?<=[a-z])(?=[A-Z])/, ' ')
+ end
end
end
end
diff --git a/backend/app/views/spree/admin/cms_pages/index.html.erb b/backend/app/views/spree/admin/cms_pages/index.html.erb
index 49faba1837..e670cb8905 100644
--- a/backend/app/views/spree/admin/cms_pages/index.html.erb
+++ b/backend/app/views/spree/admin/cms_pages/index.html.erb
@@ -11,7 +11,7 @@
<table class="table" id="pagesTable">
<thead>
<th scope="col"><%= Spree.t(:title) %></th>
- <th scope="col"><%= Spree.t('admin.pages.kind') %></th>
+ <th scope="col"><%= Spree.t('admin.pages.page_type') %></th>
<th scope="col"><%= Spree.t('store') %></th>
<th scope="col"><%= Spree.t('language') %></th>
<th scope="col"></th>
@@ -23,7 +23,7 @@
<%= page.title %>
</td>
<td>
- <%= page.type %>
+ <%= humanize_cms_page_type(page) %>
</td>
<td>
<%= page.store.unique_name %>