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 section editor, add delete item fade-out, refresh live view.

Matthew Kennedy6dc90c9ea40a
diff --git a/backend/app/assets/javascripts/spree/backend/admin.js b/backend/app/assets/javascripts/spree/backend/admin.js
index c51d997dc6..6a2efbb93c 100644
--- a/backend/app/assets/javascripts/spree/backend/admin.js
+++ b/backend/app/assets/javascripts/spree/backend/admin.js
@@ -68,6 +68,11 @@ $(document).ready(function() {
el.closest('div.menu-item').fadeOut('hide', function() {
$(this).remove()
})
+ el.closest('.removeable').fadeOut('hide', function() {
+ $(this).remove()
+ })
+ const livePreview = document.getElementById('pageLivePreview')
+ if (livePreview) { livePreview.contentWindow.location.reload() }
}
}).fail(function(response) {
show_flash('error', response.responseText)
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 d6e747c2bf..2dc2bcea6d 100644
--- a/backend/app/assets/stylesheets/spree/backend/views/_cms_pages.scss
+++ b/backend/app/assets/stylesheets/spree/backend/views/_cms_pages.scss
@@ -10,7 +10,6 @@
display: none;
}
-
.col-xl, .col-xl-auto, .col-xl-12,
.col-xl-11, .col-xl-10, .col-xl-9,
.col-xl-8, .col-xl-7, .col-xl-6,
@@ -26,9 +25,10 @@
.col-sm-6, .col-sm-5, .col-sm-4, .col-sm-3, .col-sm-2, .col-sm-1, .col,
.col-auto, .col-12, .col-11, .col-10, .col-9, .col-8, .col-7, .col-6,
.col-5, .col-4, .col-3, .col-2, .col-1 {
- padding-right: 5px;
- padding-left: 5px;
+ padding-right: 7.5px;
+ padding-left: 7.5px;
}
+
.cms_section_preview_image_holder {
position: relative;
border: 1px solid $border-color;
@@ -54,8 +54,13 @@
}
.cms_section_action_col {
- max-width: 42px;
+ max-width: 34px;
text-align: center;
+
+ a.btn-sm {
+ margin: 0;
+ border-radius: 0;
+ }
}
.v-seperator {
@@ -114,6 +119,3 @@ body.cmsSectionFullScreenMode {
left: 28%;
}
}
-
-@include media-breakpoint-up(lg) { }
-@include media-breakpoint-up(xl) { }
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 e5fb93519b..d4d4abea16 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,6 +1,6 @@
-<div class="<%= width %>" data-section-id="<%= section.id %>">
+<div class="<%= width %> removeable" 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">
+ <div class="col move-handle d-flex flex-nowrap pr-0">
<div class="d-flex align-items-center overflow-hidden w-100">
<div>
@@ -11,7 +11,7 @@
</div>
</div>
- <div class="col d-flex align-items-center actions cms_section_action_col">
+ <div class="col d-flex p-0 align-items-center actions cms_section_action_col">
<div>
<%= 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) %>
diff --git a/backend/app/views/spree/admin/cms_pages/edit.html.erb b/backend/app/views/spree/admin/cms_pages/edit.html.erb
index f38d7c4fc5..df1015a7d3 100644
--- a/backend/app/views/spree/admin/cms_pages/edit.html.erb
+++ b/backend/app/views/spree/admin/cms_pages/edit.html.erb
@@ -33,7 +33,7 @@
</div>
<div class="ml-2">
- <button id="cmsSectionEditorFullScreen" type="button" class="btn btn-outline-primary" data-toggle="button" autocomplete="off">Full Screen Mode</button>
+ <button id="cmsSectionEditorFullScreen" type="button" class="btn btn-outline-primary no-wrap" data-toggle="button" autocomplete="off">Full Screen Mode</button>
</div>
</div>
</div>