alchemy-solidus 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5df79cbf96a886200a6dc90ed749a92e3b10db90
4
- data.tar.gz: ed76a4ccf6ca300da5d06a2a5ffc68d6f4b10581
3
+ metadata.gz: 89fc2d82897ec63ccd01a0b9739985407a869999
4
+ data.tar.gz: 5d448d85de69dc282a0838c5b267a74d9a5a3e0a
5
5
  SHA512:
6
- metadata.gz: a13760c47272faa5dc452879ac36e614600ff153eb5832a732c30ca0c9607370561ea7612bce44aca4a202ed294784fb0697f83b878645e89ec3d2368335cc54
7
- data.tar.gz: bb155668e332b5adb205ed991f39663a672b2bb9c0fce3b2947820cc86225e44405bb6ea838e177b614404a9a7ec6acd71c324d3822477fed4e25567c53c4037
6
+ metadata.gz: 816557248ccabb25bb7c28186a6f8a71a64361573319f671d751aa520606b747c2ba93a600943c8b28de6b2796ccc1d4920ae6021f10c2a80cb55fb7e41e3f96
7
+ data.tar.gz: c707e4f69c3da52fac89f21d17ab3d6ec52c7df27ff5765f3dada0df0419ad83c93fcc559f3283b07adbb129d2d6e5ab581593f0e5bcae7aec92d76d4f3b72ee
data/README.md CHANGED
@@ -50,19 +50,17 @@ To use Solidus Auth Devise, instruct Alchemy to use the `Spree::User` class:
50
50
 
51
51
  ```ruby
52
52
  # config/initializers/alchemy.rb
53
-
54
- # Tell Alchemy to use the Spree::User class
55
53
  Alchemy.user_class_name = 'Spree::User'
56
54
  Alchemy.current_user_method = :spree_current_user
55
+ ```
57
56
 
58
- # Load the Spree.user_class decorator for Alchemy roles
59
- require 'alchemy/solidus/spree_user_decorator'
57
+ If you put Spree in it's own routing namespace (see below) you will want to
58
+ let Alchemy know these paths:
60
59
 
61
- # Include the Spree controller helpers to render the
62
- # alchemy pages within the default Spree layout
63
- Alchemy::BaseHelper.send :include, Spree::BaseHelper
64
- Alchemy::BaseController.send :include, Spree::Core::ControllerHelpers::Common
65
- Alchemy::BaseController.send :include, Spree::Core::ControllerHelpers::Store
60
+ ```ruby
61
+ # config/initializers/alchemy.rb
62
+ Alchemy.login_path = '/store/login'
63
+ Alchemy.logout_path = '/store/logout'
66
64
  ```
67
65
 
68
66
  #### 2. Option: Use [Alchemy Devise](https://github.com/AlchemyCMS/alchemy-devise)
@@ -105,7 +103,6 @@ Now you'll need to instruct Solidus to use the Alchemy User class:
105
103
  # config/initializers/spree.rb
106
104
  ...
107
105
  Spree.user_class = "Alchemy::User"
108
- require 'alchemy/solidus/alchemy_user_decorator'
109
106
  ...
110
107
  ```
111
108
 
@@ -148,28 +145,68 @@ $ bundle exec rake alchemy:install
148
145
 
149
146
  and follow the on screen instructions.
150
147
 
148
+ ### Render Alchemy Content in Solidus Layout
149
+
150
+ If you plan to render the Alchemy site in the Solidus layout add the following
151
+ to your initializer:
152
+
153
+ ```ruby
154
+ # config/initializers/alchemy.rb
155
+ require 'alchemy/solidus/use_solidus_layout'
156
+ ```
157
+
151
158
  ### Render Alchemy Content in Solidus views
152
159
 
153
- If you plan to render Alchemy content in your Solidus views (ie. a global header or footer section), you need to include the Alchemy view helpers and language store in your Solidus controllers.
160
+ If you plan to render Alchemy content in your Solidus views (ie. a global header
161
+ or footer section), you need to include the Alchemy view helpers and language
162
+ store in your Solidus controllers with the following addition to your
163
+ initializer:
154
164
 
155
165
  ```ruby
156
- # config/initializers/solidus.rb
157
- ...
158
- Spree::BaseController.class_eval do
159
- include Alchemy::ControllerActions
160
- end
166
+ # config/initializers/alchemy.rb
167
+ require 'alchemy/solidus/alchemy_in_solidus'
161
168
  ```
162
169
 
163
- #### With Solidus::Auth::Devise
170
+ ## Routing
164
171
 
165
- If you also use the `Spree::User` class you need to additionally tell the Solidus user sessions controller to include the Alchemy related helpers and methods.
172
+ For routing you have a few options.
173
+
174
+ ### Place both engines in their own namespace:
166
175
 
167
176
  ```ruby
168
- # config/initializers/spree.rb
169
- ...
170
- Spree::UserSessionsController.class_eval do
171
- include Alchemy::ControllerActions
172
- end
177
+ # config/routes.rb
178
+ mount Spree::Core::Engine => '/store'
179
+ mount Alchemy::Engine => '/pages'
180
+ ```
181
+
182
+ ### Put Solidus at the root level and Alchemy in its own namespace:
183
+
184
+ ```ruby
185
+ # config/routes.rb
186
+ mount Alchemy::Engine => '/pages'
187
+ mount Spree::Core::Engine => '/'
188
+ ```
189
+
190
+ ### Put Alchemy at the root level and Solidus in its own namespace:
191
+
192
+ ```ruby
193
+ # config/routes.rb
194
+ mount Spree::Core::Engine => '/store'
195
+ mount Alchemy::Engine => '/'
196
+ ```
197
+
198
+ ### Put both engines in the root level
199
+
200
+ ```ruby
201
+ # config/routes.rb
202
+
203
+ # Make Alchemy's root page have higher priority than Spree's root page
204
+ root to: 'alchemy/pages#show'
205
+
206
+ mount Spree::Core::Engine => '/'
207
+
208
+ # Must be last so it's catch-all route can render undefined paths
209
+ mount Alchemy::Engine => '/'
173
210
  ```
174
211
 
175
212
  ## Usage
@@ -0,0 +1,5 @@
1
+ en:
2
+ spree:
3
+ admin:
4
+ tab:
5
+ cms: CMS
@@ -0,0 +1,5 @@
1
+ it:
2
+ spree:
3
+ admin:
4
+ tab:
5
+ cms: CMS
@@ -0,0 +1,14 @@
1
+ ##
2
+ # If there is the Devise Constant loaded, we can assume that we use it as the authentication method
3
+ # then we set the ParentController of device as the Spree::BaseController
4
+ # https://github.com/AlchemyCMS/alchemy-solidus/issues/10
5
+ if Object.const_defined?("Devise")
6
+ Devise.setup do |config|
7
+ config.parent_controller = "Spree::BaseController"
8
+ end
9
+ end
10
+
11
+ # Allow Alchemy content within Solidus views
12
+ Spree::BaseController.send :include, Alchemy::ControllerActions
13
+ Spree::UserSessionsController.send :include, Alchemy::ControllerActions if defined? Spree::UserSessionsController
14
+ Spree::BaseController.send :include, Alchemy::ConfigurationMethods
@@ -1,5 +1,4 @@
1
- Alchemy::User.class_eval do
2
-
1
+ module Alchemy::SpreeUserExtension
3
2
  def spree_roles
4
3
  if admin?
5
4
  ::Spree::Role.where(name: 'admin')
@@ -1,13 +1,23 @@
1
+ require 'alchemy/solidus/alchemy_user_extension'
2
+ require 'alchemy/solidus/spree_user_extension'
3
+
1
4
  module Alchemy
2
5
  module Solidus
3
6
  class Engine < ::Rails::Engine
4
7
  engine_name 'alchemy_solidus'
5
8
 
6
- def self.activate
7
- Alchemy.register_ability(::Spree::Ability)
9
+ initializer 'alchemy_solidus.assets' do |app|
10
+ app.config.assets.precompile += [
11
+ 'alchemy/solidus/alchemy_module_icon.png'
12
+ ]
8
13
  end
9
14
 
10
- config.to_prepare &method(:activate).to_proc
15
+ config.to_prepare do
16
+ Alchemy.register_ability ::Spree::Ability
17
+ ::Spree::Ability.register_ability ::Alchemy::Permissions
18
+ Spree::User.include Spree::AlchemyUserExtension if Alchemy.user_class_name == 'Spree::User'
19
+ Alchemy::User.include Alchemy::SpreeUserExtension if Alchemy.user_class_name == 'Alchemy::User'
20
+ end
11
21
  end
12
22
  end
13
23
  end
@@ -1,5 +1,4 @@
1
- Spree::User.class_eval do
2
-
1
+ module Spree::AlchemyUserExtension
3
2
  def alchemy_roles
4
3
  if has_spree_role?(:admin)
5
4
  %w(admin)
@@ -0,0 +1,5 @@
1
+ # Include this to make Alchemy render within the Solidus layout
2
+ Alchemy::BaseHelper.send :include, Spree::BaseHelper
3
+ Alchemy::BaseHelper.send :include, Spree::StoreHelper
4
+ Alchemy::BaseController.send :include, Spree::Core::ControllerHelpers::Common
5
+ Alchemy::BaseController.send :include, Spree::Core::ControllerHelpers::Store
@@ -1,5 +1,5 @@
1
1
  module Alchemy
2
2
  module Solidus
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy-solidus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-09 00:00:00.000000000 Z
11
+ date: 2017-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: alchemy_cms
@@ -75,12 +75,16 @@ files:
75
75
  - app/views/alchemy/essences/_essence_spree_taxon_editor.html.erb
76
76
  - app/views/alchemy/essences/_essence_spree_taxon_view.html.erb
77
77
  - config/initializers/alchemy.rb
78
+ - config/locales/alchemy_solidus_en.yml
79
+ - config/locales/alchemy_solidus_it.yml
78
80
  - db/migrate/20120229160509_create_alchemy_essence_spree_products.rb
79
81
  - db/migrate/20131030140218_create_alchemy_essence_spree_taxons.rb
80
82
  - lib/alchemy-solidus.rb
81
- - lib/alchemy/solidus/alchemy_user_decorator.rb
83
+ - lib/alchemy/solidus/alchemy_in_solidus.rb
84
+ - lib/alchemy/solidus/alchemy_user_extension.rb
82
85
  - lib/alchemy/solidus/engine.rb
83
- - lib/alchemy/solidus/spree_user_decorator.rb
86
+ - lib/alchemy/solidus/spree_user_extension.rb
87
+ - lib/alchemy/solidus/use_solidus_layout.rb
84
88
  - lib/alchemy/solidus/version.rb
85
89
  homepage: https://github.com/AlchemyCMS/alchemy-solidus
86
90
  licenses:
@@ -102,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
106
  version: '0'
103
107
  requirements: []
104
108
  rubyforge_project:
105
- rubygems_version: 2.4.8
109
+ rubygems_version: 2.6.13
106
110
  signing_key:
107
111
  specification_version: 4
108
112
  summary: The World's Most Flexible E-Commerce Platform meets The World's Most Flexible