spree_multi_vendor 2.4.0 → 2.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c5387ab5edeed4f158bfb7e5f264800ea5b02efc14c2048957501948c406dcca
4
- data.tar.gz: 523fd3aea41eea77295a9f34d33ee3bcfb08dd9b615ddba74eda769b8e65f326
3
+ metadata.gz: 739faebda6a3b0fea3e9bb528131c08de2dde2f692dbca6b7346e8eaf0b5d9a1
4
+ data.tar.gz: 656938bba90616428bd534d7e64d94d2673e99a3ced0a8a2dfc0515d6eb4c0c6
5
5
  SHA512:
6
- metadata.gz: 9a8768042a152773ff4059c05c4e49f5102048cc3538e0289a9f015daa4afe0bae20124bbd8a96f61bb4d2a6f48033b4c4f2cbefcc1650c1e1ff83211f6b20b6
7
- data.tar.gz: 97901fc6622e7d5c208656630865c01da883cac4ee158309b62bce59984c69357b971a128257dca459e556ced2097ce3ecb5aec664b297ebeb0eaffb31dc2b18
6
+ metadata.gz: 639389fb453a10c7fc98328a6bcf1f8b4d834063f1be4983a5177a00e2dafcb447afc6d2f67095dd80ba716214546b645481703f131bffca8abd1214fd007125
7
+ data.tar.gz: 4d8c28520b08cc36c0fb130e77d566ff4aaeee9a63d971c52b8af6c61443047cddb2f18df2543c3b35b47e22c461f9d65b1d89a82825cf1c7c82ec5b6199aebf
data/README.md CHANGED
@@ -1,16 +1,16 @@
1
1
  # Spree Multi Vendor
2
2
 
3
- This is a [spree multi vendor marketplace](https://spreecommerce.org/use-cases/multi-vendor-marketplace/) extension. It's a great starting point if you're building a marketplace on top of [Spree](https://spreecommerce.org). Our goal was flexibility to allow you to tweak it to your needs.
3
+ This is a spree [multi vendor marketplace](https://getvendo.com) extension. It's a great starting point if you're building a marketplace on top of [Spree](https://spreecommerce.org). Our goal was flexibility to allow you to tweak it to your needs.
4
4
 
5
5
  ## Developed by
6
6
 
7
7
  [![Vendo](https://assets-global.website-files.com/6230c485f2c32ea1b0daa438/623372f40a8c54ca9aea34e8_vendo%202.svg)](https://getvendo.com?utm_source=spree_multi_vendor_github)
8
8
 
9
- > All-in-one platform for all your Marketplace and B2B eCommerce needs. [Start your 30-day free trial](https://e98esoirr8c.typeform.com/contactvendo?typeform-source=spree_multi_vendor_github)
9
+ > All-in-one platform for all your multi-vendor Marketplace needs. [Get your free account](https://app.getvendo.com/users/new?utm_source=spree_multi_vendor_github)
10
10
 
11
11
  ## Open source vs Vendo
12
12
 
13
- If you need a product that has all of the features out of the box, such us supplier onboarding, Stripe connect payment splitting and payouts, and don't require any custom development - we recommend using [Vendo](http://getvendo.com?utm_source=spree_multi_vendor_github) which is also based on Spree.
13
+ If you need a product that has all of the features out of the box, such us supplier onboarding, Stripe connect payment splitting and payouts, and don't require any custom development - we recommend using [Vendo](https://app.getvendo.com/users/new?utm_source=spree_multi_vendor_github).
14
14
 
15
15
  | feature | open source | [vendo] |
16
16
  |---|---|---|
@@ -168,14 +168,10 @@ and may be redistributed under the terms specified in the
168
168
 
169
169
  ## About Vendo
170
170
 
171
- <a href="https://getvendo.com?utm_source=spree_multi_vendor_github">
172
- <img src="https://uploads-ssl.webflow.com/6230c485f2c32ea1b0daa438/62386b96518cdcbe111f134a_OG%20Image%20(2).png" style="max-height:400px" />
173
- </a>
174
-
175
171
  > [Vendo][vendo] is a great fit for marketplaces of all sizes - either with own fulfillment and multiple warehouses or in a dropshipping model. Vendo **automates everything** from **vendor onboarding**, accepting buyer **payments in over 135 currencies**, to supplier **payouts in 50 countries**.
176
172
 
177
173
  > Vendo ensures excellent buyer experience with smooth product discovery and search, a multitude of payment methods and optimal shipping cost calculation. Vendo keeps suppliers happy with easy onboarding, automated products sync using their preferred method and easy payouts.
178
174
 
179
- > [Start your 30-day free trial](https://e98esoirr8c.typeform.com/contactvendo?typeform-source=spree_multi_vendor_github)
175
+ > [Get your free account](https://app.getvendo.com/users/new?utm_source=spree_multi_vendor_github)
180
176
 
181
- [vendo]:http://getvendo.com?utm_source=spree_multi_vendor_github
177
+ [vendo]:https://app.getvendo.com/users/new?utm_source=spree_multi_vendor_github
@@ -1,6 +1,7 @@
1
1
  module Spree
2
2
  module Admin
3
3
  class VendorsController < ResourceController
4
+ include Translatable
4
5
 
5
6
  def create
6
7
  if permitted_resource_params[:image]
@@ -13,7 +14,6 @@ module Spree
13
14
  if permitted_resource_params[:image]
14
15
  @vendor.create_image(attachment: permitted_resource_params.delete(:image))
15
16
  end
16
- format_translations if defined? SpreeGlobalize
17
17
  super
18
18
  end
19
19
 
@@ -51,18 +51,6 @@ module Spree
51
51
  products: []
52
52
  }
53
53
  end
54
-
55
- def format_translations
56
- return if params[:vendor][:translations_attributes].blank?
57
- params[:vendor][:translations_attributes].each do |_, data|
58
- translation = @vendor.translations.find_or_create_by(locale: data[:locale])
59
- translation.name = data[:name]
60
- translation.about_us = data[:about_us]
61
- translation.contact_us = data[:contact_us]
62
- translation.slug = data[:slug]
63
- translation.save!
64
- end
65
- end
66
54
  end
67
55
  end
68
56
  end
@@ -1,6 +1,11 @@
1
1
  module Spree
2
2
  class Vendor < Spree::Base
3
3
  extend FriendlyId
4
+ include TranslatableResource
5
+ include TranslatableResourceSlug
6
+
7
+ TRANSLATABLE_FIELDS = %i[name about_us contact_us slug].freeze
8
+ translates(*TRANSLATABLE_FIELDS)
4
9
 
5
10
  acts_as_paranoid
6
11
  acts_as_list column: :priority
@@ -48,16 +53,6 @@ module Spree
48
53
  update(notification_email: email)
49
54
  end
50
55
 
51
- # Spree Globalize support
52
- # https://github.com/spree-contrib/spree_multi_vendor/issues/104
53
- if defined?(SpreeGlobalize)
54
- attr_accessor :translations_attributes
55
- translates :name,
56
- :about_us,
57
- :contact_us,
58
- :slug, fallbacks_for_empty_translations: true
59
- end
60
-
61
56
  private
62
57
 
63
58
  def create_stock_location
@@ -33,7 +33,7 @@
33
33
  <%= render partial: 'spree/admin/shared/index_table_options', locals: { collection: @collection } %>
34
34
 
35
35
  <% if @vendors.any? %>
36
- <table class="table sortable" data-hook="vendors_table" data-sortable-link="<%= update_positions_admin_vendors_url %>">
36
+ <table class="table border rounded sortable" data-hook="vendors_table" data-sortable-link="<%= update_positions_admin_vendors_url %>">
37
37
  <thead>
38
38
  <tr data-hook="vendors_header">
39
39
  <th>
@@ -66,9 +66,9 @@
66
66
  <!-- Add translation icon support -->
67
67
  <%= link_to_with_icon 'translate',
68
68
  nil,
69
- spree.admin_translations_path('vendor', vendor.id),
69
+ spree.translations_admin_vendor_path(vendor.id),
70
70
  title: Spree.t(:'i18n.translations'),
71
- class: 'btn btn-sm btn-primary' if defined? (SpreeGlobalize)%>
71
+ class: 'btn btn-sm btn-primary' %>
72
72
  </td>
73
73
  </tr>
74
74
  <% end %>
@@ -0,0 +1,3 @@
1
+ <div class="row" style="display: block">
2
+ <%= render 'spree/admin/translations/form', resource: @object %>
3
+ </div>
@@ -32,3 +32,4 @@ en:
32
32
  pending: Pending
33
33
  admin:
34
34
  commission: Commission
35
+ vendors: Vendors
@@ -34,3 +34,4 @@ es:
34
34
  pending: Pendiente
35
35
  admin:
36
36
  commission: Comisión
37
+ vendors: Vendedores
@@ -31,3 +31,4 @@ fr:
31
31
  pending: En attente
32
32
  admin:
33
33
  commission: Commission
34
+ vendors: Vendeurs
data/config/routes.rb CHANGED
@@ -1,6 +1,11 @@
1
1
  Spree::Core::Engine.routes.draw do
2
2
  namespace :admin do
3
3
  resources :vendors do
4
+ member do
5
+ get :translations
6
+ post :translations, to: 'vendors#edit_translations'
7
+ end
8
+
4
9
  collection do
5
10
  post :update_positions
6
11
  end
@@ -0,0 +1,25 @@
1
+ class AddMobilityTranslationsToVendor < ActiveRecord::Migration[6.1]
2
+ def change
3
+ if ActiveRecord::Base.connection.table_exists?('spree_vendor_translations')
4
+ if ActiveRecord::Migration.connection.index_exists?(:spree_vendors_translations, :spree_vendor_id)
5
+ remove_index :spree_vendor_translations, column: :spree_vendor_id, if_exists: true
6
+ end
7
+ else
8
+ create_table :spree_vendor_translations do |t|
9
+ # Translated attribute(s)
10
+ t.string :name
11
+ t.text :about_us
12
+ t.text :contact_us
13
+ t.string :slug
14
+
15
+ t.string :locale, null: false
16
+ t.references :spree_vendor, null: false, foreign_key: true, index: false
17
+
18
+ t.timestamps null: false
19
+ end
20
+
21
+ add_index :spree_vendor_translations, :locale, name: :index_spree_vendor_translations_on_locale
22
+ add_index :spree_vendor_translations, [:locale, :slug], unique: true, name: 'vendor_unique_slug_per_locale'
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,11 @@
1
+ class TransferVendorDataToTranslatableTables < ActiveRecord::Migration[6.1]
2
+ TRANSLATION_MIGRATION = Spree::TranslationMigrations.new(Spree::Vendor, 'en')
3
+
4
+ def up
5
+ TRANSLATION_MIGRATION.transfer_translation_data
6
+ end
7
+
8
+ def down
9
+ TRANSLATION_MIGRATION.revert_translation_data_transfer
10
+ end
11
+ end
@@ -1,10 +1,27 @@
1
1
  module SpreeMultiVendor
2
- class Configuration < ::Spree::Preferences::Configuration
2
+ class Configuration
3
3
  DEFAULT_VENDORIZED_MODELS ||= %w[product variant stock_location shipping_method].freeze
4
4
 
5
- # Some example preferences are shown below, for more information visit:
6
- # https://guides.spreecommerce.org/developer/core/preferences.html
5
+ attr_accessor :vendorized_models
7
6
 
8
- preference :vendorized_models, :array, default: DEFAULT_VENDORIZED_MODELS
7
+ def initialize
8
+ self.vendorized_models = DEFAULT_VENDORIZED_MODELS
9
+ end
10
+
11
+ def configure
12
+ yield(self) if block_given?
13
+ end
14
+
15
+ def get(preference)
16
+ send(preference)
17
+ end
18
+
19
+ alias [] get
20
+
21
+ def set(preference, value)
22
+ send("#{preference}=", value)
23
+ end
24
+
25
+ alias []= set
9
26
  end
10
27
  end
@@ -1,5 +1,5 @@
1
1
  module SpreeMultiVendor
2
- VERSION = '2.4.0'
2
+ VERSION = '2.5.0'
3
3
 
4
4
  module_function
5
5
 
@@ -29,7 +29,7 @@ Gem::Specification.new do |s|
29
29
  s.require_path = 'lib'
30
30
  s.requirements << 'none'
31
31
 
32
- spree_version = '>= 4.3.0.rc1'
32
+ spree_version = '>= 4.6.0'
33
33
  s.add_dependency 'spree', spree_version
34
34
  s.add_dependency 'spree_backend', spree_version
35
35
  s.add_dependency 'spree_emails', spree_version
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_multi_vendor
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Spark Solutions
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-21 00:00:00.000000000 Z
11
+ date: 2023-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.3.0.rc1
19
+ version: 4.6.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 4.3.0.rc1
26
+ version: 4.6.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: spree_backend
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 4.3.0.rc1
33
+ version: 4.6.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 4.3.0.rc1
40
+ version: 4.6.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: spree_emails
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 4.3.0.rc1
47
+ version: 4.6.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 4.3.0.rc1
54
+ version: 4.6.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: spree_extension
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -162,7 +162,6 @@ files:
162
162
  - app/overrides/spree/admin/orders/index.rb
163
163
  - app/overrides/spree/admin/products/form.rb
164
164
  - app/overrides/spree/admin/products/new.rb
165
- - app/overrides/spree/admin/shared/_main_menu.rb
166
165
  - app/overrides/spree/admin/shared/_order_summary.rb
167
166
  - app/overrides/spree/admin/users/_form.rb
168
167
  - app/serializers/spree/v2/storefront/vendor_image_serializer.rb
@@ -177,6 +176,7 @@ files:
177
176
  - app/views/spree/admin/vendors/edit.html.erb
178
177
  - app/views/spree/admin/vendors/index.html.erb
179
178
  - app/views/spree/admin/vendors/new.html.erb
179
+ - app/views/spree/admin/vendors/translations.html.erb
180
180
  - app/views/spree/api/v1/vendors/index.rabl
181
181
  - app/views/spree/api/v1/vendors/show.rabl
182
182
  - app/views/spree/vendor_mailer/vendor_notification_email.html.erb
@@ -204,6 +204,8 @@ files:
204
204
  - db/migrate/20210728120649_change_vendorized_models_vendor_id_type.rb
205
205
  - db/migrate/20210728120910_change_vendor_id_and_user_id_type_for_spree_vendor_users.rb
206
206
  - db/migrate/20210728121024_change_vendor_id_and_order_id_type_for_spree_order_commissions.rb
207
+ - db/migrate/20231114090744_add_mobility_translations_to_vendor.rb
208
+ - db/migrate/20231114093444_transfer_vendor_data_to_translatable_tables.rb
207
209
  - lib/generators/spree_multi_vendor/install/install_generator.rb
208
210
  - lib/generators/spree_multi_vendor/mailers_preview/mailers_preview_generator.rb
209
211
  - lib/generators/spree_multi_vendor/mailers_preview/templates/mailers/previews/vendor_notification_preview.rb
@@ -250,9 +252,9 @@ licenses:
250
252
  - BSD-3-Clause
251
253
  metadata:
252
254
  bug_tracker_uri: https://github.com/spree-contrib/spree_multi_vendor/issues
253
- changelog_uri: https://github.com/spree-contrib/spree_multi_vendor/releases/tag/v2.4.0
255
+ changelog_uri: https://github.com/spree-contrib/spree_multi_vendor/releases/tag/v2.5.0
254
256
  documentation_uri: https://guides.spreecommerce.org/
255
- source_code_uri: https://github.com/spree-contrib/spree_multi_vendor/tree/v2.4.0
257
+ source_code_uri: https://github.com/spree-contrib/spree_multi_vendor/tree/v2.5.0
256
258
  post_install_message:
257
259
  rdoc_options: []
258
260
  require_paths:
@@ -269,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
269
271
  version: '0'
270
272
  requirements:
271
273
  - none
272
- rubygems_version: 3.0.9
274
+ rubygems_version: 3.4.1
273
275
  signing_key:
274
276
  specification_version: 4
275
277
  summary: Spree Commerce multi vendor marketplace extension
@@ -1,23 +0,0 @@
1
- Deface::Override.new(
2
- virtual_path: 'spree/admin/shared/_main_menu',
3
- name: 'Display configuration tab for vendors',
4
- replace: 'erb[silent]:contains("current_store")',
5
- text: '<% if can?(:admin, current_store) || current_spree_user&.vendors&.any? %>'
6
- )
7
- Deface::Override.new(
8
- virtual_path: 'spree/admin/shared/_main_menu',
9
- name: 'vendors_main_menu_tabs',
10
- insert_bottom: 'nav',
11
- text: <<-HTML
12
- <% if current_spree_user.respond_to?(:has_spree_role?) && current_spree_user.has_spree_role?(:admin) %>
13
- <ul class="nav nav-sidebar border-bottom">
14
- <%= tab plural_resource_name(Spree::Vendor), url: admin_vendors_path, icon: 'money' %>
15
- </ul>
16
- <% end %>
17
- <% if defined?(current_spree_vendor) && current_spree_vendor %>
18
- <ul class="nav nav-sidebar border-bottom">
19
- <%= tab Spree::Vendor.model_name.human, url: admin_vendor_settings_path, icon: 'money' %>
20
- </ul>
21
- <% end %>
22
- HTML
23
- )