From 4ee35fc1ab8fcc077b443106bd4194bf233686b2 Mon Sep 17 00:00:00 2001 From: David Cook Date: Mon, 3 Feb 2025 17:23:26 +1100 Subject: [PATCH] Move select2 images to asset pipeline png sprites? That was a flashback.. --- .../admin/product_properties/index.html.haml | 2 +- app/views/spree/admin/states/index.html.haml | 4 +-- app/webpacker/packs/application.js | 2 -- config/webpacker.yml | 3 +- vendor/assets/stylesheets/select2.css.scss | 30 +++++++++---------- 5 files changed, 19 insertions(+), 22 deletions(-) diff --git a/app/views/spree/admin/product_properties/index.html.haml b/app/views/spree/admin/product_properties/index.html.haml index cd07017706..d14abaa0f0 100644 --- a/app/views/spree/admin/product_properties/index.html.haml +++ b/app/views/spree/admin/product_properties/index.html.haml @@ -12,7 +12,7 @@ = form_for @product, url: admin_product_url(@product, @url_filters), method: :put do |f| %fieldset.no-border-top .add_product_properties - = image_pack_tag 'select2-spinner.gif', plugin: 'spree', style: 'display:none;', id: 'busy_indicator' + = image_tag 'select2-spinner.gif', plugin: 'spree', style: 'display:none;', id: 'busy_indicator' %table.index.sortable{"data-sortable-link" => update_positions_admin_product_product_properties_url} %thead diff --git a/app/views/spree/admin/states/index.html.haml b/app/views/spree/admin/states/index.html.haml index b9e72fa193..6e515f23a3 100644 --- a/app/views/spree/admin/states/index.html.haml +++ b/app/views/spree/admin/states/index.html.haml @@ -1,4 +1,4 @@ -= render partial: 'spree/admin/shared/configuration_menu' +dmin= render partial: 'spree/admin/shared/configuration_menu' - content_for :page_title do = t("spree.states") @@ -11,6 +11,6 @@ - databaseurl = "#{admin_states_path(format: :js)}?country_id=" %select#country.observe_field.select2.fullwidth{"data-base-url" => databaseurl, "data-update" => "#state-list"} = options_from_collection_for_select(@countries, :id, :name, @country.id) -= image_pack_tag 'select2-spinner.gif', plugin: 'spree', style: 'display:none;', id: 'busy_indicator' += image_tag 'select2-spinner.gif', plugin: 'spree', style: 'display:none;', id: 'busy_indicator' #state-list = render partial: 'state_list' diff --git a/app/webpacker/packs/application.js b/app/webpacker/packs/application.js index f8263d1830..1a7b9afae9 100644 --- a/app/webpacker/packs/application.js +++ b/app/webpacker/packs/application.js @@ -6,5 +6,3 @@ import "../js/matomo"; import "../js/moment"; require.context("../fonts", true); -const images = require.context("../images", true); -const imagePath = (name) => images(name, true); diff --git a/config/webpacker.yml b/config/webpacker.yml index 37c3616045..43dcfcfaad 100644 --- a/config/webpacker.yml +++ b/config/webpacker.yml @@ -13,8 +13,7 @@ default: &default 'vendor', 'app/webpacker/css', 'app/webpacker/fonts', - 'app/webpacker/images', - 'app/assets/images', # images should be outside of webpacker where possible + 'app/assets/images', 'engines/web/app/assets/stylesheets', 'app/components' ] diff --git a/vendor/assets/stylesheets/select2.css.scss b/vendor/assets/stylesheets/select2.css.scss index 1f8fd014bc..a50ec64457 100644 --- a/vendor/assets/stylesheets/select2.css.scss +++ b/vendor/assets/stylesheets/select2.css.scss @@ -95,7 +95,7 @@ Version: 3.4.3 Timestamp: Tue Sep 17 06:47:14 PDT 2013 text-decoration: none; border: 0; - background: url('../images/select2.png') right top no-repeat; + background: url('../../assets/images/select2.png') right top no-repeat; cursor: pointer; outline: 0; } @@ -199,7 +199,7 @@ Version: 3.4.3 Timestamp: Tue Sep 17 06:47:14 PDT 2013 display: block; width: 100%; height: 100%; - background: url('../images/select2.png') no-repeat 0 1px; + background: url('../../assets/images/select2.png') no-repeat 0 1px; } .select2-search { @@ -233,11 +233,11 @@ Version: 3.4.3 Timestamp: Tue Sep 17 06:47:14 PDT 2013 -webkit-box-shadow: none; box-shadow: none; - background: #fff url('../images/select2.png') no-repeat 100% -22px; - background: url('../images/select2.png') no-repeat 100% -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee)); - background: url('../images/select2.png') no-repeat 100% -22px, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%); - background: url('../images/select2.png') no-repeat 100% -22px, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%); - background: url('../images/select2.png') no-repeat 100% -22px, linear-gradient(top, #fff 85%, #eee 99%); + background: #fff url('../../assets/images/select2.png') no-repeat 100% -22px; + background: url('../../assets/images/select2.png') no-repeat 100% -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee)); + background: url('../../assets/images/select2.png') no-repeat 100% -22px, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%); + background: url('../../assets/images/select2.png') no-repeat 100% -22px, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%); + background: url('../../assets/images/select2.png') no-repeat 100% -22px, linear-gradient(top, #fff 85%, #eee 99%); } .select2-drop.select2-drop-above .select2-search input { @@ -245,11 +245,11 @@ Version: 3.4.3 Timestamp: Tue Sep 17 06:47:14 PDT 2013 } .select2-search input.select2-active { - background: #fff url('../images/select2-spinner.gif') no-repeat 100%; - background: url('../images/select2-spinner.gif') no-repeat 100%, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee)); - background: url('../images/select2-spinner.gif') no-repeat 100%, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%); - background: url('../images/select2-spinner.gif') no-repeat 100%, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%); - background: url('../images/select2-spinner.gif') no-repeat 100%, linear-gradient(top, #fff 85%, #eee 99%); + background: #fff url('../../assets/images/select2-spinner.gif') no-repeat 100%; + background: url('../../assets/images/select2-spinner.gif') no-repeat 100%, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee)); + background: url('../../assets/images/select2-spinner.gif') no-repeat 100%, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%); + background: url('../../assets/images/select2-spinner.gif') no-repeat 100%, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%); + background: url('../../assets/images/select2-spinner.gif') no-repeat 100%, linear-gradient(top, #fff 85%, #eee 99%); } .select2-container-active .select2-choice, @@ -393,7 +393,7 @@ disabled look for disabled choices in the results dropdown } .select2-more-results.select2-active { - background: #f4f4f4 url('../images/select2-spinner.gif') no-repeat 100%; + background: #f4f4f4 url('../../assets/images/select2-spinner.gif') no-repeat 100%; } .select2-more-results { @@ -481,7 +481,7 @@ disabled look for disabled choices in the results dropdown } .select2-container-multi .select2-choices .select2-search-field input.select2-active { - background: #fff url('../images/select2-spinner.gif') no-repeat 100% !important; + background: #fff url('../../assets/images/select2-spinner.gif') no-repeat 100% !important; } .select2-default { @@ -535,7 +535,7 @@ disabled look for disabled choices in the results dropdown font-size: 1px; outline: none; - background: url('../images/select2.png') right top no-repeat; + background: url('../../assets/images/select2.png') right top no-repeat; } .select2-container-multi .select2-search-choice-close {