mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-25 05:45:15 +00:00
Remove unused icons from Spree:Taxon
The icons are not used any more and the default icon file never existed in our code base (only in Spree when we depended on that). And it's better to remove this clutter before migrating those files to Active Storage. We are keeping the icon files in storage as a backup. The whole folder `/spree/taxons` can be deleted when desired. But storage is cheap.
This commit is contained in:
@@ -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
|
||||
[]
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user