solidus_multi_domain 1.0.1 → 1.0.3
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/Gemfile +1 -1
- data/README.md +6 -3
- data/app/models/spree/permission_sets/store_display.rb +9 -0
- data/app/models/spree/permission_sets/store_management.rb +9 -0
- data/app/overrides/decorate_admin_configurations_index.rb +7 -5
- data/app/views/spree/admin/stores/index.html.erb +11 -5
- data/app/views/spree/shared/_multi_domain_sidebar_entry.html.erb +3 -0
- data/solidus_multi_domain.gemspec +2 -2
- data/spec/models/spree/permission_sets/store_display_spec.rb +22 -0
- data/spec/models/spree/permission_sets/store_management_spec.rb +20 -0
- data/spec/spec_helper.rb +2 -0
- metadata +34 -17
- data/app/mailers/spree/carton_mailer_decorator.rb +0 -13
- data/app/mailers/spree/order_mailer.rb +0 -35
- data/spec/mailers/carton_mailer_spec.rb +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 473989c53e12907163063b0b48d04279f8524a5e
|
4
|
+
data.tar.gz: 607a4ca0c1d8b1912a9eaf5d03ff7cc882c9173b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3d34f22e52a395d5ed7ae65a92513f1a131b0155d596bc3fb2a8a2863151419c41b121f377c208079c0fd0d049953b86ef0564e215bb1c37820f9316d2c90bc
|
7
|
+
data.tar.gz: 9b512125660409f4f0ea10804d7844850eb09ea19544b26951057e44d3bebc648875a4aee49c2cff7bc38b7eed87a096e67a517eb436a5f07737b26dfdebfd32
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -56,10 +56,13 @@ rails g solidus_multi_domain:install
|
|
56
56
|
|
57
57
|
You should see 'Stores & Domains' in Configuration tab of Spree Admin.
|
58
58
|
|
59
|
-
|
60
|
-
|
59
|
+
Authorization
|
60
|
+
-------------
|
61
|
+
|
62
|
+
For discrete authorization, two permission sets have been added to allow for granular display in the admin.
|
63
|
+
|
64
|
+
`Spree::PermissionSets::StoreDisplay` and `Spree::PermissionSets::StoreManagement` have been added and can be assigned via [RoleConfiguration](http://docs.solidus.io/Spree/RoleConfiguration.html)
|
61
65
|
|
62
|
-
1. Taxonomies - associate stores with taxonomies.
|
63
66
|
|
64
67
|
Testing
|
65
68
|
-------
|
@@ -1,5 +1,7 @@
|
|
1
|
-
Deface::Override.new(
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
Deface::Override.new(
|
2
|
+
virtual_path: "spree/admin/shared/_configuration_menu",
|
3
|
+
name: "multi_domain_admin_configurations_menu",
|
4
|
+
insert_bottom: "[data-hook='admin_configurations_sidebar_menu']",
|
5
|
+
disabled: false,
|
6
|
+
partial: "spree/shared/multi_domain_sidebar_entry"
|
7
|
+
)
|
@@ -5,9 +5,11 @@
|
|
5
5
|
<% end %>
|
6
6
|
|
7
7
|
<% content_for :page_actions do %>
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
<% if can?(:create, Spree::Store) %>
|
9
|
+
<li>
|
10
|
+
<%= button_link_to Spree.t(:new_store), new_object_url, :icon => 'icon-plus', :id => 'admin_new_store_link' %>
|
11
|
+
</li>
|
12
|
+
<% end %>
|
11
13
|
<% end %>
|
12
14
|
|
13
15
|
<table class="index" id='listing_stores'>
|
@@ -34,8 +36,12 @@
|
|
34
36
|
<td><%= store.mail_from_address %></td>
|
35
37
|
<td><%= store.url %></td>
|
36
38
|
<td data-hook="admin_stores_index_row_actions" class="actions">
|
37
|
-
|
38
|
-
|
39
|
+
<% if can? :update, store %>
|
40
|
+
<%= link_to_edit store, :no_text => true %>
|
41
|
+
<% end %>
|
42
|
+
<% if can? :destroy, store %>
|
43
|
+
<%= link_to_delete store, :no_text => true %>
|
44
|
+
<% end %>
|
39
45
|
</td>
|
40
46
|
</tr>
|
41
47
|
<% end %>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.platform = Gem::Platform::RUBY
|
5
5
|
s.name = "solidus_multi_domain"
|
6
|
-
s.version = "1.0.
|
6
|
+
s.version = "1.0.3"
|
7
7
|
s.summary = "Adds multiple site support to Solidus"
|
8
8
|
s.description = "Multiple Solidus stores on different domains - single unified backed for processing orders."
|
9
9
|
s.required_ruby_version = ">= 2.1"
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.require_path = "lib"
|
19
19
|
s.requirements << "none"
|
20
20
|
|
21
|
-
s.add_dependency "solidus",
|
21
|
+
s.add_dependency "solidus", "~> 1.0.0"
|
22
22
|
|
23
23
|
s.add_development_dependency "rspec-rails", "~> 3.2"
|
24
24
|
s.add_development_dependency "simplecov"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Spree::PermissionSets::StoreDisplay do
|
4
|
+
let(:ability) { Spree::Ability.new nil }
|
5
|
+
|
6
|
+
subject { ability }
|
7
|
+
|
8
|
+
context "when activated" do
|
9
|
+
before do
|
10
|
+
described_class.new(ability).activate!
|
11
|
+
end
|
12
|
+
|
13
|
+
it { should be_able_to(:display, Spree::Store) }
|
14
|
+
it { should be_able_to(:admin, Spree::Store) }
|
15
|
+
end
|
16
|
+
|
17
|
+
context "when not activated" do
|
18
|
+
it { should_not be_able_to(:display, Spree::Store) }
|
19
|
+
it { should_not be_able_to(:admin, Spree::Store) }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Spree::PermissionSets::StoreManagement do
|
4
|
+
let(:ability) { Spree::Ability.new nil }
|
5
|
+
|
6
|
+
subject { ability }
|
7
|
+
|
8
|
+
context "when activated" do
|
9
|
+
before do
|
10
|
+
described_class.new(ability).activate!
|
11
|
+
end
|
12
|
+
|
13
|
+
it { should be_able_to(:manage, Spree::Store) }
|
14
|
+
end
|
15
|
+
|
16
|
+
context "when not activated" do
|
17
|
+
it { should_not be_able_to(:manage, Spree::Store) }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
data/spec/spec_helper.rb
CHANGED
@@ -17,6 +17,8 @@ require 'spree/testing_support/preferences'
|
|
17
17
|
require 'spree/api/testing_support/helpers'
|
18
18
|
require 'spree/api/testing_support/setup'
|
19
19
|
|
20
|
+
require 'cancan/matchers'
|
21
|
+
|
20
22
|
Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each { |f| require f }
|
21
23
|
|
22
24
|
RSpec.configure do |config|
|
metadata
CHANGED
@@ -1,35 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_multi_domain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Solidus Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: solidus
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 1.0.0.pre
|
20
|
-
- - "<"
|
17
|
+
- - "~>"
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
19
|
+
version: 1.0.0
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - "
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 1.0.0.pre
|
30
|
-
- - "<"
|
24
|
+
- - "~>"
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
26
|
+
version: 1.0.0
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: rspec-rails
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,11 +160,11 @@ files:
|
|
166
160
|
- app/controllers/spree/products_controller_decorator.rb
|
167
161
|
- app/controllers/spree/taxons_controller_decorator.rb
|
168
162
|
- app/helpers/spree/products_helper_decorator.rb
|
169
|
-
- app/mailers/spree/carton_mailer_decorator.rb
|
170
|
-
- app/mailers/spree/order_mailer.rb
|
171
163
|
- app/models/spree/line_item_decorator.rb
|
172
164
|
- app/models/spree/order_decorator.rb
|
173
165
|
- app/models/spree/payment_method_decorator.rb
|
166
|
+
- app/models/spree/permission_sets/store_display.rb
|
167
|
+
- app/models/spree/permission_sets/store_management.rb
|
174
168
|
- app/models/spree/product_decorator.rb
|
175
169
|
- app/models/spree/promotion/rules/store.rb
|
176
170
|
- app/models/spree/shipping_method_decorator.rb
|
@@ -199,6 +193,7 @@ files:
|
|
199
193
|
- app/views/spree/admin/trackers/_index_rows.html.erb
|
200
194
|
- app/views/spree/admin/trackers/_store.html.erb
|
201
195
|
- app/views/spree/shared/_google_analytics.html.erb
|
196
|
+
- app/views/spree/shared/_multi_domain_sidebar_entry.html.erb
|
202
197
|
- bin/rails
|
203
198
|
- circle.yml
|
204
199
|
- config/locales/en.yml
|
@@ -236,10 +231,11 @@ files:
|
|
236
231
|
- spec/controllers/spree/api/shipments_controller_spec.rb
|
237
232
|
- spec/controllers/spree/products_controller_spec.rb
|
238
233
|
- spec/helpers/products_helper_decorator_spec.rb
|
239
|
-
- spec/mailers/carton_mailer_spec.rb
|
240
234
|
- spec/models/spree/line_item_spec.rb
|
241
235
|
- spec/models/spree/order_spec.rb
|
242
236
|
- spec/models/spree/payment_method_spec.rb
|
237
|
+
- spec/models/spree/permission_sets/store_display_spec.rb
|
238
|
+
- spec/models/spree/permission_sets/store_management_spec.rb
|
243
239
|
- spec/models/spree/product_spec.rb
|
244
240
|
- spec/models/spree/shipping_method_decorator_spec.rb
|
245
241
|
- spec/models/spree/store_spec.rb
|
@@ -270,8 +266,29 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
270
266
|
requirements:
|
271
267
|
- none
|
272
268
|
rubyforge_project:
|
273
|
-
rubygems_version: 2.2.
|
269
|
+
rubygems_version: 2.2.5
|
274
270
|
signing_key:
|
275
271
|
specification_version: 4
|
276
272
|
summary: Adds multiple site support to Solidus
|
277
|
-
test_files:
|
273
|
+
test_files:
|
274
|
+
- spec/controllers/spree/admin/products_controller_spec.rb
|
275
|
+
- spec/controllers/spree/admin/stores_controller_spec.rb
|
276
|
+
- spec/controllers/spree/api/line_items_controller_spec.rb
|
277
|
+
- spec/controllers/spree/api/products_controller_spec.rb
|
278
|
+
- spec/controllers/spree/api/shipments_controller_spec.rb
|
279
|
+
- spec/controllers/spree/products_controller_spec.rb
|
280
|
+
- spec/helpers/products_helper_decorator_spec.rb
|
281
|
+
- spec/models/spree/line_item_spec.rb
|
282
|
+
- spec/models/spree/order_spec.rb
|
283
|
+
- spec/models/spree/payment_method_spec.rb
|
284
|
+
- spec/models/spree/permission_sets/store_display_spec.rb
|
285
|
+
- spec/models/spree/permission_sets/store_management_spec.rb
|
286
|
+
- spec/models/spree/product_spec.rb
|
287
|
+
- spec/models/spree/shipping_method_decorator_spec.rb
|
288
|
+
- spec/models/spree/store_spec.rb
|
289
|
+
- spec/models/spree/taxon_decorator_spec.rb
|
290
|
+
- spec/models/spree/tracker_spec.rb
|
291
|
+
- spec/requests/global_controller_helpers_spec.rb
|
292
|
+
- spec/requests/template_renderer_spec.rb
|
293
|
+
- spec/spec_helper.rb
|
294
|
+
- spec/support/factory_overrides.rb
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Spree::CartonMailer.class_eval do
|
2
|
-
def from_address_with_multidomain
|
3
|
-
order = @carton.orders.first
|
4
|
-
|
5
|
-
if order.store
|
6
|
-
order.store.mail_from_address
|
7
|
-
else
|
8
|
-
from_address_without_multidomain
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
alias_method_chain :from_address, :multidomain
|
13
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
class OrderMailer < BaseMailer
|
3
|
-
def confirm_email(order, resend = false)
|
4
|
-
find_order(order)
|
5
|
-
subject = (resend ? "[#{Spree.t(:resend).upcase}] " : '')
|
6
|
-
subject += "#{Spree::Store.default.name} #{Spree.t('order_mailer.confirm_email.subject')} ##{@order.number}"
|
7
|
-
mail_params = {:to => @order.email, :subject => subject}
|
8
|
-
if @order.store.present? && @order.store.mail_from_address.present?
|
9
|
-
mail_params[:from] = @order.store.mail_from_address
|
10
|
-
else
|
11
|
-
mail_params[:from] = Spree::Store.default.mail_from_address
|
12
|
-
end
|
13
|
-
mail(mail_params)
|
14
|
-
end
|
15
|
-
|
16
|
-
def cancel_email(order, resend = false)
|
17
|
-
find_order(order)
|
18
|
-
subject = (resend ? "[#{Spree.t(:resend).upcase}] " : '')
|
19
|
-
subject += "#{Spree::Store.default.name} #{Spree.t('order_mailer.cancel_email.subject')} ##{@order.number}"
|
20
|
-
mail_params = {:to => @order.email, :subject => subject}
|
21
|
-
if @order.store.present? && @order.store.mail_from_address.present?
|
22
|
-
mail_params[:from] = @order.store.mail_from_address
|
23
|
-
else
|
24
|
-
mail_params[:from] = Spree::Store.default.mail_from_address
|
25
|
-
end
|
26
|
-
mail(mail_params)
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
def find_order(order)
|
32
|
-
@order = order.is_a?(Spree::Order) ? order : Spree::Order.find(order)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Spree::CartonMailer do
|
4
|
-
let(:mail) { Spree::CartonMailer.shipped_email(carton.id) }
|
5
|
-
|
6
|
-
let(:carton) do
|
7
|
-
FactoryGirl.create(:carton, inventory_units: order.inventory_units)
|
8
|
-
end
|
9
|
-
|
10
|
-
let(:order) do
|
11
|
-
FactoryGirl.create(:order_ready_to_ship, line_items_count: 1)
|
12
|
-
end
|
13
|
-
|
14
|
-
describe 'from address' do
|
15
|
-
subject do
|
16
|
-
mail.from
|
17
|
-
end
|
18
|
-
|
19
|
-
context 'the order does not have a store' do
|
20
|
-
let(:order) do
|
21
|
-
FactoryGirl.create(:order_ready_to_ship, line_items_count: 1, store: nil)
|
22
|
-
end
|
23
|
-
|
24
|
-
it { is_expected.to eq [Spree::Config[:mails_from]] }
|
25
|
-
end
|
26
|
-
|
27
|
-
context 'the order has a store' do
|
28
|
-
let(:order) do
|
29
|
-
FactoryGirl.create(
|
30
|
-
:order_ready_to_ship,
|
31
|
-
line_items_count: 1,
|
32
|
-
store: store,
|
33
|
-
)
|
34
|
-
end
|
35
|
-
|
36
|
-
let(:store) { FactoryGirl.create(:store, mail_from_address: '[email protected]') }
|
37
|
-
it { is_expected.to eq ['[email protected]'] }
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|