Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spree v4.0 #54

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/helpers/spree/admin/base_helper_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Spree::BaseHelper.class_eval do
# frozen_string_literal: true

module Spree::Admin::BaseHelperDecorator
def selected?(current_insight, insight)
current_insight.eql?(insight)
end
Expand All @@ -15,3 +17,5 @@ def pdf_logo(image_path = Spree::Config[:logo])
wicked_pdf_image_tag image_path, class: 'logo'
end
end

::Spree::Admin::BaseHelper.prepend(Spree::Admin::BaseHelperDecorator)
8 changes: 6 additions & 2 deletions app/models/spree/app_configuration_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Spree::AppConfiguration.class_eval do
preference :records_per_page, :integer, default: 20
module Spree::AppConfigurationDecorator
def self.prepended(base)
base.preference :records_per_page, :integer, default: 20
end
end

::Spree::AppConfiguration.prepend(Spree::AppConfigurationDecorator)
8 changes: 6 additions & 2 deletions app/models/spree/product_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Spree::Product.class_eval do
has_many :page_view_events, -> { viewed }, class_name: 'Spree::PageEvent', foreign_key: :target_id
module Spree::ProductDecorator
def self.prepended(base)
base.has_many :page_view_events, -> { viewed }, class_name: 'Spree::PageEvent', foreign_key: :target_id
end
end

::Spree::Product.prepend(Spree::ProductDecorator)
8 changes: 6 additions & 2 deletions app/models/spree/promotion_action_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Spree::PromotionAction.class_eval do
has_one :adjustment, -> { promotion }, class_name: 'Spree::Adjustment', foreign_key: :source_id
module Spree::PromotionActionDecorator
def self.prepended(base)
base.has_one :adjustment, -> { promotion }, class_name: 'Spree::Adjustment', foreign_key: :source_id
end
end

::Spree::PromotionAction.prepend(Spree::PromotionActionDecorator)
10 changes: 7 additions & 3 deletions app/models/spree/return_authorization_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
Spree::ReturnAuthorization.class_eval do
has_many :variants, through: :inventory_units
has_many :products, through: :variants
module Spree::ReturnAuthorizationDecorator
def self.prepended(base)
base.has_many :variants, through: :inventory_units
base.has_many :products, through: :variants
end
end

::Spree::ReturnAuthorization.prepend(Spree::ReturnAuthorizationDecorator)
8 changes: 6 additions & 2 deletions app/models/spree/user_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Spree::User.class_eval do
has_many :spree_orders, class_name: 'Spree::Order'
module Spree::UserDecorator
def self.prepended(base)
base.has_many :spree_orders, class_name: 'Spree::Order'
end
end

::Spree.user_class.prepend(Spree::UserDecorator)
2 changes: 1 addition & 1 deletion app/overrides/add_insights_to_admin_side_menu.html.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Deface::Override.new(virtual_path: 'spree/layouts/admin',
name: 'add_insights_to_admin_side_menu',
insert_bottom: "[data-hook='admin_tabs'], #admin_tabs[data-hook]",
insert_bottom: '#main-sidebar > nav',
partial: 'spree/admin/shared/insights_side_menu',
)
2 changes: 1 addition & 1 deletion spree_admin_insights.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Gem::Specification.new do |s|
s.require_path = 'lib'
s.requirements << 'none'

spree_version = '>= 3.1.0', '< 4.0.0'
spree_version = '>= 3.1.0', '< 5.0.0'

s.add_dependency 'spree_core', spree_version
s.add_dependency 'spree_extension'
Expand Down