Merge pull request #9072 from mkllnk/remove-taxon-icons

Remove unused icons from Spree::Taxon
This commit is contained in:
Filipe
2022-04-21 11:46:57 +01:00
committed by GitHub
4 changed files with 10 additions and 17 deletions

View File

@@ -2,8 +2,6 @@
module Spree
class Taxon < ApplicationRecord
include Spree::Core::S3Support
acts_as_nested_set dependent: :destroy
belongs_to :taxonomy, class_name: 'Spree::Taxonomy', touch: true
@@ -14,15 +12,6 @@ module Spree
validates :name, presence: true
has_attached_file :icon,
styles: { mini: '32x32>', normal: '128x128>' },
default_style: :mini,
url: '/spree/taxons/:id/:style/:basename.:extension',
path: ':rails_root/public/spree/taxons/:id/:style/:basename.:extension',
default_url: '/assets/default_taxon.png'
supports_s3 :icon
# Indicate which filters should be used for this taxon
def applicable_filters
[]

View File

@@ -2,6 +2,6 @@
%ul
- taxon.children.each do |child|
%li{id: "#{child.id}", rel: "taxon"}
%a{href: "#", style: "background-image: url(#{child.icon.url});"}= child.name
%a{href: "#"}= child.name
- if child.children.length > 0
= render partial: 'taxon', locals: { taxon: child }

View File

@@ -0,0 +1,8 @@
class RemoveIconFromSpreeTaxons < ActiveRecord::Migration[6.1]
def change
remove_column :spree_taxons, :icon_file_name, :string
remove_column :spree_taxons, :icon_content_type, :string
remove_column :spree_taxons, :icon_file_size, :integer
remove_column :spree_taxons, :icon_updated_at, :datetime
end
end

View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2022_02_21_165207) do
ActiveRecord::Schema.define(version: 2022_04_07_051248) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -976,10 +976,6 @@ ActiveRecord::Schema.define(version: 2022_02_21_165207) do
t.datetime "updated_at", null: false
t.integer "lft"
t.integer "rgt"
t.string "icon_file_name", limit: 255
t.string "icon_content_type", limit: 255
t.integer "icon_file_size"
t.datetime "icon_updated_at"
t.text "description"
t.string "meta_title", limit: 255
t.string "meta_description", limit: 255