alchemy_spree 0.1.5 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +2 -3
- data/README.md +32 -23
- data/alchemy_spree.gemspec +4 -4
- data/app/controllers/alchemy/admin/spree_controller.rb +4 -8
- data/app/models/alchemy/essence_spree_product.rb +11 -10
- data/app/models/alchemy/essence_spree_taxon.rb +16 -0
- data/app/models/alchemy/user_decorator.rb +7 -10
- data/app/views/alchemy/admin/spree/index.html.erb +10 -4
- data/app/views/alchemy/essences/_essence_spree_product_editor.html.erb +8 -8
- data/app/views/alchemy/essences/_essence_spree_taxon_editor.html.erb +16 -0
- data/app/views/alchemy/essences/_essence_spree_taxon_view.html.erb +0 -0
- data/config/authorization_rules.rb +0 -2
- data/config/initializers/alchemy.rb +10 -0
- data/config/routes.rb +3 -3
- data/db/migrate/20131029215548_add_spree_fields_to_custom_user_table.rb +7 -0
- data/db/migrate/20131030140218_create_alchemy_essence_spree_taxons.rb +10 -0
- data/lib/{alchemy_spree → alchemy/spree}/alchemy_language_store.rb +0 -0
- data/lib/alchemy/spree/engine.rb +23 -0
- data/lib/alchemy/spree/version.rb +5 -0
- data/lib/alchemy_spree.rb +2 -1
- data/lib/spree/authentication_helpers.rb +1 -1
- metadata +45 -22
- data/app/overrides/include_tinymce_js.rb +0 -6
- data/app/views/partials/_tinymce_javascript.html.erb +0 -36
- data/lib/alchemy_spree/alchemy_module.rb +0 -16
- data/lib/alchemy_spree/engine.rb +0 -23
- data/lib/alchemy_spree/version.rb +0 -3
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 301fe68273f680a0824558febf122a0dbc9af5d7
|
4
|
+
data.tar.gz: 3852285bdf2a9973c9ab163eee3152d5b447dce0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2f650b88632215540b284184e17f02358ddfd9b599ecfb142222c623e94519422e5bd004f299b7a55ac42a4f1b8525a4fac957df81407e2fed09f0f6b9eb1960
|
7
|
+
data.tar.gz: 4d326c6ede1c990b529868f33f2bb9451840c441134d61f7153b99331f42b4f06a67ea1b43f7a508bb43530b872299f5bb131ac5cc783ceb850db7b4386db118
|
data/Gemfile
CHANGED
@@ -3,9 +3,8 @@ source 'https://rubygems.org'
|
|
3
3
|
# Specify your gem's dependencies in alchemy_spree.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
gem 'alchemy_cms', '2.2.rc12', :github => 'magiclabs/alchemy_cms'
|
7
|
-
gem 'spree', '1.2.0.beta', :github => 'spree/spree', :branch => 'auth-take-two'
|
8
|
-
|
9
6
|
group :developmemt, :test do
|
7
|
+
gem "spree", github: 'tvdeyen/spree', branch: 'alchemy'
|
8
|
+
gem 'money', '~> 5.1'
|
10
9
|
gem 'sqlite3'
|
11
10
|
end
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Alchemy CMS Spree
|
1
|
+
# Alchemy CMS Spree Extension
|
2
2
|
|
3
3
|
The World's Most Flexible E-Commerce Platform meets The World's Most Flexible Content Management System!
|
4
4
|
|
@@ -7,12 +7,8 @@ This gem is a [Alchemy CMS](https://github.com/magiclabs/alchemy_cms) and [Spree
|
|
7
7
|
### For now it does this:
|
8
8
|
|
9
9
|
1. It provides an Alchemy module that displays Spree admin in an iframe inside Alchemy admin.
|
10
|
-
2. It gives you
|
11
|
-
3.
|
12
|
-
|
13
|
-
### TODO:
|
14
|
-
|
15
|
-
1. Share admin session between Alchemy and Spree.
|
10
|
+
2. It gives you new Essences for Alchemy called EssenceSpreeProduct and EssenceSpreeTaxon that you can use to place a Spree product and Taxon on your pages.
|
11
|
+
3. Shares admin session between Alchemy and Spree.
|
16
12
|
|
17
13
|
## Installation
|
18
14
|
|
@@ -28,35 +24,48 @@ Or install it yourself as:
|
|
28
24
|
|
29
25
|
$ gem install alchemy_spree
|
30
26
|
|
31
|
-
|
27
|
+
Install the migrations:
|
28
|
+
|
29
|
+
$ rake alchemy_spree:install:migrations
|
32
30
|
|
33
|
-
|
31
|
+
Migrate the database:
|
34
32
|
|
35
|
-
|
36
|
-
|
33
|
+
$ rake db:migrate
|
34
|
+
|
35
|
+
## Usage
|
37
36
|
|
38
37
|
### Create a new Element for Alchemy
|
39
38
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
39
|
+
# config/alchemy/elements.yml
|
40
|
+
- name: product
|
41
|
+
contents:
|
42
|
+
- name: spree_product
|
43
|
+
type: EssenceSpreeProduct
|
44
|
+
|
45
|
+
- name: product_category
|
46
|
+
contents:
|
47
|
+
- name: spree_taxon
|
48
|
+
type: EssenceSpreeTaxon
|
45
49
|
|
46
50
|
### Generate the views
|
47
51
|
|
48
|
-
|
52
|
+
$ rails g alchemy:elements --skip
|
49
53
|
|
50
54
|
### Place this element on a page layout
|
51
55
|
|
52
|
-
|
53
|
-
|
54
|
-
|
56
|
+
# config/alchemy/page_layouts.yml
|
57
|
+
- name: product
|
58
|
+
elements: [product]
|
59
|
+
- name: products
|
60
|
+
elements: [product_category]
|
61
|
+
|
62
|
+
### You can haz Spree product and taxons!
|
55
63
|
|
56
|
-
|
64
|
+
# app/views/alchemy/elements/_product_view.html.erb
|
65
|
+
<%= element.ingredient('spree_product') %>
|
57
66
|
|
58
|
-
|
59
|
-
|
67
|
+
# app/views/alchemy/elements/_product_category_view.html.erb
|
68
|
+
<%= element.ingredient('spree_taxon') %>
|
60
69
|
|
61
70
|
Alchemy <3 Spree!
|
62
71
|
|
data/alchemy_spree.gemspec
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
require File.expand_path('../lib/
|
2
|
+
require File.expand_path('../lib/alchemy/spree/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.authors = ["Thomas von Deyen"]
|
@@ -13,8 +13,8 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
14
|
gem.name = "alchemy_spree"
|
15
15
|
gem.require_paths = ["lib"]
|
16
|
-
gem.version =
|
16
|
+
gem.version = Alchemy::Spree::VERSION
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
gem.add_dependency('alchemy_cms', ['~> 2.7.0'])
|
19
|
+
gem.add_dependency('spree', ['~> 2.0.0'])
|
20
20
|
end
|
@@ -1,15 +1,16 @@
|
|
1
1
|
module Alchemy
|
2
|
-
|
2
|
+
class EssenceSpreeProduct < ActiveRecord::Base
|
3
|
+
belongs_to :product, class_name: "Spree::Product", foreign_key: 'spree_product_id', readonly: true
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
)
|
5
|
+
acts_as_essence(
|
6
|
+
ingredient_column: 'spree_product_id',
|
7
|
+
preview_text_method: 'name'
|
8
|
+
)
|
9
9
|
|
10
|
-
|
11
|
-
product
|
12
|
-
end
|
10
|
+
attr_accessible :spree_product_id
|
13
11
|
|
14
|
-
|
12
|
+
def ingredient
|
13
|
+
product
|
14
|
+
end
|
15
|
+
end
|
15
16
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Alchemy
|
2
|
+
class EssenceSpreeTaxon < ActiveRecord::Base
|
3
|
+
belongs_to :taxon, class_name: "Spree::Taxon", foreign_key: 'taxon_id', readonly: true
|
4
|
+
|
5
|
+
acts_as_essence(
|
6
|
+
ingredient_column: 'taxon_id',
|
7
|
+
preview_text_method: 'name'
|
8
|
+
)
|
9
|
+
|
10
|
+
attr_accessible :taxon_id
|
11
|
+
|
12
|
+
def ingredient
|
13
|
+
taxon
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,14 +1,11 @@
|
|
1
|
-
|
2
|
-
User.class_eval do
|
1
|
+
Alchemy::User.class_eval do
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
[]
|
10
|
-
end
|
3
|
+
def spree_roles
|
4
|
+
if admin?
|
5
|
+
::Spree::Role.where(name: 'admin')
|
6
|
+
else
|
7
|
+
::Spree::Role.where('1 = 0') # aka. empty relation
|
11
8
|
end
|
12
|
-
|
13
9
|
end
|
10
|
+
|
14
11
|
end
|
@@ -1,27 +1,33 @@
|
|
1
|
-
<%=
|
2
|
-
<iframe src="<%= spree.admin_url(:protocol => Rails.env.production? ? 'https' : nil) %>" frameborder=0 width="100%" id="spree_admin" style="display: none"></iframe>
|
1
|
+
<iframe src="<%= spree.admin_url %>" frameborder=0 width="100%" id="spree_admin" style="display: none"></iframe>
|
3
2
|
<script type="text/javascript">
|
4
3
|
jQuery(document).ready(function($) {
|
5
4
|
var $frame = $('iframe#spree_admin');
|
6
5
|
|
6
|
+
spinner = Alchemy.Spinner.medium();
|
7
|
+
spinner.spin($("#main_content")[0])
|
8
|
+
|
7
9
|
function sizeSpreeFrame() {
|
8
10
|
$frame.css({height: $(window).height() - 30});
|
9
11
|
}
|
10
12
|
|
11
13
|
$('#toolbar').remove();
|
12
|
-
$('#
|
14
|
+
$('#main_content').css({
|
15
|
+
padding: '27px 0px 0px 66px',
|
16
|
+
backgroundColor: 'white'
|
17
|
+
});
|
13
18
|
|
14
19
|
$frame.on('load', function() {
|
15
20
|
var frame_document;
|
16
21
|
var frame_window = (this.contentWindow || this.contentDocument);
|
17
22
|
var elements = ['header', 'footer', 'admin-menu', 'sub-menu', 'content'];
|
23
|
+
spinner.stop();
|
18
24
|
if (frame_window.document) {
|
19
25
|
frame_document = frame_window.document;
|
20
26
|
} else {
|
21
27
|
frame_document = frame_window;
|
22
28
|
frame_window = frame_document.window;
|
23
29
|
}
|
24
|
-
frame_document.body.style.backgroundColor = '#
|
30
|
+
frame_document.body.style.backgroundColor = '#fff';
|
25
31
|
frame_document.body.style.fontFamily = '"Lucida Grande", Arial, sans-serif';
|
26
32
|
frame_document.body.style.fontSize = '12px';
|
27
33
|
for (var i = elements.length - 1; i >= 0; i--) {
|
@@ -1,9 +1,9 @@
|
|
1
|
-
<div class="content_editor">
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
<div class="content_editor essence_spree_product">
|
2
|
+
<label><%= render_content_name(content) %></label>
|
3
|
+
<%= select_tag(
|
4
|
+
content.form_field_name,
|
5
|
+
options_from_collection_for_select(Spree::Product.not_deleted, :id, :name, content.essence.spree_product_id),
|
6
|
+
class: ['alchemy_selectbox very_long', html_options[:class]].join(' '),
|
7
|
+
style: html_options[:style]
|
8
|
+
) %>
|
9
9
|
</div>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<div class="content_editor">
|
2
|
+
<label><%= render_content_name(content) %></label>
|
3
|
+
<%= select_tag(
|
4
|
+
content.form_field_name,
|
5
|
+
option_groups_from_collection_for_select(
|
6
|
+
Spree::Taxon.all,
|
7
|
+
:children,
|
8
|
+
:name,
|
9
|
+
:id,
|
10
|
+
:name,
|
11
|
+
content.essence.taxon_id
|
12
|
+
),
|
13
|
+
:class => ['alchemy_selectbox very_long', html_options[:class]].join(' '),
|
14
|
+
:style => html_options[:style]
|
15
|
+
) %>
|
16
|
+
</div>
|
File without changes
|
data/config/routes.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
end
|
1
|
+
Alchemy::Engine.routes.prepend do
|
2
|
+
get '/admin/spree' => 'admin/spree#index', :as => :spree_admin
|
3
|
+
end
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'alchemy/spree/alchemy_language_store'
|
2
|
+
|
3
|
+
module Alchemy
|
4
|
+
module Spree
|
5
|
+
class Engine < ::Rails::Engine
|
6
|
+
engine_name 'alchemy_spree'
|
7
|
+
|
8
|
+
initializer 'spree.user_class', after: 'alchemy.include_authentication_helpers' do
|
9
|
+
::Spree.user_class = "Alchemy::User"
|
10
|
+
require File.join(File.dirname(__FILE__), '../../spree/authentication_helpers')
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.activate
|
14
|
+
Dir.glob(File.join(File.dirname(__FILE__), "../../../app/**/*_decorator*.rb")) do |c|
|
15
|
+
Rails.configuration.cache_classes ? require(c) : load(c)
|
16
|
+
end
|
17
|
+
Alchemy::Auth::Engine.get_instance.load(File.join(File.dirname(__FILE__), '../..', 'config/authorization_rules.rb'))
|
18
|
+
end
|
19
|
+
|
20
|
+
config.to_prepare &method(:activate).to_proc
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/alchemy_spree.rb
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
require "
|
1
|
+
require "alchemy_cms"
|
2
|
+
require "alchemy/spree/engine"
|
metadata
CHANGED
@@ -1,16 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alchemy_spree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Thomas von Deyen
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
11
|
+
date: 2013-11-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: alchemy_cms
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.7.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.7.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: spree
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.0.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.0.0
|
14
41
|
description: A Alchemy CMS and Spree connector
|
15
42
|
email:
|
16
43
|
- tvd@magiclabs.de
|
@@ -30,20 +57,23 @@ files:
|
|
30
57
|
- app/controllers/spree/base_controller_decorator.rb
|
31
58
|
- app/controllers/spree/user_sessions_controller_decorator.rb
|
32
59
|
- app/models/alchemy/essence_spree_product.rb
|
60
|
+
- app/models/alchemy/essence_spree_taxon.rb
|
33
61
|
- app/models/alchemy/user_decorator.rb
|
34
|
-
- app/overrides/include_tinymce_js.rb
|
35
62
|
- app/views/alchemy/admin/spree/index.html.erb
|
36
63
|
- app/views/alchemy/essences/_essence_spree_product_editor.html.erb
|
37
64
|
- app/views/alchemy/essences/_essence_spree_product_view.html.erb
|
38
|
-
- app/views/
|
65
|
+
- app/views/alchemy/essences/_essence_spree_taxon_editor.html.erb
|
66
|
+
- app/views/alchemy/essences/_essence_spree_taxon_view.html.erb
|
39
67
|
- config/authorization_rules.rb
|
68
|
+
- config/initializers/alchemy.rb
|
40
69
|
- config/routes.rb
|
41
70
|
- db/migrate/20120229160509_create_alchemy_essence_spree_products.rb
|
71
|
+
- db/migrate/20131029215548_add_spree_fields_to_custom_user_table.rb
|
72
|
+
- db/migrate/20131030140218_create_alchemy_essence_spree_taxons.rb
|
73
|
+
- lib/alchemy/spree/alchemy_language_store.rb
|
74
|
+
- lib/alchemy/spree/engine.rb
|
75
|
+
- lib/alchemy/spree/version.rb
|
42
76
|
- lib/alchemy_spree.rb
|
43
|
-
- lib/alchemy_spree/alchemy_language_store.rb
|
44
|
-
- lib/alchemy_spree/alchemy_module.rb
|
45
|
-
- lib/alchemy_spree/engine.rb
|
46
|
-
- lib/alchemy_spree/version.rb
|
47
77
|
- lib/spree/authentication_helpers.rb
|
48
78
|
- script/rails
|
49
79
|
- test/alchemy_spree_test.rb
|
@@ -82,33 +112,26 @@ files:
|
|
82
112
|
- test/test_helper.rb
|
83
113
|
homepage: https://github.com/magiclabs/alchemy_spree
|
84
114
|
licenses: []
|
115
|
+
metadata: {}
|
85
116
|
post_install_message:
|
86
117
|
rdoc_options: []
|
87
118
|
require_paths:
|
88
119
|
- lib
|
89
120
|
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
121
|
requirements:
|
92
|
-
- -
|
122
|
+
- - '>='
|
93
123
|
- !ruby/object:Gem::Version
|
94
124
|
version: '0'
|
95
|
-
segments:
|
96
|
-
- 0
|
97
|
-
hash: -1812501221866682820
|
98
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
126
|
requirements:
|
101
|
-
- -
|
127
|
+
- - '>='
|
102
128
|
- !ruby/object:Gem::Version
|
103
129
|
version: '0'
|
104
|
-
segments:
|
105
|
-
- 0
|
106
|
-
hash: -1812501221866682820
|
107
130
|
requirements: []
|
108
131
|
rubyforge_project:
|
109
|
-
rubygems_version: 1.
|
132
|
+
rubygems_version: 2.1.10
|
110
133
|
signing_key:
|
111
|
-
specification_version:
|
134
|
+
specification_version: 4
|
112
135
|
summary: The World's Most Flexible E-Commerce Platform meets The World's Most Flexible
|
113
136
|
Content Management System!
|
114
137
|
test_files:
|
@@ -1,36 +0,0 @@
|
|
1
|
-
<% prefix = Rails.application.config.assets.prefix -%>
|
2
|
-
<script type="text/javascript">
|
3
|
-
var tinyMCEPreInit = {
|
4
|
-
base: '<%= prefix -%>/tiny_mce',
|
5
|
-
suffix: ''
|
6
|
-
};
|
7
|
-
</script>
|
8
|
-
<script type="text/javascript" src="<%= prefix -%>/tiny_mce/tiny_mce.js"></script>
|
9
|
-
<script type="text/javascript">
|
10
|
-
jQuery(function($) {
|
11
|
-
if ($('textarea#product_description').length > 0) {
|
12
|
-
tinyMCE.init({
|
13
|
-
mode : "exact",
|
14
|
-
elements : 'product_description',
|
15
|
-
theme : "advanced",
|
16
|
-
language : '<%= ::I18n.locale.to_s.split('-')[0].downcase -%>',
|
17
|
-
skin : "o2k7",
|
18
|
-
skin_variant : 'silver',
|
19
|
-
inlinepopups_skin : 'alchemy',
|
20
|
-
popup_css : "<%= prefix -%>/alchemy/tinymce_dialog.css",
|
21
|
-
content_css : "<%= prefix -%>/alchemy/tinymce_content.css",
|
22
|
-
width : "100%",
|
23
|
-
plugins : "paste,inlinepopups",
|
24
|
-
|
25
|
-
// Theme options
|
26
|
-
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,sub,sup,|,numlist,bullist,indent,outdent,|,removeformat,cleanup",
|
27
|
-
theme_advanced_buttons2 : "pastetext,pasteword,|,link,unlink,|,charmap,code,help",
|
28
|
-
theme_advanced_buttons3 : "",
|
29
|
-
theme_advanced_toolbar_location : "top",
|
30
|
-
theme_advanced_toolbar_align : "left",
|
31
|
-
theme_advanced_statusbar_location : "bottom",
|
32
|
-
theme_advanced_resizing : true
|
33
|
-
});
|
34
|
-
}
|
35
|
-
});
|
36
|
-
</script>
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
require "alchemy_cms"
|
4
|
-
|
5
|
-
Alchemy::Modules.register_module({
|
6
|
-
:name => 'spree',
|
7
|
-
:engine_name => 'alchemy_spree',
|
8
|
-
:navigation => {
|
9
|
-
:controller => 'alchemy/admin/spree',
|
10
|
-
:action => 'index',
|
11
|
-
:name => 'Shop',
|
12
|
-
:image => '/assets/alchemy_spree/alchemy_module_icon.png'
|
13
|
-
}
|
14
|
-
})
|
15
|
-
|
16
|
-
Alchemy::AuthEngine.get_instance.load(File.join(File.dirname(__FILE__), '../..', 'config/authorization_rules.rb'))
|
data/lib/alchemy_spree/engine.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require "alchemy_spree/alchemy_module"
|
2
|
-
require 'alchemy_spree/alchemy_language_store'
|
3
|
-
|
4
|
-
module AlchemySpree
|
5
|
-
class Engine < ::Rails::Engine
|
6
|
-
engine_name 'alchemy_spree'
|
7
|
-
|
8
|
-
if defined?(Spree.user_class)
|
9
|
-
initializer 'spree.user_class', :after => 'alchemy.include_authentication_helpers' do
|
10
|
-
Spree.user_class = "Alchemy::User"
|
11
|
-
require File.join(File.dirname(__FILE__), '../spree/authentication_helpers')
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.activate
|
16
|
-
Dir.glob(File.join(File.dirname(__FILE__), "../../app/**/*_decorator*.rb")) do |c|
|
17
|
-
Rails.configuration.cache_classes ? require(c) : load(c)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
config.to_prepare &method(:activate).to_proc
|
22
|
-
end
|
23
|
-
end
|