spree_core 5.4.0.beta4 → 5.4.0.beta5
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/jobs/spree/images/save_from_url_job.rb +47 -23
- data/app/models/concerns/spree/product_scopes.rb +65 -40
- data/app/models/concerns/spree/user_methods.rb +1 -0
- data/app/models/spree/category.rb +6 -0
- data/app/models/spree/payment/gateway_options.rb +5 -0
- data/app/models/spree/product.rb +5 -34
- data/app/models/spree/store.rb +41 -80
- data/app/models/spree/taxon.rb +39 -34
- data/app/models/spree/webhook_endpoint.rb +17 -0
- data/app/services/spree/cart/create.rb +18 -2
- data/app/services/spree/cart/upsert_items.rb +80 -0
- data/app/services/spree/gift_cards/apply.rb +5 -4
- data/app/services/spree/orders/update.rb +121 -0
- data/config/locales/en.yml +5 -0
- data/lib/spree/core/configuration.rb +1 -0
- data/lib/spree/core/controller_helpers/strong_parameters.rb +1 -1
- data/lib/spree/core/dependencies.rb +2 -0
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/permitted_attributes.rb +3 -5
- data/lib/spree/testing_support/factories/store_factory.rb +0 -9
- data/lib/tasks/core.rake +0 -28
- metadata +21 -5
- data/app/models/concerns/spree/stores/socials.rb +0 -72
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
module Stores
|
|
3
|
-
module Socials
|
|
4
|
-
extend ActiveSupport::Concern
|
|
5
|
-
|
|
6
|
-
SUPPORTED_SOCIAL_NETWORKS = %w[instagram facebook twitter pinterest tiktok youtube spotify discord].freeze
|
|
7
|
-
|
|
8
|
-
SOCIAL_NETWORKS_CONFIG = {
|
|
9
|
-
twitter: {
|
|
10
|
-
input_placeholder: 'https://twitter.com/your_handle',
|
|
11
|
-
profile_link: 'https://twitter.com/your_handle'
|
|
12
|
-
},
|
|
13
|
-
instagram: {
|
|
14
|
-
input_placeholder: 'https://www.instagram.com/your_handle',
|
|
15
|
-
profile_link: 'https://www.instagram.com/your_handle'
|
|
16
|
-
},
|
|
17
|
-
facebook: {
|
|
18
|
-
input_placeholder: 'https://www.facebook.com/your_page',
|
|
19
|
-
profile_link: 'https://www.facebook.com/your_page'
|
|
20
|
-
},
|
|
21
|
-
youtube: {
|
|
22
|
-
input_placeholder: 'https://www.youtube.com/@your_channel',
|
|
23
|
-
profile_link: 'https://www.youtube.com/@your_channel'
|
|
24
|
-
},
|
|
25
|
-
pinterest: {
|
|
26
|
-
input_placeholder: 'https://pinterest.com/your_handle',
|
|
27
|
-
profile_link: 'https://pinterest.com/your_handle'
|
|
28
|
-
},
|
|
29
|
-
tiktok: {
|
|
30
|
-
input_placeholder: 'your_handle',
|
|
31
|
-
profile_link: 'https://www.tiktok.com/@your_handle'
|
|
32
|
-
},
|
|
33
|
-
spotify: {
|
|
34
|
-
input_placeholder: 'https://open.spotify.com/user/your_handle',
|
|
35
|
-
profile_link: 'https://open.spotify.com/user/your_handle'
|
|
36
|
-
},
|
|
37
|
-
discord: {
|
|
38
|
-
input_placeholder: 'https://discord.com/invite/your_handle',
|
|
39
|
-
profile_link: 'https://discord.com/invite/your_handle'
|
|
40
|
-
}
|
|
41
|
-
}.freeze
|
|
42
|
-
|
|
43
|
-
included do
|
|
44
|
-
# generate methods for social links
|
|
45
|
-
SUPPORTED_SOCIAL_NETWORKS.each do |social|
|
|
46
|
-
# store the social handle in the public metadata
|
|
47
|
-
store_accessor :public_metadata, social
|
|
48
|
-
|
|
49
|
-
define_method "#{social}_link" do
|
|
50
|
-
return if send(social).blank?
|
|
51
|
-
|
|
52
|
-
send(social).match(/http/) ? send(social) : SOCIAL_NETWORKS_CONFIG[social.to_sym][:profile_link].gsub(/your_handle|your_page|your_channel/, send(social).sub(/^\//, '').sub(/^@/, ''))
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
define_method "#{social}_handle" do
|
|
56
|
-
return if send(social).blank?
|
|
57
|
-
|
|
58
|
-
(send(social).match(/http/) ? send(social).split('/').last : send(social)).sub(/^\//, '').gsub('@', '').split('?').first
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
def social_handle
|
|
64
|
-
@social_handle ||= instagram_handle || youtube_handle || tiktok_handle
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
def social_links
|
|
68
|
-
@social_links ||= [instagram_link, facebook_link, twitter_link, pinterest_link, youtube_link, tiktok_link, spotify_link, discord_link].compact_blank
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
end
|