Skip to content

Commit

Permalink
close #2080 fix bug taxon reposition not work
Browse files Browse the repository at this point in the history
  • Loading branch information
LengTech11 committed Nov 25, 2024
1 parent dec68e8 commit 8f9a680
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions app/models/spree_cm_commissioner/taxon_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,9 @@ def self.prepended(base)

base.has_one :web_banner, as: :viewable, dependent: :destroy, class_name: 'SpreeCmCommissioner::TaxonWebBanner'
base.has_one :app_banner, as: :viewable, dependent: :destroy, class_name: 'SpreeCmCommissioner::TaxonAppBanner'
base.has_one :home_banner, as: :viewable, dependent: :destroy, class_name: 'SpreeCmCommissioner::TaxonHomeBanner'

base.has_many :children, class_name: 'Spree::Taxon', foreign_key: :parent_id, dependent: :destroy
base.has_many :children_classifications, through: :children, source: :classifications, class_name: 'Spree::Classification'
base.acts_as_list scope: :parent_id

base.has_many :notification_taxons, class_name: 'SpreeCmCommissioner::NotificationTaxon'
base.has_many :customer_notifications, through: :notification_taxons, class_name: 'SpreeCmCommissioner::CustomerNotification'

base.has_many :visible_classifications, -> { where(visible: true).order(:position) }, class_name: 'Spree::Classification'
base.has_many :visible_products, through: :visible_classifications, class_name: 'Spree::Product', source: :product

base.validates_associated :category_icon
base.before_save :set_kind
base.before_save :set_slug

Expand All @@ -53,6 +44,8 @@ def foreground_color
preferred_foreground_color
end

private

def set_kind
self.kind = taxonomy.kind
end
Expand Down

0 comments on commit 8f9a680

Please sign in to comment.