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.

Improvements to live view.

Matthew Kennedy5e9ead76cc36
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 a83075c826..d47638cb39 100644
--- a/backend/app/assets/stylesheets/spree/backend/views/_cms_pages.scss
+++ b/backend/app/assets/stylesheets/spree/backend/views/_cms_pages.scss
@@ -1,6 +1,24 @@
#cmsPagesectionsArea {
+ .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,
+ .col-xl-5, .col-xl-4, .col-xl-3,
+ .col-xl-2, .col-xl-1, .col-lg,
+ .col-lg-auto, .col-lg-12, .col-lg-11,
+ .col-lg-10, .col-lg-9, .col-lg-8, .col-lg-7,
+ .col-lg-6, .col-lg-5, .col-lg-4, .col-lg-3, .col-lg-2,
+ .col-lg-1, .col-md, .col-md-auto, .col-md-12, .col-md-11,
+ .col-md-10, .col-md-9, .col-md-8, .col-md-7, .col-md-6, .col-md-5,
+ .col-md-4, .col-md-3, .col-md-2, .col-md-1, .col-sm, .col-sm-auto,
+ .col-sm-12, .col-sm-11, .col-sm-10, .col-sm-9, .col-sm-8, .col-sm-7,
+ .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: 2.5px;
+ padding-left: 2.5px;
+ }
.cms_section_preview_image_holder {
- position: relative;
+ position: relative;
border: 1px solid $border-color;
border-radius: 7px;
overflow: hidden;
@@ -24,7 +42,7 @@
}
.cms_section_action_col {
- max-width: 50px;
+ max-width: 42px;
text-align: center;
}
@@ -34,8 +52,6 @@
}
#pageLivePreview {
- border: 4px solid grey;
- border-radius: 15px;
transform-origin: top left;
}
@@ -49,24 +65,18 @@
.tabletLiveView {
#pageLivePreview {
- border: 3px solid grey;
- width: 100%;
+ width: 85%;
height: 133%;
transform: scale(0.75);
- left: 16%;
+ left: 19%;
}
}
.mobileLiveView {
- .embed-responsive-4by3::before {
- padding-top: 530px;
- }
- #pageLivePreview {
- border: 2px solid grey;
- width: 325px;
- height: 530px;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%)
+ #pageLivePreview {
+ width: 60%;
+ height: 133%;
+ transform: scale(0.75);
+ left: 28%;
}
}
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 6b0a60ffe9..e5fb93519b 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,24 +1,17 @@
<div class="<%= width %>" data-section-id="<%= section.id %>">
- <div class="row m-0 mb-3 py-3 border bg-white">
+ <div class="row m-0 mb-1 pb-0 border bg-white">
<div class="col move-handle d-flex flex-nowrap">
<div class="d-flex align-items-center overflow-hidden w-100">
<div>
- <h5 class="mb-0"><%= section.name %></h5>
+ <h6 class="mb-0"><small><%= section.name %></small></h6>
<small class="form-text text-muted mt-0">Type: <%= humanize_cms_type(section) %></small>
</div>
- <div class="ml-4 pl-4 v-seperator">
- <% if section.icon.present? %>
- <div class="cms_section_preview_image_holder">
- <%= image_tag main_app.url_for(section.icon.attachment) %>
- </div>
- <% end %>
- </div>
- </div>
</div>
+ </div>
- <div class="col d-flex align-items-center pl-0 actions cms_section_action_col">
+ <div class="col d-flex 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 60032d84af..ff123f2fdc 100644
--- a/backend/app/views/spree/admin/cms_pages/edit.html.erb
+++ b/backend/app/views/spree/admin/cms_pages/edit.html.erb
@@ -14,44 +14,45 @@
<% if @cms_page.sections? %>
<div id="pageSectionsArea" class="col-12">
<div class="row">
- <div class="col-12">
- <hr class="mb-5">
- <h5 class="mb-0">
- <%= Spree.t('admin.cms.page_sections', page_name: @cms_page.title) %>
- </h5>
+ <div class="col d-flex justify-content-start">
+ <%= button_link_to Spree.t('admin.pages.add_new_section'), spree.new_admin_cms_page_cms_section_path(@cms_page), icon: 'add.svg', class: 'no-wrap btn btn-success align-self-center' %>
+ </div>
+ <div class="col d-flex justify-content-end">
+ <div id="LiveViewSwitcher" class="btn-group btn-group-toggle" data-toggle="buttons">
+ <label class="btn btn-outline-primary active">
+ <input type="radio" name="options" id="mobileLiveView" autocomplete="off"> Mobile
+ </label>
+ <label class="btn btn-outline-primary">
+ <input type="radio" name="options" id="tabletLiveView" autocomplete="off"> Tablet
+ </label>
+ <label class="btn btn-outline-primary">
+ <input type="radio" name="options" id="desktopLiveView" autocomplete="off" checked> Desktop
+ </label>
+ </div>
</div>
</div>
- <div class="row">
- <div class="col-12 col-md-3">
- <div class="card mb-3">
- <div class="card-header">
- <div class="row pb-0">
- <div class="col d-flex justify-content-end">
- <%= button_link_to Spree.t('admin.pages.add_new_section'), spree.new_admin_cms_page_cms_section_path(@cms_page), icon: 'add.svg', class: 'no-wrap btn btn-success align-self-center' %>
- </div>
- </div>
+ <div class="row no-gutters">
+ <div class="col-12 col-md-4 bg-light border">
+ <% if @cms_page.cms_sections.any? %>
+ <div id="cmsPagesectionsArea" class="card-body row m-0 p-0 no-gutters">
+ <% @cms_page.cms_sections.each do |section| %>
+ <%= build_page_section(section) %>
+ <% end %>
</div>
- <% if @cms_page.cms_sections.any? %>
- <div id="cmsPagesectionsArea" class="card-body row m-0 p-0 py-3 bg-light">
- <% @cms_page.cms_sections.each do |section| %>
- <%= build_page_section(section) %>
- <% end %>
- </div>
- <% else %>
- <div class="row">
- <div class="col-12">
- <div class="alert alert-info no-objects-found m-4">
- <%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::CmsSection)) %>
- <%= link_to Spree.t(:add_one), new_object_url if can?(:create, Spree::CmsSection) %>
- </div>
+ <% else %>
+ <div class="row">
+ <div class="col-12">
+ <div class="alert alert-info no-objects-found m-4">
+ <%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::CmsSection)) %>
+ <%= link_to Spree.t(:add_one), new_object_url if can?(:create, Spree::CmsSection) %>
</div>
</div>
- <% end %>
- </div>
+ </div>
+ <% end %>
</div>
- <div class="d-none d-md-block col-9">
+ <div class="d-none d-md-block col-8 bg-secondary border">
<div id="liveViewCont" class="desktopLiveView">
<div class="embed-responsive embed-responsive-4by3">
<iframe class="embed-responsive-item"
@@ -61,22 +62,8 @@
</iframe>
</div>
</div>
-
- <div class="d-flex justify-content-center mt-3">
- <div id="LiveViewSwitcher" class="btn-group btn-group-toggle" data-toggle="buttons">
- <label class="btn btn-outline-primary active">
- <input type="radio" name="options" id="mobileLiveView" autocomplete="off"> Mobile
- </label>
- <label class="btn btn-outline-primary">
- <input type="radio" name="options" id="tabletLiveView" autocomplete="off"> Tablet
- </label>
- <label class="btn btn-outline-primary">
- <input type="radio" name="options" id="desktopLiveView" autocomplete="off" checked> Desktop
- </label>
- </div>
- </div>
-
</div>
+
</div>
</div>
<% end %>
diff --git a/backend/app/views/spree/layouts/admin.html.erb b/backend/app/views/spree/layouts/admin.html.erb
index 29b859d649..4534d6263a 100644
--- a/backend/app/views/spree/layouts/admin.html.erb
+++ b/backend/app/views/spree/layouts/admin.html.erb
@@ -35,7 +35,7 @@
<%# Content %>
<%#-------------------------------------------------%>
<main class="col-12 col-lg-9 col-xl-10 offset-lg-3 offset-xl-2 main" id="main-part">
- <div class="container">
+ <div class="container-lg">
<%#-------------------------------------------------%>
<%# Content header (page title/actions) %>