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.

Visual updates to admin UI

Matthew Kennedyd6395371821a
diff --git a/backend/app/views/spree/admin/cms_pages/_form.html.erb b/backend/app/views/spree/admin/cms_pages/_form.html.erb
index aa1183e4a1..fac22cf208 100644
--- a/backend/app/views/spree/admin/cms_pages/_form.html.erb
+++ b/backend/app/views/spree/admin/cms_pages/_form.html.erb
@@ -15,7 +15,7 @@
<% end %>
<span id="visibilityStatus" class="d-flex align-items-center">
- <span class="page_hidden badge badge-secondary <% if @cms_page.viewable? %>d-none<% end %>">
+ <span class="page_hidden badge badge-secondary <% if @cms_page.visible? %>d-none<% end %>">
<%= svg_icon name: "eye-slash-fill.svg", width: '18', height: '18' %> <%= Spree.t('admin.cms.draft_mode') %>
</span>
@@ -101,7 +101,7 @@
<% end %>
<div class="col-6 text-right">
- <button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#cmsSeoSettings" aria-expanded="false" aria-controls="collapseExample">
+ <button class="btn btn-outline-secondary" type="button" data-toggle="collapse" data-target="#cmsSeoSettings" aria-expanded="false" aria-controls="collapseExample">
<%= raw Spree.t('admin.cms.more_page_settings') %>
</button>
</div>
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 ceccb1c17d..1ccba11825 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('admin.cms.title') %></th>
- <th scope="col"><%= Spree.t(:draft_mode) %></th>
+ <th scope="col"><%= Spree.t('admin.cms.visible') %></th>
<th scope="col"><%= Spree.t('admin.cms.page_type') %></th>
<th scope="col"><%= Spree.t('store') %></th>
<th scope="col"><%= Spree.t('language') %></th>
@@ -24,7 +24,7 @@
<%= page.title %>
</td>
<td>
- <%= active_badge(page.draft_mode?) %>
+ <%= active_badge(page.visible?) %>
</td>
<td>
<%= spree_humanize_type(page.type) %>
diff --git a/backend/app/views/spree/admin/cms_sections/_form.html.erb b/backend/app/views/spree/admin/cms_sections/_form.html.erb
index ed83a7bbdd..db104b7dd0 100644
--- a/backend/app/views/spree/admin/cms_sections/_form.html.erb
+++ b/backend/app/views/spree/admin/cms_sections/_form.html.erb
@@ -1,29 +1,18 @@
<div data-hook="admin_cms_section_form_fields">
<div class="row">
- <div class="col-12">
- <div class="card mb-3">
- <div class="card-header">
- <h5 class="mb-0"><%= Spree.t('settings') %></h5>
- </div>
- <div class="card-body">
- <div class="row">
- <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-12 col-md-6">
- <%= f.field_container :type, class: ['form-group'] do %>
- <%= f.label :type, Spree.t('admin.cms.section_type') %>
- <%= f.select(:type, spree_humanize_dropdown_values('Spree::CmsSection', {const: 'TYPES'}), {include_blank: false}) %>
- <%= f.error_message_on :type %>
- <% end %>
- </div>
- </div>
- </div>
- </div>
+ <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-12 col-md-6">
+ <%= f.field_container :type, class: ['form-group'] do %>
+ <%= f.label :type, Spree.t('admin.cms.section_type') %>
+ <%= f.select(:type, spree_humanize_dropdown_values('Spree::CmsSection', {const: 'TYPES'}), {include_blank: false}) %>
+ <%= f.error_message_on :type %>
+ <% end %>
</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.erb
index d409135ea6..8b8a2d5a13 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
@@ -29,6 +29,7 @@
<% end %>
<%= icon_field.file_field :attachment %>
<% end %>
+
<small class="form-text text-muted"><%= Spree.t('admin.cms.hero.aspect_ratio') %></small>
<%= f.field_container :icon_alt do %>
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.erb
index 33bc4a871e..6b0bf5c0d6 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
@@ -28,20 +28,20 @@
<% end %>
</div>
</div>
- <div class="col-12 col-md-6">
+ <div class="col-12 col-md-6 pt-4">
<% @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 ">
+ <figure class="admin-img-holder">
<%= image_tag(main_app.url_for(@cms_section.icon.attachment)) %>
- </div>
+ </figure>
<% end %>
- <div id="<% unless @cms_section.icon.new_record? %>MenuItemImageButton<% end %>">
<%= icon_field.file_field :attachment %>
- </div>
<% end %>
+ <small class="form-text text-muted"><%= Spree.t('admin.cms.promo.aspect_ratio') %></small>
+
<%= f.field_container :icon_alt do %>
<% unless @cms_section.icon.new_record? %>
<div class="form-group my-3">
diff --git a/core/app/models/spree/cms_page.rb b/core/app/models/spree/cms_page.rb
index a650c43a4f..aa61147f55 100644
--- a/core/app/models/spree/cms_page.rb
+++ b/core/app/models/spree/cms_page.rb
@@ -42,7 +42,7 @@ module Spree
type == 'Spree::Cms::Pages::Homepage'
end
- def viewable?
+ def visible?
visible
end
diff --git a/core/config/locales/en.yml b/core/config/locales/en.yml
index ef444f3316..8bc00f8f83 100644
--- a/core/config/locales/en.yml
+++ b/core/config/locales/en.yml
@@ -582,6 +582,7 @@ en:
settings_for: 'Options For: <b>%{section} Section</b>'
page_sections: '%{page_name} Sections'
page_sections_info: 'The area below represents your %{page_type} displayed in %{store}, add sections and drag them into position'
+ visible: Visible
linkable:
seach_for_a_page: Search for a page
tab:
diff --git a/frontend/app/controllers/spree/cms_pages_controller.rb b/frontend/app/controllers/spree/cms_pages_controller.rb
index 29a18b45ce..b4a04cd7e9 100644
--- a/frontend/app/controllers/spree/cms_pages_controller.rb
+++ b/frontend/app/controllers/spree/cms_pages_controller.rb
@@ -6,7 +6,7 @@ module Spree
include Spree::CacheHelper
def show
- if @page&.viewable?
+ if @page&.visible?
@cms_page = @page
elsif try_spree_current_user&.admin?
@cms_page = @page
diff --git a/frontend/app/controllers/spree/home_controller.rb b/frontend/app/controllers/spree/home_controller.rb
index d6a7aef58d..0d6b241cc0 100644
--- a/frontend/app/controllers/spree/home_controller.rb
+++ b/frontend/app/controllers/spree/home_controller.rb
@@ -7,7 +7,7 @@ module Spree
respond_to :html
def index
- if @cms_home_page&.viewable?
+ if @cms_home_page&.visible?
@homepage = @cms_home_page
elsif try_spree_current_user&.admin?
@homepage = @cms_home_page