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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Update
Matthew Kennedya71185b96e12
diff --git a/backend/app/assets/javascripts/spree/backend/global/_index.js b/backend/app/assets/javascripts/spree/backend/global/_index.jsindex 88f3cdeebb..2f77f35421 100644--- a/backend/app/assets/javascripts/spree/backend/global/_index.js+++ b/backend/app/assets/javascripts/spree/backend/global/_index.js@@ -7,3 +7,4 @@//= require spree/backend/global/select2_autocomplete//= require spree/backend/global/select2_populate//= require spree/backend/global/sortable+//= require spree/backend/global/tinymcediff --git a/backend/app/assets/javascripts/spree/backend/global/tinymce.es6 b/backend/app/assets/javascripts/spree/backend/global/tinymce.es6new file mode 100644index 0000000000..64e5fe55c8--- /dev/null+++ b/backend/app/assets/javascripts/spree/backend/global/tinymce.es6@@ -0,0 +1,11 @@+document.addEventListener('DOMContentLoaded', function() {+ // eslint-disable-next-line no-undef+ tinymce.init({+ selector: '.spree-rte',+ plugins: [+ 'image table paste code'+ ],+ menubar: false,+ toolbar: 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | code '+ });+})diff --git a/backend/app/assets/stylesheets/spree/backend/views/_cms_pages.scss b/backend/app/assets/stylesheets/spree/backend/views/_cms_pages.scssindex 015dca007a..e9c2a50f6e 100644--- a/backend/app/assets/stylesheets/spree/backend/views/_cms_pages.scss+++ b/backend/app/assets/stylesheets/spree/backend/views/_cms_pages.scss@@ -1,3 +1,34 @@-.cms_section_preview_image_holder img {- max-width: 100%;+#cmsPagesectionsArea {+ .cms_section_preview_image_holder {+ position: relative;+ border: 1px solid $border-color;+ border-radius: 7px;+ overflow: hidden;+ width: 75px;+ height: 75px;+ img {+ position: absolute;+ left: 50%;+ top: 50%;+ height: 100%;+ width: auto;+ transform: translate(-50%,-50%);+ }+ }++ .edge {+ div.row {+ border-left: none !important;+ border-right: none !important;+ }+ }++ .cms_section_action_col {+ max-width: 50px;+ text-align: center;+ }++ .v-seperator {+ border-left: 1px solid #dee2e6;+ }}diff --git a/backend/app/helpers/spree/admin/cms_page_helper.rb b/backend/app/helpers/spree/admin/cms_page_helper.rbindex 6e5f8a2408..991b321a95 100644--- a/backend/app/helpers/spree/admin/cms_page_helper.rb+++ b/backend/app/helpers/spree/admin/cms_page_helper.rb@@ -5,13 +5,15 @@ module Spreepreview_type = section.kind.parameterize(separator: '_')case section.width- when 'Full'- css_width = 'col-12'when 'Half'css_width = 'col-6'+ when 'Full'+ css_width = 'col-12'+ when 'Edge-to-Edge'+ css_width = 'col-12 px-0 edge'end- render "spree/admin/cms_pages/sections/#{preview_type}", section: section, width: css_width+ render "spree/admin/cms_pages/section_template", section: section, width: css_widthenddef linkable_as_path(item)diff --git a/backend/app/views/spree/admin/cms_pages/_form.html.erb b/backend/app/views/spree/admin/cms_pages/_form.html.erbindex 4215a44467..677a386825 100644--- a/backend/app/views/spree/admin/cms_pages/_form.html.erb+++ b/backend/app/views/spree/admin/cms_pages/_form.html.erb@@ -2,7 +2,7 @@<div class="col-12 col-md-8"><%= f.field_container :content, class: ['form-group'] do %><%= f.label :content, Spree.t(:content) %>- <%= f.text_area :content, { rows: 26} %>+ <%= f.text_area :content, { rows: 26, class: 'spree-rte'} %><%= f.error_message_on :content %><% end %></div>@@ -20,6 +20,7 @@<%= f.error_message_on :kind %><% end %>+ <hr class="mt-5"><%= f.field_container :cms_page_stores, class: ['form-group'] do %><%= label_tag :cms_page_stores, Spree.t(:stores) %><%= collection_select(:cms_page, :store_id, @stores, :id, :unique_name, {}, { class: 'select2' }) %>@@ -59,15 +60,3 @@<% end %></div></div>--<script type="text/javascript">- tinymce.init({- selector: "#cms_page_content",- plugins: [- "image table paste code",- ],- menubar: false,- toolbar:- "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | code ",- });-</script>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.erbnew file mode 100644index 0000000000..b3f6668fea--- /dev/null+++ b/backend/app/views/spree/admin/cms_pages/_section_template.html.erb@@ -0,0 +1,28 @@+<div class="<%= width %>" data-section-id="<%= section.id %>">+ <div class="row m-0 mb-3 py-3 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>+ <small class="form-text text-muted mt-0">Type: <%= section.kind %></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 class="col d-flex align-items-center pl-0 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) %>+ </div>+ </div>+ </div>+</div>diff --git a/backend/app/views/spree/admin/cms_pages/edit.html.erb b/backend/app/views/spree/admin/cms_pages/edit.html.erbindex 84714b7261..f33dcd8e01 100644--- a/backend/app/views/spree/admin/cms_pages/edit.html.erb+++ b/backend/app/views/spree/admin/cms_pages/edit.html.erb@@ -33,14 +33,13 @@<% unless @cms_page.kind == "Standard Page" %><div id="pageSectionsArea">- <div class="row mt-2">+ <div class="row mt-5"><div class="col-12"><div class="card mb-3"><div class="card-header"><div class="row pb-0">- <div class="col">+ <div class="d-flex pl-3"><h5 class="mb-0 align-self-center"> <%= Spree.t('admin.cms.page_sections', page_name: @cms_page.title) %></h5>- <small><%= Spree.t('admin.cms.page_sections_info', page_type: @cms_page.kind, store: @cms_page.store.unique_name ) %></small></div><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' %>diff --git a/backend/app/views/spree/admin/cms_pages/sections/_featured_atricle.html.erb b/backend/app/views/spree/admin/cms_pages/sections/_featured_atricle.html.erbnew file mode 100644index 0000000000..6d01b42d9d--- /dev/null+++ b/backend/app/views/spree/admin/cms_pages/sections/_featured_atricle.html.erb@@ -0,0 +1,22 @@+<div class="<%= width %>" data-section-id="<%= section.id %>">+ <div class="row m-0 p-0 py-3 mb-3 border bg-white">+ <div class="col" style="width:30px; max-width: 70px; text-align: center;">+ <span class="move-handle"><%= svg_icon(name: 'sort.svg', width: '20', height: '20') %></span>+ </div>+ <div class="col text-center">+ <div>Name: <%= section.name %></div>+ <div>Type: <%= section.kind %></div>+ <div class="m-auto" style="width:50px;">+ <% 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 class="col actions" style="width:30px; max-width: 70px; text-align: center;">+ <%= 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>+ </div>+</div>diff --git a/backend/app/views/spree/admin/cms_pages/sections/_promo.html.erb b/backend/app/views/spree/admin/cms_pages/sections/_promo.html.erbindex 6d01b42d9d..b47f1509be 100644--- a/backend/app/views/spree/admin/cms_pages/sections/_promo.html.erb+++ b/backend/app/views/spree/admin/cms_pages/sections/_promo.html.erb@@ -1,9 +1,9 @@<div class="<%= width %>" data-section-id="<%= section.id %>"><div class="row m-0 p-0 py-3 mb-3 border bg-white">- <div class="col" style="width:30px; max-width: 70px; text-align: center;">+ <div class="col p-0 cms_section_action_col"><span class="move-handle"><%= svg_icon(name: 'sort.svg', width: '20', height: '20') %></span></div>- <div class="col text-center">+ <div class="col text-center p-0"><div>Name: <%= section.name %></div><div>Type: <%= section.kind %></div><div class="m-auto" style="width:50px;">@@ -14,7 +14,7 @@<% end %></div></div>- <div class="col actions" style="width:30px; max-width: 70px; text-align: center;">+ <div class="col p-0 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/backend/app/views/spree/admin/cms_pages/sections/_text_block.html.erb b/backend/app/views/spree/admin/cms_pages/sections/_text_block.html.erbindex f20f267c96..1d0ac76302 100644--- a/backend/app/views/spree/admin/cms_pages/sections/_text_block.html.erb+++ b/backend/app/views/spree/admin/cms_pages/sections/_text_block.html.erb@@ -1,13 +1,20 @@<div class="<%= width %>" data-section-id="<%= section.id %>"><div class="row m-0 p-0 py-3 mb-3 border bg-white">- <div class="col" style="width:30px; max-width: 70px; text-align: center;">+ <div class="col p-0 cms_section_action_col"><span class="move-handle"><%= svg_icon(name: 'sort.svg', width: '20', height: '20') %></span></div>- <div class="col text-center">+ <div class="col text-center p-0"><div>Name: <%= section.name %></div><div>Type: <%= section.kind %></div>+ <div class="m-auto">+ <% 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 class="col actions" style="width:30px; max-width: 70px; text-align: center;">+ <div class="col p-0 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/backend/app/views/spree/admin/cms_sections/_form.html.erb b/backend/app/views/spree/admin/cms_sections/_form.html.erbindex 9bb1a7a3dc..d55563ef13 100644--- a/backend/app/views/spree/admin/cms_sections/_form.html.erb+++ b/backend/app/views/spree/admin/cms_sections/_form.html.erb@@ -7,14 +7,14 @@</div><div class="card-body"><div class="row">- <div class="col-6">+ <div class="col-12 col-md-6"><%= f.field_container :name, class: ['form-group'] do %><%= f.label :name, raw(Spree.t(:name) + required_span_tag) %><%= f.text_field :name, class: 'form-control', required: true %><%= f.error_message_on :name %><% end %></div>- <div class="col-6">+ <div class="col-12 col-md-6"><%= f.field_container :kind, class: ['form-group'] do %><%= f.label :kind, Spree.t('admin.navigation.section_type') %><%= f.select(:kind, @cms_section_types, {include_blank: false}) %>diff --git a/backend/app/views/spree/admin/cms_sections/_link_inputx.html.erb b/backend/app/views/spree/admin/cms_sections/_link_inputx.html.erbdeleted file mode 100644index f8e7bae951..0000000000--- a/backend/app/views/spree/admin/cms_sections/_link_inputx.html.erb+++ /dev/null@@ -1,54 +0,0 @@-<div id="linkResourcePanel" data-panel-type="<%= @cms_section.linked_resource_type %>">-<% resorce_holder = [] %>-<% id_holder = nil %>-<% name_holder = nil %>-<% active_id_holder = nil %>--<% if @cms_section.linked_resource_type == 'Spree::Taxon' %>- <% label_text = Spree.t('taxon') %>-- <% if @cms_section.linked_resource %>- <% resorce_holder = [@cms_section.linked_resource] %>- <% id_holder = :id %>- <% name_holder = :pretty_name %>- <% active_id_holder = @cms_section.linked_resource.id %>- <% end %>-- <script>- document.addEventListener('DOMContentLoaded', function() {- $('.autocomplete').select2Autocomplete({- data_attrbute_name: 'taxons',- placeholder: "<%= Spree.t('admin.navigation.seach_for_a_taxon') %>",- allow_clear: true,- apiUrl: Spree.routes.taxons_api_v2,- return_attribute: 'pretty_name',- })- })- </script>-<% elsif @cms_section.linked_resource_type == 'Spree::Product' %>- <% label_text = Spree.t('product') %>- <% if @cms_section.linked_resource %>- <% resorce_holder = [@cms_section.linked_resource] %>- <% id_holder = :id %>- <% name_holder = :name %>- <% active_id_holder = @cms_section.linked_resource.id %>- <% end %>-- <script>- document.addEventListener('DOMContentLoaded', function() {- $('.autocomplete').select2Autocomplete({- data_attrbute_name: 'products',- placeholder: "<%= Spree.t('admin.navigation.seach_for_a_product') %>",- allow_clear: true,- apiUrl: Spree.routes.products_api_v2,- })- })- </script>-<% end %>--<%= f.field_container :linked_resource_id, class: ['form-group'] do %>- <%= f.label :linked_resource_id, label_text %>- <%= f.select :linked_resource_id, options_from_collection_for_select(resorce_holder, id_holder, name_holder, active_id_holder), { include_blank: true }, class: 'autocomplete' %>- <%= f.error_message_on :linked_resource_id %>-<% end %>-</div>diff --git a/backend/app/views/spree/admin/cms_sections/linked_resorce_forms.html.erb/_ptoduct.html.erb b/backend/app/views/spree/admin/cms_sections/linked_resorce_forms.html.erb/_ptoduct.html.erbdeleted file mode 100644index 772e7b2e3a..0000000000--- a/backend/app/views/spree/admin/cms_sections/linked_resorce_forms.html.erb/_ptoduct.html.erb+++ /dev/null@@ -1 +0,0 @@-_ptoduct.html.erbdiff --git a/backend/app/views/spree/admin/cms_sections/linked_resorce_forms.html.erb/_taxon.html.erb b/backend/app/views/spree/admin/cms_sections/linked_resorce_forms.html.erb/_taxon.html.erbdeleted file mode 100644index d210710427..0000000000--- a/backend/app/views/spree/admin/cms_sections/linked_resorce_forms.html.erb/_taxon.html.erb+++ /dev/null@@ -1 +0,0 @@-_taxon.html.erbdiff --git a/backend/app/views/spree/admin/cms_sections/types/_featured_atricle.html.erb b/backend/app/views/spree/admin/cms_sections/types/_featured_atricle.html.erbnew file mode 100644index 0000000000..5dd4478ed0--- /dev/null+++ b/backend/app/views/spree/admin/cms_sections/types/_featured_atricle.html.erb@@ -0,0 +1,44 @@+<div class="row">+ <div class="col-12 col-md-6">+ <%= f.field_container :title, class: ['form-group'] do %>+ <%= f.label :title, Spree.t(:title) %>+ <%= f.text_field :title, class: 'form-control' %>+ <%= f.error_message_on :title %>+ <% end %>++ <%= f.field_container :subtitle, class: ['form-group'] do %>+ <%= f.label :subtitle, Spree.t(:subtitle) %>+ <%= f.text_field :subtitle, class: 'form-control' %>+ <%= f.error_message_on :subtitle %>+ <% end %>++ <%= f.field_container :button_text, class: ['form-group'] do %>+ <%= f.label :button_text, Spree.t(:button_text) %>+ <%= f.text_field :button_text, class: 'form-control' %>+ <%= f.error_message_on :button_text %>+ <% end %>++ <%= f.field_container :width, class: ['form-group'] do %>+ <%= f.label :width, Spree.t('admin.navigation.width') %>+ <%= f.select(:width, @cms_section_widths, {include_blank: false}, class: 'select2') %>+ <%= f.error_message_on :width %>+ <% end %>+ </div>+ <div class="col-12 col-md-6">+ <%= f.field_container :content, class: ['form-group'] do %>+ <%= f.text_area :content, { rows: "20", class: 'form-control spree-rte' } %>+ <%= f.error_message_on :content %>+ <% end %>+ </div>+ <div class="col-12"><hr></div>+ <div class="col-12 col-md-6">+ <%= f.field_container :linked_resource_type, class: ['form-group'] do %>+ <%= f.label :linked_resource_type, Spree.t('admin.navigation.link_to') %>+ <%= f.select(:linked_resource_type, @cms_section_links_to, {include_blank: false}, class: 'link_switcher') %>+ <%= f.error_message_on :linked_resource_type %>+ <% end %>+ </div>+ <div class="col-12 col-md-6">+ <%= render "spree/admin/shared/link_switcher", resource: @cms_section, f: f %>+ </div>+</div>diff --git a/backend/app/views/spree/admin/cms_sections/types/_hero.html.erb b/backend/app/views/spree/admin/cms_sections/types/_hero.html.erbindex 8e8ebeffee..3ea1aa713d 100644--- a/backend/app/views/spree/admin/cms_sections/types/_hero.html.erb+++ b/backend/app/views/spree/admin/cms_sections/types/_hero.html.erb@@ -1,5 +1,5 @@<div class="row">- <div class="col-6">+ <div class="col-12 col-md-6"><%= f.field_container :title, class: ['form-group'] do %><%= f.label :title, Spree.t(:title) %><%= f.text_field :title, class: 'form-control' %>@@ -18,7 +18,7 @@<%= f.error_message_on :subtitle %><% end %></div>- <div class="col-6">+ <div class="col-12 col-md-6"><% @cms_section.build_icon unless @cms_section.icon %><%= f.fields_for :icon do |icon_field| %><%= f.field_container :icon_attachment do %>@@ -44,14 +44,14 @@<% end %></div><div class="col-12"><hr></div>- <div class="col-6">+ <div class="col-12 col-md-6"><%= f.field_container :linked_resource_type, class: ['form-group'] do %><%= f.label :linked_resource_type, Spree.t('admin.navigation.link_to') %><%= f.select(:linked_resource_type, @cms_section_links_to, {include_blank: false}, class: 'link_switcher') %><%= f.error_message_on :linked_resource_type %><% end %></div>- <div class="col-6">+ <div class="col-12 col-md-6"><%= render "spree/admin/shared/link_switcher", resource: @cms_section, f: f %></div></div>diff --git a/backend/app/views/spree/admin/cms_sections/types/_promo.html.erb b/backend/app/views/spree/admin/cms_sections/types/_promo.html.erbindex 1f83985ed3..6d93042703 100644--- a/backend/app/views/spree/admin/cms_sections/types/_promo.html.erb+++ b/backend/app/views/spree/admin/cms_sections/types/_promo.html.erb@@ -1,53 +1,57 @@-<%= f.field_container :title, class: ['form-group'] do %>- <%= f.label :title, Spree.t(:title) %>- <%= f.text_field :title, class: 'form-control' %>- <%= f.error_message_on :title %>-<% end %>+<div class="row">+ <div class="col-12 col-md-6">+ <%= f.field_container :title, class: ['form-group'] do %>+ <%= f.label :title, Spree.t(:title) %>+ <%= f.text_field :title, class: 'form-control' %>+ <%= f.error_message_on :title %>+ <% end %>-<%= f.field_container :subtitle, class: ['form-group'] do %>- <%= f.label :subtitle, Spree.t(:subtitle) %>- <%= f.text_field :subtitle, class: 'form-control' %>- <%= f.error_message_on :subtitle %>-<% end %>+ <%= f.field_container :subtitle, class: ['form-group'] do %>+ <%= f.label :subtitle, Spree.t(:subtitle) %>+ <%= f.text_field :subtitle, class: 'form-control' %>+ <%= f.error_message_on :subtitle %>+ <% end %>-<% @cms_section.build_icon unless @cms_section.icon %>- <%= f.fields_for :icon do |icon_field| %>- <%= f.field_container :icon_attachment do %>- <% unless @cms_section.icon.new_record? %>- <div id="menuItemImgContainer" class="my-3 ">- <%= image_tag(main_app.url_for(@cms_section.icon.attachment)) %>- <%#= link_to Spree.t(:remove_image), remove_icon_admin_menu_menu_item_path(@cms_page, @cms_section), method: :delete %>+ <%= f.field_container :width, class: ['form-group'] do %>+ <%= f.label :width, Spree.t('admin.navigation.width') %>+ <%= f.select(:width, @cms_section_widths, {include_blank: false}, class: 'select2') %>+ <%= f.error_message_on :width %>+ <% end %>+ </div>+ <div class="col-12 col-md-6">+ <% @cms_section.build_icon unless @cms_section.icon %>+ <%= f.fields_for :icon do |icon_field| %>+ <%= f.field_container :icon_attachment do %>+ <% unless @cms_section.icon.new_record? %>+ <div id="menuItemImgContainer" class="my-3 ">+ <%= image_tag(main_app.url_for(@cms_section.icon.attachment)) %>+ <%#= link_to Spree.t(:remove_image), remove_icon_admin_menu_menu_item_path(@cms_page, @cms_section), method: :delete %>+ </div>+ <% end %>+ <div id="<% unless @cms_section.icon.new_record? %>MenuItemImageButton<% end %>">+ <%= icon_field.file_field :attachment %></div><% end %>- <div id="<% unless @cms_section.icon.new_record? %>MenuItemImageButton<% end %>">- <%= icon_field.file_field :attachment %>- </div>- <% end %>- <%= f.field_container :icon_alt do %>- <% unless @cms_section.icon.new_record? %>- <div class="form-group my-3">- <%= icon_field.label :alt, Spree.t('admin.navigation.image_alt_text') %>- <%= icon_field.text_field :alt, class: 'form-control' %>- </div>+ <%= f.field_container :icon_alt do %>+ <% unless @cms_section.icon.new_record? %>+ <div class="form-group my-3">+ <%= icon_field.label :alt, Spree.t('admin.navigation.image_alt_text') %>+ <%= icon_field.text_field :alt, class: 'form-control' %>+ </div>+ <% end %>+ <% end %><% end %>- <% end %>-<% end %>--<%= f.field_container :linked_resource_type, class: ['form-group'] do %>- <%= f.label :linked_resource_type, Spree.t('admin.navigation.link_to') %>- <%= f.select(:linked_resource_type, @cms_section_links_to, {include_blank: false}) %>- <%= f.error_message_on :linked_resource_type %>-<% end %>--<%= render 'link_inputx', linked_resource_type: @cms_section.linked_resource_type, f: f %>--<div id="alertToClickUpdate" class="d-none">- <div class="alert alert-warning mt-3">- <% if %w[new create].include? controller.action_name %>- <%= raw Spree.t('admin.navigation.click_create_to_load_new_link') %>- <% else %>- <%= raw Spree.t('admin.navigation.click_update_to_load_new_link') %>+ </div>+ <div class="col-12"><hr></div>+ <div class="col-12 col-md-6">+ <%= f.field_container :linked_resource_type, class: ['form-group'] do %>+ <%= f.label :linked_resource_type, Spree.t('admin.navigation.link_to') %>+ <%= f.select(:linked_resource_type, @cms_section_links_to, {include_blank: false}, class: 'link_switcher') %>+ <%= f.error_message_on :linked_resource_type %><% end %></div>+ <div class="col-12 col-md-6">+ <%= render "spree/admin/shared/link_switcher", resource: @cms_section, f: f %>+ </div></div>diff --git a/core/app/models/spree/cms_page.rb b/core/app/models/spree/cms_page.rbindex af5c59e208..0c170cbf4d 100644--- a/core/app/models/spree/cms_page.rb+++ b/core/app/models/spree/cms_page.rb@@ -1,6 +1,6 @@module Spreeclass CmsPage < Spree::Base- PAGE_KINDS = ['Standard Page','Feature Page', 'Home Page']+ PAGE_KINDS = ['Standard Page', 'Feature Page', 'Home Page']extend FriendlyIdfriendly_id :slug, use: [:slugged, :finders, :history]@@ -13,6 +13,8 @@ module Spreevalidates :title, presence: true+ scope :visible, -> { where visible: true }+def seo_titleif meta_title.present?meta_title@@ -25,10 +27,10 @@ module Spreedef create_slugself.slug = if slug.blank?- title.to_url- else- slug.to_url- end+ title.to_url+ else+ slug.to_url+ endendendenddiff --git a/core/app/models/spree/cms_section.rb b/core/app/models/spree/cms_section.rbindex 28cc6df4cb..cb9af9fb66 100644--- a/core/app/models/spree/cms_section.rb+++ b/core/app/models/spree/cms_section.rb@@ -12,9 +12,9 @@ module Spreehas_one :icon, as: :viewable, dependent: :destroy, class_name: 'Spree::Icon'accepts_nested_attributes_for :icon, reject_if: :all_blank- SECTION_WIDTHS = ['Full', 'Half']- SECTION_TYPES = ['Text Block', 'Hero', 'Promo']+ SECTION_WIDTHS = ['Edge-to-Edge', 'Full', 'Half']+ SECTION_TYPES = ['Text Block', 'Hero', 'Promo', 'Featured Atricle']- SECTION_LINKS_TO = ['None', 'Spree::Taxon', 'Spree::Product']+ SECTION_LINKS_TO = ['Spree::Taxon', 'Spree::Product']endenddiff --git a/core/db/migrate/20210514204251_create_spree_cms_sections.rb b/core/db/migrate/20210514204251_create_spree_cms_sections.rbindex a8af9ec035..1c8d371788 100644--- a/core/db/migrate/20210514204251_create_spree_cms_sections.rb+++ b/core/db/migrate/20210514204251_create_spree_cms_sections.rb@@ -4,9 +4,11 @@ class CreateSpreeCmsSections < ActiveRecord::Migration[6.0]t.column :name, :string, null: falset.column :title, :stringt.column :subtitle, :string+ t.column :button_text, :stringt.column :content, :textt.column :width, :stringt.column :kind, :string+ t.column :destination, :stringt.column :position, :integert.references :linked_resource, polymorphic: true, index: { name: 'index_spree_cms_sections_on_linked_resource' }diff --git a/frontend/app/assets/stylesheets/spree/frontend/views/spree/home/index.scss b/frontend/app/assets/stylesheets/spree/frontend/views/spree/home/index.scssindex c1562d626a..01b0fd2aa8 100644--- a/frontend/app/assets/stylesheets/spree/frontend/views/spree/home/index.scss+++ b/frontend/app/assets/stylesheets/spree/frontend/views/spree/home/index.scss@@ -182,7 +182,9 @@@include media-breakpoint-up(md) {font-size: font-px-to-rem(16px);- width: 608px;+ width: 90%;+ max-width: 608px;+}}.spree-btn {diff --git a/frontend/app/helpers/spree/cms_pages_helper.rb b/frontend/app/helpers/spree/cms_pages_helper.rbindex 52e8e5b10a..4c9e303294 100644--- a/frontend/app/helpers/spree/cms_pages_helper.rb+++ b/frontend/app/helpers/spree/cms_pages_helper.rb@@ -4,13 +4,18 @@ module Spreepreview_type = section.kind.parameterize(separator: '_')case section.width- when 'Full'- css_width = 'col-12'when 'Half'+ edge_to_edge = ''css_width = 'col-6'+ when 'Full'+ edge_to_edge = ''+ css_width = 'col-12'+ when 'Edge-to-Edge'+ edge_to_edge = 'full-width'+ css_width = 'col-12'end- render "spree/cms_pages/sections/#{preview_type}", section: section, width: css_width+ render "spree/cms_pages/sections/#{preview_type}", section: section, width: css_width, edge_to_edge: edge_to_edgeendendenddiff --git a/frontend/app/views/spree/cms_pages/sections/_featured_atricle.html.erb b/frontend/app/views/spree/cms_pages/sections/_featured_atricle.html.erbnew file mode 100644index 0000000000..a31fd54da4--- /dev/null+++ b/frontend/app/views/spree/cms_pages/sections/_featured_atricle.html.erb@@ -0,0 +1,14 @@+<div class="<%= width %>">+ <div class="<%= edge_to_edge %>">+ <div class="homepage-fashion-trends-box mb-3">+ <div class="text-center">+ <div class="homepage-fashion-trends-box-summer-text mb-1"><%= section.title %></div>+ <div class="homepage-fashion-trends-box-fashion-trends-text mb-2"><%= section.subtitle %></div>+ <div class="homepage-fashion-trends-box-description-text text-center mb-3">+ <%= raw section.content %>+ </div>+ <%= link_to section.button_text, spree.nested_taxons_path('trending'), class: 'btn px-5 spree-btn btn-outline-primary' %>+ </div>+ </div>+ </div>+</div>diff --git a/frontend/app/views/spree/cms_pages/sections/_hero.html.erb b/frontend/app/views/spree/cms_pages/sections/_hero.html.erbindex 6c3632f774..4f8bc0a58b 100644--- a/frontend/app/views/spree/cms_pages/sections/_hero.html.erb+++ b/frontend/app/views/spree/cms_pages/sections/_hero.html.erb@@ -1,5 +1,5 @@-<div class="col-12">- <div class="full-width">+<div class="<%= width %>">+ <div class="<%= edge_to_edge %>"><div class="homepage-hero-image mb-3 position-relative p-0"><% if section.icon.present? %><%= image_tag main_app.url_for(section.icon.attachment), alt: section.icon.alt %>diff --git a/frontend/app/views/spree/cms_pages/sections/_promo.html.erb b/frontend/app/views/spree/cms_pages/sections/_promo.html.erbindex b4cbd9c114..a6bbad7a5c 100644--- a/frontend/app/views/spree/cms_pages/sections/_promo.html.erb+++ b/frontend/app/views/spree/cms_pages/sections/_promo.html.erb@@ -7,10 +7,10 @@<div class="homepage-bottom-box-inner" role="img" aria-label="New Collection"><div class="homepage-bottom-box-inner-small-text">- New Collection+ <%= section.title %></div><div class="homepage-bottom-box-inner-big-text">- Streetstyle+ <%= section.subtitle %></div></div></div>