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.

Improve Live View Section Editor.

Matthew Kennedy044309405515
diff --git a/backend/app/assets/images/backend-mobile.svg b/backend/app/assets/images/backend-mobile.svg
new file mode 100644
index 0000000000..11a2a2f896
--- /dev/null
+++ b/backend/app/assets/images/backend-mobile.svg
@@ -0,0 +1,5 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
+ <path d="M298.667 25.6h-85.333c-4.71 0-8.533 3.823-8.533 8.533 0 4.71 3.823 8.533 8.533 8.533h85.333c4.71 0 8.533-3.823 8.533-8.533 0-4.71-3.823-8.533-8.533-8.533zM358.4 25.6h-8.533c-4.71 0-8.533 3.823-8.533 8.533 0 4.71 3.823 8.533 8.533 8.533h8.533c4.71 0 8.533-3.823 8.533-8.533 0-4.71-3.823-8.533-8.533-8.533zM266.598 435.2H245.41c-12.979 0-23.543 10.564-23.543 23.543v4.122c0 12.979 10.564 23.535 23.535 23.535h21.188c12.979 0 23.543-10.556 23.543-23.535v-4.122c0-12.979-10.564-23.543-23.535-23.543zm6.469 27.665c0 3.567-2.901 6.468-6.468 6.468H245.41c-3.575 0-6.477-2.901-6.477-6.468v-4.122c0-3.575 2.901-6.477 6.477-6.477h21.18c3.576 0 6.477 2.901 6.477 6.477v4.122z"/>
+ <path d="M370.227 0H141.781c-17.007 0-30.848 13.841-30.848 30.848v450.304c0 17.007 13.841 30.848 30.848 30.848h228.437c17.007 0 30.848-13.841 30.848-30.839V30.848C401.067 13.841 387.226 0 370.227 0zM384 481.152c0 7.595-6.178 13.781-13.773 13.781H141.781c-7.603 0-13.781-6.187-13.781-13.773V30.848c0-7.595 6.178-13.781 13.781-13.781h228.437c7.603 0 13.781 6.187 13.781 13.781v450.304z"/>
+ <path d="M392.533 51.2H119.467c-4.71 0-8.533 3.823-8.533 8.533v358.4c0 4.71 3.823 8.533 8.533 8.533h273.067c4.71 0 8.533-3.823 8.533-8.533v-358.4c0-4.71-3.823-8.533-8.534-8.533zM384 409.6H128V68.267h256V409.6z"/>
+</svg>
diff --git a/backend/app/assets/stylesheets/spree/backend/shared/_base.scss b/backend/app/assets/stylesheets/spree/backend/shared/_base.scss
index aef18e044e..5644b91e9a 100644
--- a/backend/app/assets/stylesheets/spree/backend/shared/_base.scss
+++ b/backend/app/assets/stylesheets/spree/backend/shared/_base.scss
@@ -40,6 +40,12 @@
color: rgba(0, 0, 0, 0.50);
}
+.truncate {
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
[data-show-info] {
color: $primary;
cursor: pointer;
diff --git a/backend/app/assets/stylesheets/spree/backend/views/_cms_pages.scss b/backend/app/assets/stylesheets/spree/backend/views/_cms_pages.scss
index e94f7860c7..e7445aca43 100644
--- a/backend/app/assets/stylesheets/spree/backend/views/_cms_pages.scss
+++ b/backend/app/assets/stylesheets/spree/backend/views/_cms_pages.scss
@@ -4,6 +4,10 @@
max-height: 553px;
padding-top: 5px !important;
+ .border {
+ border-color: #9c9c9c !important;
+ }
+
// Hide scroll-bar in live preview
// sidebar.
-ms-overflow-style: none; /* IE and Edge */
@@ -51,9 +55,12 @@
}
.edge {
+ padding-left: 0;
+ padding-right: 0;
div.row {
border-left: none !important;
border-right: none !important;
+
}
}
@@ -62,8 +69,14 @@
text-align: center;
a.btn-sm {
+ height: 100%;
+ display: flex;
margin: 0;
border-radius: 0;
+ svg {
+ align-self: center;
+ margin: 0;
+ }
}
}
diff --git a/backend/app/helpers/spree/admin/cms_helper.rb b/backend/app/helpers/spree/admin/cms_helper.rb
index 5b2c88d3d6..4e22592b4e 100644
--- a/backend/app/helpers/spree/admin/cms_helper.rb
+++ b/backend/app/helpers/spree/admin/cms_helper.rb
@@ -11,7 +11,7 @@ module Spree
boundary = case section.boundary
when 'Screen'
- 'px-0 edge'
+ 'edge'
else
''
end
diff --git a/backend/app/views/spree/admin/cms_pages/_section_template.html.erb b/backend/app/views/spree/admin/cms_pages/_section_template.html.erb
index fc22bd2e98..500100634f 100644
--- a/backend/app/views/spree/admin/cms_pages/_section_template.html.erb
+++ b/backend/app/views/spree/admin/cms_pages/_section_template.html.erb
@@ -1,18 +1,19 @@
<div class="<%= width %> <%= boundary %> removable-dom-element" data-section-id="<%= section.id %>">
- <div class="row m-0 mb-1 pb-0 border bg-white">
- <div class="col move-handle d-flex flex-nowrap pr-0">
-
- <div class="d-flex align-items-center overflow-hidden w-100">
- <div>
- <h6 class="mb-0"><small><%= section.name %></small></h6>
- <small class="form-text text-muted mt-0">Type: <%= spree_humanize_type(section.type) %></small>
- </div>
-
+ <div class="row m-0 mb-1 pb-0 border border-secondary bg-white">
+ <div class="col move-handle d-flex pr-0 truncate">
+ <div class="<% if section.full_width_on_small %>py-2<% else %>py-3<% end %> align-items-center overflow-hidden w-100">
+ <h6 class="m-0"><%= section.name %></h6>
+ <small class="form-text mt-0 text-muted"><%= spree_humanize_type(section.type) %></small>
+ <% if section.full_width_on_small %>
+ <small class="form-text mt-1">
+ <%= svg_icon name: "mobile.svg", width: '23', height: '23' %>
+ Full-width
+ </small>
+ <% end %>
</div>
</div>
-
- <div class="col d-flex p-0 align-items-center actions cms_section_action_col">
- <div>
+ <div>
+ <div class="col h-100 d-flex flex-column align-self-sm-stretch p-0 justify-content-between actions cms_section_action_col">
<%= link_to_edit(section, no_text: true, url: spree.edit_admin_cms_page_cms_section_path(@cms_page, section)) %>
<%= link_to_delete(section, no_text: true, url: spree.admin_cms_page_cms_section_path(@cms_page, section)) if can?(:destroy, section) %>
</div>
diff --git a/frontend/app/controllers/spree/home_controller.rb b/frontend/app/controllers/spree/home_controller.rb
index 7b99be25e3..c858a2ca9b 100644
--- a/frontend/app/controllers/spree/home_controller.rb
+++ b/frontend/app/controllers/spree/home_controller.rb
@@ -29,7 +29,7 @@ module Spree
end
def last_modified_index
- page_last_modified = @cms_home_page.maximum(:updated_at)&.utc if @cms_home_page.respond_to?(:maximum)
+ page_last_modified = @cms_home_page.maximum(:updated_at)&.utc if @cms_home_page.respond_to?(:maximum)
current_store_last_modified = current_store.updated_at.utc
[page_last_modified, current_store_last_modified].compact.max