spree_core 5.4.0.beta → 5.4.0.beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/finders/spree/products/find.rb +1 -28
- data/app/helpers/spree/base_helper.rb +1 -54
- data/app/mailers/spree/base_mailer.rb +4 -3
- data/app/models/concerns/spree/adjustment_source.rb +0 -8
- data/app/models/concerns/spree/admin_user_methods.rb +0 -2
- data/app/models/concerns/spree/image_methods.rb +4 -0
- data/app/models/concerns/spree/metadata.rb +10 -0
- data/app/models/concerns/spree/product_scopes.rb +2 -47
- data/app/models/concerns/spree/stores/markets.rb +7 -7
- data/app/models/concerns/spree/vat_price_calculation.rb +2 -2
- data/app/models/spree/ability.rb +5 -5
- data/app/models/spree/address.rb +3 -2
- data/app/models/spree/adjustable/promotion_accumulator.rb +1 -1
- data/app/models/spree/adjustment.rb +1 -20
- data/app/models/spree/api_key.rb +57 -2
- data/app/models/spree/country.rb +7 -3
- data/app/models/spree/credit_card.rb +0 -27
- data/app/models/spree/current.rb +38 -2
- data/app/models/spree/exports/products.rb +0 -6
- data/app/models/spree/gateway/bogus.rb +9 -9
- data/app/models/spree/gateway.rb +0 -3
- data/app/models/spree/gift_card_batch.rb +4 -0
- data/app/models/spree/image/configuration/active_storage.rb +0 -2
- data/app/models/spree/image.rb +7 -31
- data/app/models/spree/log_entry.rb +8 -5
- data/app/models/spree/order/checkout.rb +0 -18
- data/app/models/spree/order.rb +20 -11
- data/app/models/spree/payment/gateway_options.rb +2 -2
- data/app/models/spree/payment/processing.rb +5 -5
- data/app/models/spree/payment.rb +1 -1
- data/app/models/spree/payment_connection_error.rb +3 -0
- data/app/models/spree/payment_method/check.rb +1 -1
- data/app/models/spree/payment_method/store_credit.rb +5 -5
- data/app/models/spree/payment_response.rb +70 -0
- data/app/models/spree/permission_sets/default_customer.rb +0 -5
- data/app/models/spree/permission_sets/product_display.rb +0 -2
- data/app/models/spree/permission_sets/product_management.rb +0 -2
- data/app/models/spree/product.rb +4 -72
- data/app/models/spree/promotion.rb +2 -14
- data/app/models/spree/promotion_handler/coupon.rb +3 -3
- data/app/models/spree/prototype.rb +0 -3
- data/app/models/spree/refund.rb +6 -2
- data/app/models/spree/shipment/emails.rb +1 -0
- data/app/models/spree/shipping_category.rb +3 -3
- data/app/models/spree/store.rb +10 -49
- data/app/models/spree/store_credit.rb +4 -0
- data/app/models/spree/tax_category.rb +1 -11
- data/app/models/spree/taxon.rb +0 -16
- data/app/models/spree/variant.rb +2 -40
- data/app/models/spree/zone.rb +1 -4
- data/app/services/spree/cart/add_item.rb +8 -4
- data/app/services/spree/cart/create.rb +13 -2
- data/app/services/spree/products/duplicator.rb +0 -12
- data/app/services/spree/products/prepare_nested_attributes.rb +0 -12
- data/config/locales/en.yml +3 -20
- data/db/migrate/20210914000000_spree_four_three.rb +0 -38
- data/db/migrate/20210915064329_add_metadata_to_spree_multiple_tables.rb +0 -1
- data/db/migrate/20260226000000_add_locale_to_spree_orders.rb +5 -0
- data/db/migrate/20260226100000_add_token_digest_to_spree_api_keys.rb +21 -0
- data/lib/generators/spree/cursor_rules/templates/spree_rules.mdc +1 -3
- data/lib/spree/core/configuration.rb +0 -3
- data/lib/spree/core/controller_helpers/strong_parameters.rb +1 -2
- data/lib/spree/core/dependencies.rb +2 -10
- data/lib/spree/core/engine.rb +0 -13
- data/lib/spree/core/pricing/resolver.rb +1 -9
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/core.rb +10 -25
- data/lib/spree/permitted_attributes.rb +2 -14
- data/lib/spree/testing_support/factories/order_factory.rb +1 -0
- data/lib/spree/testing_support/factories/payment_method_factory.rb +1 -6
- data/lib/spree/testing_support/factories/product_factory.rb +0 -7
- data/lib/spree/testing_support/factories/prototype_factory.rb +0 -2
- data/lib/tasks/core.rake +0 -265
- metadata +8 -101
- data/app/finders/spree/posts/find.rb +0 -137
- data/app/finders/spree/product_properties/find_available.rb +0 -20
- data/app/helpers/spree/mail_helper.rb +0 -27
- data/app/jobs/spree/api_key_touch_job.rb +0 -9
- data/app/mailers/spree/test_mailer.rb +0 -8
- data/app/models/action_text/video_embed.rb +0 -13
- data/app/models/concerns/spree/has_one_link.rb +0 -42
- data/app/models/concerns/spree/linkable.rb +0 -9
- data/app/models/concerns/spree/previewable.rb +0 -17
- data/app/models/spree/data_feed/google.rb +0 -15
- data/app/models/spree/data_feed.rb +0 -42
- data/app/models/spree/gateway/bogus_simple.rb +0 -24
- data/app/models/spree/post.rb +0 -108
- data/app/models/spree/post_category.rb +0 -46
- data/app/models/spree/product_property.rb +0 -51
- data/app/models/spree/property.rb +0 -86
- data/app/models/spree/property_prototype.rb +0 -9
- data/app/models/spree/store_favicon_image.rb +0 -20
- data/app/models/spree/store_logo.rb +0 -4
- data/app/models/spree/store_mailer_logo.rb +0 -7
- data/app/models/spree/taxon_image/configuration/active_storage.rb +0 -26
- data/app/models/spree/taxon_image.rb +0 -28
- data/app/presenters/spree/filters/properties_presenter.rb +0 -23
- data/app/presenters/spree/filters/property_presenter.rb +0 -42
- data/app/services/spree/data_feeds/google/optional_attributes.rb +0 -23
- data/app/services/spree/data_feeds/google/optional_sub_attributes.rb +0 -21
- data/app/services/spree/data_feeds/google/products_list.rb +0 -14
- data/app/services/spree/data_feeds/google/required_attributes.rb +0 -68
- data/app/services/spree/data_feeds/google/rss.rb +0 -109
- data/app/sorters/spree/posts/sort.rb +0 -40
- data/app/views/action_text/video_embeds/_thumbnail.html.erb +0 -1
- data/app/views/action_text/video_embeds/_video_embed.html.erb +0 -3
- data/app/views/layouts/action_text/contents/_content.html.erb +0 -3
- data/app/views/spree/test_mailer/test_email.html.erb +0 -40
- data/app/views/spree/test_mailer/test_email.text.erb +0 -4
- data/config/initializers/oembed.rb +0 -1
- data/db/migrate/20221229132350_create_spree_data_feed_settings.rb +0 -14
- data/db/migrate/20230109084253_create_product_property_translations.rb +0 -24
- data/db/migrate/20230109105943_create_property_translations.rb +0 -24
- data/db/migrate/20230415155958_rename_data_feed_settings_table.rb +0 -5
- data/db/migrate/20230415160828_rename_data_feed_table_columns.rb +0 -7
- data/db/migrate/20230415161226_add_indexes_to_data_feeds_table.rb +0 -5
- data/db/migrate/20230512094803_rename_data_feeds_column_provider_to_type.rb +0 -5
- data/db/migrate/20240914153106_add_display_on_to_spree_properties.rb +0 -5
- data/db/migrate/20240915144935_add_position_to_spree_properties.rb +0 -6
- data/db/migrate/20250121160028_create_spree_posts_and_spree_post_categories.rb +0 -33
- data/db/migrate/20250127083740_add_kind_to_spree_properties.rb +0 -5
- data/db/migrate/20250217171018_create_action_text_video_embeds.rb +0 -11
- data/db/migrate/20250305121657_remove_spree_posts_indices.rb +0 -7
- data/db/migrate/20250730154601_add_unique_index_on_spree_properties_name.rb +0 -24
- data/db/sample_data/posts.rb +0 -7
- data/lib/spree/core/controller_helpers/search.rb +0 -17
- data/lib/spree/core/product_filters.rb +0 -218
- data/lib/spree/core/query_filters/comparable.rb +0 -50
- data/lib/spree/core/query_filters/date.rb +0 -8
- data/lib/spree/core/query_filters/number.rb +0 -8
- data/lib/spree/core/query_filters/text.rb +0 -36
- data/lib/spree/core/query_filters.rb +0 -11
- data/lib/spree/core/search/base.rb +0 -144
- data/lib/spree/testing_support/factories/favicon_image_factory.rb +0 -9
- data/lib/spree/testing_support/factories/google_data_feed_factory.rb +0 -7
- data/lib/spree/testing_support/factories/post_category_factory.rb +0 -7
- data/lib/spree/testing_support/factories/post_factory.rb +0 -22
- data/lib/spree/testing_support/factories/product_property_factory.rb +0 -7
- data/lib/spree/testing_support/factories/property_factory.rb +0 -28
- data/lib/spree/testing_support/factories/taxon_image_factory.rb +0 -9
- data/lib/spree/testing_support/flash.rb +0 -25
- data/lib/spree/testing_support/flatpickr_capybara.rb +0 -124
- data/lib/tasks/exchanges.rake +0 -66
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
class StoreFaviconImage < Asset
|
|
3
|
-
VALID_CONTENT_TYPES = ['image/png', 'image/x-icon', 'image/vnd.microsoft.icon'].freeze
|
|
4
|
-
|
|
5
|
-
validates :attachment,
|
|
6
|
-
content_type: VALID_CONTENT_TYPES,
|
|
7
|
-
size: { less_than_or_equal_to: 1.megabyte }
|
|
8
|
-
|
|
9
|
-
validates :attachment,
|
|
10
|
-
if: :is_png?,
|
|
11
|
-
dimension: { max: 256..256 },
|
|
12
|
-
aspect_ratio: :square
|
|
13
|
-
|
|
14
|
-
private
|
|
15
|
-
|
|
16
|
-
def is_png?
|
|
17
|
-
attachment.content_type.in?('image/png')
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
class TaxonImage < Asset
|
|
3
|
-
module Configuration
|
|
4
|
-
module ActiveStorage
|
|
5
|
-
extend ActiveSupport::Concern
|
|
6
|
-
|
|
7
|
-
included do
|
|
8
|
-
validates :attachment, content_type: Rails.application.config.active_storage.web_image_content_types
|
|
9
|
-
|
|
10
|
-
default_scope { includes(attachment_attachment: :blob) }
|
|
11
|
-
|
|
12
|
-
def self.styles
|
|
13
|
-
@styles ||= {
|
|
14
|
-
mini: '32x32>',
|
|
15
|
-
normal: '128x128>'
|
|
16
|
-
}
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def default_style
|
|
20
|
-
:mini
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
# @deprecated Use Spree::Taxon#image (Active Storage) instead. Will be removed in Spree 5.5.
|
|
3
|
-
class TaxonImage < Asset
|
|
4
|
-
include Spree::TaxonImage::Configuration::ActiveStorage
|
|
5
|
-
include Rails.application.routes.url_helpers
|
|
6
|
-
include Spree::ImageMethods
|
|
7
|
-
|
|
8
|
-
after_initialize do
|
|
9
|
-
Spree::Deprecation.warn(
|
|
10
|
-
'Spree::TaxonImage is deprecated and will be removed in Spree 5.5. ' \
|
|
11
|
-
'Please use Spree::Taxon#image (Active Storage) instead.'
|
|
12
|
-
)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def styles
|
|
16
|
-
self.class.styles.map do |_, size|
|
|
17
|
-
width, height = size[/(\d+)x(\d+)/].split('x').map(&:to_i)
|
|
18
|
-
|
|
19
|
-
{
|
|
20
|
-
url: generate_url(size: size),
|
|
21
|
-
size: size,
|
|
22
|
-
width: width,
|
|
23
|
-
height: height
|
|
24
|
-
}
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
module Filters
|
|
3
|
-
class PropertiesPresenter
|
|
4
|
-
def initialize(product_properties_scope:)
|
|
5
|
-
@product_properties = product_properties_scope.includes(:property)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def to_a
|
|
9
|
-
grouped_options.map do |property, product_properties|
|
|
10
|
-
PropertyPresenter.new(property: property, product_properties: product_properties)
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
private
|
|
15
|
-
|
|
16
|
-
attr_reader :product_properties
|
|
17
|
-
|
|
18
|
-
def grouped_options
|
|
19
|
-
product_properties.group_by(&:property)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
module Filters
|
|
3
|
-
class PropertyPresenter
|
|
4
|
-
def initialize(property:, product_properties:)
|
|
5
|
-
@property = property
|
|
6
|
-
@product_properties = product_properties
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
attr_reader :product_properties
|
|
10
|
-
|
|
11
|
-
delegate_missing_to :property
|
|
12
|
-
|
|
13
|
-
def uniq_values
|
|
14
|
-
property.uniq_values(product_properties_scope: product_properties)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def to_h
|
|
18
|
-
{
|
|
19
|
-
id: property.id,
|
|
20
|
-
name: property.name,
|
|
21
|
-
presentation: property.presentation,
|
|
22
|
-
values: values_hash
|
|
23
|
-
}
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
private
|
|
27
|
-
|
|
28
|
-
attr_reader :property
|
|
29
|
-
|
|
30
|
-
def values_hash
|
|
31
|
-
value_hashes = uniq_values.map do |filter_param, value|
|
|
32
|
-
{
|
|
33
|
-
value: value,
|
|
34
|
-
filter_param: filter_param
|
|
35
|
-
}
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
value_hashes.sort_by { |e| e[:value] }
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
module DataFeeds
|
|
3
|
-
module Google
|
|
4
|
-
class OptionalAttributes
|
|
5
|
-
prepend Spree::ServiceModule::Base
|
|
6
|
-
|
|
7
|
-
def call(input)
|
|
8
|
-
information = {}
|
|
9
|
-
|
|
10
|
-
input[:product].property_ids.each do |key|
|
|
11
|
-
name = Spree::Property.find(key)&.name
|
|
12
|
-
value = input[:product].property(name)
|
|
13
|
-
unless value.nil?
|
|
14
|
-
information[name] = value
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
success(information: information)
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
module DataFeeds
|
|
3
|
-
module Google
|
|
4
|
-
class OptionalSubAttributes
|
|
5
|
-
prepend Spree::ServiceModule::Base
|
|
6
|
-
|
|
7
|
-
def call(input)
|
|
8
|
-
information = {}
|
|
9
|
-
|
|
10
|
-
# This is a place where you can put attributes that have sub-attributes, example for shipping:
|
|
11
|
-
#
|
|
12
|
-
# information['shipping'] = {}
|
|
13
|
-
# information['shipping']['price'] = calculate_shipping(input[:product])
|
|
14
|
-
# information['shipping']['country'] = input[:store].default_country
|
|
15
|
-
|
|
16
|
-
success(information: information)
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
module DataFeeds
|
|
3
|
-
module Google
|
|
4
|
-
class RequiredAttributes
|
|
5
|
-
prepend Spree::ServiceModule::Base
|
|
6
|
-
|
|
7
|
-
def call(input)
|
|
8
|
-
information = {}
|
|
9
|
-
|
|
10
|
-
return failure(nil, error: 'No image link') if get_image_link(input[:variant], input[:product]).nil?
|
|
11
|
-
|
|
12
|
-
information['id'] = input[:variant].id
|
|
13
|
-
information['item_group_id'] = input[:product].id
|
|
14
|
-
information['title'] = format_title(input[:product], input[:variant])
|
|
15
|
-
information['description'] = get_description(input[:product], input[:variant])
|
|
16
|
-
information['link'] = "#{input[:store].url}/products/#{input[:product].slug}"
|
|
17
|
-
information['image_link'] = get_image_link(input[:variant], input[:product])
|
|
18
|
-
information['price'] = format_price(input[:variant])
|
|
19
|
-
information['availability'] = get_availability(input[:product])
|
|
20
|
-
information['availability_date'] = input[:product].available_on&.xmlschema unless input[:product].available_on.nil?
|
|
21
|
-
|
|
22
|
-
success(information: information)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
private
|
|
26
|
-
|
|
27
|
-
def format_title(product, variant)
|
|
28
|
-
# Title of a variant is created by joining title of a product and variant's option_values, as they are
|
|
29
|
-
# what differentiates it from other variants.
|
|
30
|
-
parts = [product.name]
|
|
31
|
-
variant.option_values.find_each do |option_value|
|
|
32
|
-
parts << option_value.name
|
|
33
|
-
end
|
|
34
|
-
parts.join(' - ')
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def get_description(product, variant)
|
|
38
|
-
return product.description unless product.description.nil?
|
|
39
|
-
|
|
40
|
-
format_title(product, variant)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def get_image_link(variant, product)
|
|
44
|
-
# try getting image from variant
|
|
45
|
-
img = variant.images.first&.plp_url
|
|
46
|
-
|
|
47
|
-
# if no image specified for variant try getting product image
|
|
48
|
-
if img.nil?
|
|
49
|
-
img = product.images.first&.plp_url
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
img
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def format_price(variant)
|
|
56
|
-
"#{variant.price} #{variant.cost_currency}"
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def get_availability(product)
|
|
60
|
-
return 'in stock' if product.available? && (product.available_on.nil? || product.available_on.past?)
|
|
61
|
-
return 'backorder' if product.backorderable? && product.backordered? && product.available_on&.future?
|
|
62
|
-
|
|
63
|
-
'out of stock'
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
end
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
require 'nokogiri'
|
|
2
|
-
|
|
3
|
-
module Spree
|
|
4
|
-
module DataFeeds
|
|
5
|
-
module Google
|
|
6
|
-
class Rss
|
|
7
|
-
prepend Spree::ServiceModule::Base
|
|
8
|
-
|
|
9
|
-
def call(settings)
|
|
10
|
-
@settings = settings
|
|
11
|
-
|
|
12
|
-
return failure(store, error: "Store with id: #{settings.store_id} does not exist.") if store.nil?
|
|
13
|
-
|
|
14
|
-
builder = Nokogiri::XML::Builder.new do |xml|
|
|
15
|
-
xml.rss('xmlns:g' => 'http://base.google.com/ns/1.0', 'version' => '2.0') do
|
|
16
|
-
xml.channel do
|
|
17
|
-
add_store_information_to_xml(xml)
|
|
18
|
-
result = products_list.call(store)
|
|
19
|
-
if result.success?
|
|
20
|
-
result.value[:products].find_each do |product|
|
|
21
|
-
product.variants_including_master.active.find_each do |variant|
|
|
22
|
-
next if variant.is_master? && product.has_variants?
|
|
23
|
-
|
|
24
|
-
add_variant_information_to_xml(xml, product, variant)
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
success(file: builder.to_xml)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
private
|
|
36
|
-
|
|
37
|
-
def store
|
|
38
|
-
return @store if defined? @store
|
|
39
|
-
|
|
40
|
-
@store ||= Spree::Store.find_by(id: @settings.store_id)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def add_store_information_to_xml(xml)
|
|
44
|
-
xml.title store.name
|
|
45
|
-
xml.link store.url
|
|
46
|
-
xml.description store.meta_description
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def add_variant_information_to_xml(xml, product, variant)
|
|
50
|
-
input = { product: product, variant: variant, settings: @settings, store: store }
|
|
51
|
-
result = required_attributes.call(input)
|
|
52
|
-
|
|
53
|
-
if result.success
|
|
54
|
-
xml.item do
|
|
55
|
-
result.value[:information]&.each do |key, value|
|
|
56
|
-
xml['g'].send(key, value)
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
add_optional_information(xml, product, variant)
|
|
60
|
-
add_optional_sub_attributes(xml, product, variant)
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
def add_optional_information(xml, product, variant)
|
|
66
|
-
input = { product: product, variant: variant, settings: @settings, store: store }
|
|
67
|
-
result = optional_attributes.call(input)
|
|
68
|
-
if result.success?
|
|
69
|
-
information = result.value[:information]
|
|
70
|
-
information.each do |key, value|
|
|
71
|
-
xml['g'].send(key, value)
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def add_optional_sub_attributes(xml, product, variant)
|
|
77
|
-
input = { product: product, variant: variant, settings: @settings, store: store }
|
|
78
|
-
result = optional_sub_attributes.call(input)
|
|
79
|
-
if result.success?
|
|
80
|
-
information = result.value[:information]
|
|
81
|
-
information.each do |key, value|
|
|
82
|
-
xml['g'].send(key) do
|
|
83
|
-
value.each do |subkey, subvalue|
|
|
84
|
-
xml['g'].send(subkey, subvalue)
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
def optional_attributes
|
|
92
|
-
Spree.data_feeds_google_optional_attributes_service.new
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
def required_attributes
|
|
96
|
-
Spree.data_feeds_google_required_attributes_service.new
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
def optional_sub_attributes
|
|
100
|
-
Spree.data_feeds_google_optional_sub_attributes_service.new
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
def products_list
|
|
104
|
-
Spree.data_feeds_google_products_list.new
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
end
|
|
108
|
-
end
|
|
109
|
-
end
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
module Posts
|
|
3
|
-
class Sort < ::Spree::BaseSorter
|
|
4
|
-
def initialize(scope, params = {}, allowed_sort_attributes = [])
|
|
5
|
-
super(scope, params, allowed_sort_attributes)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def call
|
|
9
|
-
posts = by_param_attributes(scope)
|
|
10
|
-
posts = select_translatable_fields(posts) if Spree.use_translations?
|
|
11
|
-
|
|
12
|
-
posts.distinct
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
private
|
|
16
|
-
|
|
17
|
-
attr_reader :sort, :scope, :allowed_sort_attributes
|
|
18
|
-
|
|
19
|
-
# Add translatable fields to SELECT statement to avoid InvalidColumnReference error (workaround for Mobility issue #596)
|
|
20
|
-
def select_translatable_fields(scope)
|
|
21
|
-
translatable_fields = translatable_sortable_fields
|
|
22
|
-
return scope if translatable_fields.empty?
|
|
23
|
-
|
|
24
|
-
scope.i18n.select("#{Post.table_name}.*").select(*translatable_fields)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def translatable_sortable_fields
|
|
28
|
-
fields = []
|
|
29
|
-
Post.translatable_fields.each do |field|
|
|
30
|
-
fields << field if sort_by?(field.to_s)
|
|
31
|
-
end
|
|
32
|
-
fields
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def sort_by?(field)
|
|
36
|
-
sort.detect { |s| s[0] == field }
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<%= image_tag video_embed.thumbnail_url %>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<table>
|
|
2
|
-
<tr>
|
|
3
|
-
<td>
|
|
4
|
-
|
|
5
|
-
<center>
|
|
6
|
-
<h1 class="center">
|
|
7
|
-
<%= Spree.t('test_mailer.test_email.greeting') %>
|
|
8
|
-
</h1>
|
|
9
|
-
</center>
|
|
10
|
-
|
|
11
|
-
</td>
|
|
12
|
-
<td class="expander"></td>
|
|
13
|
-
</tr>
|
|
14
|
-
</table>
|
|
15
|
-
|
|
16
|
-
<table>
|
|
17
|
-
<tr>
|
|
18
|
-
<td>
|
|
19
|
-
|
|
20
|
-
<p class="lede">
|
|
21
|
-
<%= Spree.t('test_mailer.test_email.message') %>
|
|
22
|
-
</p>
|
|
23
|
-
|
|
24
|
-
<p>
|
|
25
|
-
Please remember to configure all of the emails that Spree has provided to your needs.
|
|
26
|
-
Spree comes shipped with <a href="http://zurb.com/ink/" target="_blank"> Ink </a>
|
|
27
|
-
prepackaged, but you can use your own version. Ink is not placed in the asset pipeline.
|
|
28
|
-
</p>
|
|
29
|
-
|
|
30
|
-
<p>
|
|
31
|
-
Also take note that Gmail does not support <code><style></code> tags.
|
|
32
|
-
Therefore, you will need a gem that will be able to remove your <code><style></code>
|
|
33
|
-
tags and place them inline. Gmail only supports inline styles. We use
|
|
34
|
-
<a href="https://github.com/fphilipe/premailer-rails" target="_blank">Premailer for Rails</a> by default.
|
|
35
|
-
</p>
|
|
36
|
-
|
|
37
|
-
</td>
|
|
38
|
-
<td class="expander"></td>
|
|
39
|
-
</tr>
|
|
40
|
-
</table>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
OEmbed::Providers.register_all
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
class CreateSpreeDataFeedSettings < ActiveRecord::Migration[6.0]
|
|
2
|
-
def change
|
|
3
|
-
create_table :spree_data_feed_settings do |t|
|
|
4
|
-
t.references :spree_store
|
|
5
|
-
|
|
6
|
-
t.string :name
|
|
7
|
-
t.string :provider
|
|
8
|
-
t.string :uuid, unique: true
|
|
9
|
-
t.boolean :enabled, default: true
|
|
10
|
-
|
|
11
|
-
t.timestamps
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
class CreateProductPropertyTranslations < ActiveRecord::Migration[6.1]
|
|
2
|
-
def change
|
|
3
|
-
if ActiveRecord::Base.connection.table_exists? 'spree_product_property_translations'
|
|
4
|
-
# manually check for index since Rails if_exists does not always work correctly
|
|
5
|
-
if ActiveRecord::Migration.connection.index_exists?(:spree_product_property_translations, :spree_product_property_id)
|
|
6
|
-
remove_index :spree_product_property_translations, column: :spree_product_property_id, if_exists: true
|
|
7
|
-
end
|
|
8
|
-
else
|
|
9
|
-
create_table :spree_product_property_translations do |t|
|
|
10
|
-
# Translated attribute(s)
|
|
11
|
-
t.string :value
|
|
12
|
-
|
|
13
|
-
t.string :locale, null: false
|
|
14
|
-
t.references :spree_product_property, null: false, foreign_key: true, index: false
|
|
15
|
-
|
|
16
|
-
t.timestamps
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
add_index :spree_product_property_translations, :locale, name: :index_spree_product_property_translations_on_locale
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
add_index :spree_product_property_translations, [:spree_product_property_id, :locale], name: :unique_product_property_id_per_locale, unique: true
|
|
23
|
-
end
|
|
24
|
-
end
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
class CreatePropertyTranslations < ActiveRecord::Migration[6.1]
|
|
2
|
-
def change
|
|
3
|
-
if ActiveRecord::Base.connection.table_exists?('spree_property_translations')
|
|
4
|
-
# manually check for index since Rails if_exists does not always work correctly
|
|
5
|
-
if ActiveRecord::Migration.connection.index_exists?(:spree_property_translations, :spree_property_id)
|
|
6
|
-
remove_index :spree_property_translations, column: :spree_property_id, if_exists: true
|
|
7
|
-
end
|
|
8
|
-
else
|
|
9
|
-
create_table :spree_property_translations do |t|
|
|
10
|
-
# Translated attribute(s)
|
|
11
|
-
t.string :presentation
|
|
12
|
-
|
|
13
|
-
t.string :locale, null: false
|
|
14
|
-
t.references :spree_property, null: false, foreign_key: true, index: false
|
|
15
|
-
|
|
16
|
-
t.timestamps
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
add_index :spree_property_translations, :locale, name: :index_spree_property_translations_on_locale
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
add_index :spree_property_translations, [:spree_property_id, :locale], name: :unique_property_id_per_locale, unique: true
|
|
23
|
-
end
|
|
24
|
-
end
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
class CreateSpreePostsAndSpreePostCategories < ActiveRecord::Migration[6.1]
|
|
2
|
-
def change
|
|
3
|
-
if !table_exists?(:spree_post_categories)
|
|
4
|
-
create_table :spree_post_categories do |t|
|
|
5
|
-
t.references :store, null: false, index: true
|
|
6
|
-
t.string :title, null: false
|
|
7
|
-
t.string :slug, null: false
|
|
8
|
-
|
|
9
|
-
t.timestamps
|
|
10
|
-
|
|
11
|
-
t.index ['slug', 'store_id'], name: 'index_spree_post_categories_on_slug_and_store_id', unique: true
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
if !table_exists?(:spree_posts)
|
|
16
|
-
create_table :spree_posts do |t|
|
|
17
|
-
t.references :author, index: true
|
|
18
|
-
t.datetime :published_at
|
|
19
|
-
t.string :title, null: false
|
|
20
|
-
t.string :slug, null: false
|
|
21
|
-
t.references :post_category, index: true
|
|
22
|
-
t.references :store, index: true
|
|
23
|
-
t.string :meta_title
|
|
24
|
-
t.string :meta_description
|
|
25
|
-
|
|
26
|
-
t.timestamps
|
|
27
|
-
t.datetime :deleted_at
|
|
28
|
-
|
|
29
|
-
t.index ['title'], name: 'index_spree_posts_on_title'
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
class CreateActionTextVideoEmbeds < ActiveRecord::Migration[6.1]
|
|
2
|
-
def change
|
|
3
|
-
create_table :action_text_video_embeds, if_not_exists: true do |t|
|
|
4
|
-
t.string :url, null: false
|
|
5
|
-
t.string :thumbnail_url, null: false
|
|
6
|
-
t.text :raw_html, null: false
|
|
7
|
-
|
|
8
|
-
t.timestamps
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|