alchemy_spree 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -3,6 +3,9 @@ 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
+
6
9
  group :developmemt, :test do
7
- gem 'sqlite3'
10
+ gem 'sqlite3'
8
11
  end
@@ -1 +1,3 @@
1
- '1.0.x' => {:branch => 'master'}
1
+ '1.0.x' => {:branch => 'master'}
2
+ '1.1.x' => {:branch => 'master'}
3
+ '1.2.x' => {:branch => 'master'}
@@ -15,6 +15,6 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = AlchemySpree::VERSION
17
17
 
18
- gem.add_dependency('alchemy_cms', ['~> 2.1.6'])
19
- gem.add_dependency('spree', ['~> 1.0.1'])
18
+ #gem.add_dependency('alchemy_cms', ['~> 2.2.rc12'])
19
+ #gem.add_dependency('spree', ['~> 1.1.0.beta'])
20
20
  end
@@ -1,3 +1,3 @@
1
1
  Spree::BaseController.class_eval do
2
- include AlchemyCrm::AlchemyLanguageIdStore
2
+ include AlchemySpree::AlchemyLanguageStore
3
3
  end
@@ -1,3 +1,5 @@
1
- Spree::UserSessionsController.class_eval do
2
- include AlchemyCrm::AlchemyLanguageIdStore
1
+ if defined? Spree::UserSessionsController
2
+ Spree::UserSessionsController.class_eval do
3
+ include AlchemySpree::AlchemyLanguageStore
4
+ end
3
5
  end
@@ -0,0 +1,14 @@
1
+ module Alchemy
2
+ User.class_eval do
3
+
4
+ def spree_roles
5
+ @spree_admin_role ||= Spree::Role.find_or_create_by_name("admin")
6
+ if admin?
7
+ [@spree_admin_role]
8
+ else
9
+ []
10
+ end
11
+ end
12
+
13
+ end
14
+ end
@@ -1,18 +1,41 @@
1
1
  <%= image_tag('alchemy/ajax_loader.gif', :id => "frame_load_info", :style => "position: absolute; top: 50%; left: 50%; margin-top: -12px; margin-left: -12px") %>
2
2
  <iframe src="<%= spree.admin_url(:protocol => Rails.env.production? ? 'https' : nil) %>" frameborder=0 width="100%" id="spree_admin" style="display: none"></iframe>
3
3
  <script type="text/javascript">
4
- jQuery(document).ready(function($) {
5
- var $frame = $('iframe#spree_admin');
6
- function sizeSpreeFrame() {
7
- $frame.css({height: $(window).height()-62});
8
- }
9
- $('#toolbar').remove();
10
- $frame.on('load', function() {
11
- $('#main_content').css({'background-color': '#162F54'});
12
- sizeSpreeFrame();
13
- $('#frame_load_info').hide();
14
- $frame.show();
15
- });
16
- $(window).on('resize', sizeSpreeFrame);
17
- });
4
+ jQuery(document).ready(function($) {
5
+ var $frame = $('iframe#spree_admin');
6
+
7
+ function sizeSpreeFrame() {
8
+ $frame.css({height: $(window).height() - 30});
9
+ }
10
+
11
+ $('#toolbar').remove();
12
+ $('#archive_all').css({padding: 0});
13
+
14
+ $frame.on('load', function() {
15
+ var frame_document;
16
+ var frame_window = (this.contentWindow || this.contentDocument);
17
+ var elements = ['header', 'footer', 'admin-menu', 'sub-menu', 'content'];
18
+ if (frame_window.document) {
19
+ frame_document = frame_window.document;
20
+ } else {
21
+ frame_document = frame_window;
22
+ frame_window = frame_document.window;
23
+ }
24
+ frame_document.body.style.backgroundColor = '#EDEDED';
25
+ frame_document.body.style.fontFamily = '"Lucida Grande", Arial, sans-serif';
26
+ frame_document.body.style.fontSize = '12px';
27
+ for (var i = elements.length - 1; i >= 0; i--) {
28
+ element = frame_document.getElementById(elements[i]);
29
+ if (element) {
30
+ if (element.id === 'header' || element.id === 'footer') element.style.display = 'none';
31
+ element.style.margin = 0;
32
+ }
33
+ }
34
+ sizeSpreeFrame();
35
+ $('#frame_load_info').hide();
36
+ $frame.show();
37
+ });
38
+
39
+ $(window).on('resize', sizeSpreeFrame);
40
+ });
18
41
  </script>
@@ -1 +1 @@
1
- require "alchemy_spree/engine"
1
+ require "alchemy_spree/engine"
@@ -0,0 +1,17 @@
1
+ module AlchemySpree
2
+ module AlchemyLanguageStore
3
+ def self.included(c)
4
+ c.send(:before_filter, :store_alchemy_language)
5
+ end
6
+
7
+ private
8
+
9
+ def store_alchemy_language
10
+ @alchemy_language ||= Alchemy::Language.find_by_code(::I18n.locale.to_s)
11
+ @alchemy_language ||= Alchemy::Language.get_default
12
+ session[:language_id] = @alchemy_language.id
13
+ session[:language_code] = @alchemy_language.code
14
+ end
15
+
16
+ end
17
+ end
@@ -1,10 +1,17 @@
1
1
  require "alchemy_spree/alchemy_module"
2
- require 'alchemy_spree/alchemy_language_id_store'
2
+ require 'alchemy_spree/alchemy_language_store'
3
3
 
4
4
  module AlchemySpree
5
5
  class Engine < ::Rails::Engine
6
6
  engine_name 'alchemy_spree'
7
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
+
8
15
  def self.activate
9
16
  Dir.glob(File.join(File.dirname(__FILE__), "../../app/**/*_decorator*.rb")) do |c|
10
17
  Rails.configuration.cache_classes ? require(c) : load(c)
@@ -1,3 +1,3 @@
1
1
  module AlchemySpree
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -0,0 +1,28 @@
1
+ module Spree
2
+ module AuthenticationHelpers
3
+ def self.included(receiver)
4
+ receiver.send :helper_method, :spree_login_path
5
+ receiver.send :helper_method, :spree_signup_path
6
+ receiver.send :helper_method, :spree_logout_path
7
+ receiver.send :helper_method, :spree_current_user
8
+ end
9
+
10
+ def spree_current_user
11
+ current_alchemy_user
12
+ end
13
+
14
+ def spree_login_path
15
+ alchemy.login_path
16
+ end
17
+
18
+ def spree_signup_path
19
+ alchemy.signup_path
20
+ end
21
+
22
+ def spree_logout_path
23
+ alchemy.logout_path
24
+ end
25
+ end
26
+ end
27
+
28
+ ApplicationController.send :include, Spree::AuthenticationHelpers
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy_spree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,30 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-12 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: alchemy_cms
16
- requirement: &70101865134720 !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: 2.1.6
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: *70101865134720
25
- - !ruby/object:Gem::Dependency
26
- name: spree
27
- requirement: &70101865133520 !ruby/object:Gem::Requirement
28
- none: false
29
- requirements:
30
- - - ~>
31
- - !ruby/object:Gem::Version
32
- version: 1.0.1
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: *70101865133520
12
+ date: 2012-06-11 00:00:00.000000000 Z
13
+ dependencies: []
36
14
  description: A Alchemy CMS and Spree connector
37
15
  email:
38
16
  - tvd@magiclabs.de
@@ -52,6 +30,7 @@ files:
52
30
  - app/controllers/spree/base_controller_decorator.rb
53
31
  - app/controllers/spree/user_sessions_controller_decorator.rb
54
32
  - app/models/alchemy/essence_spree_product.rb
33
+ - app/models/alchemy/user_decorator.rb
55
34
  - app/overrides/include_tinymce_js.rb
56
35
  - app/views/alchemy/admin/spree/index.html.erb
57
36
  - app/views/alchemy/essences/_essence_spree_product_editor.html.erb
@@ -61,10 +40,11 @@ files:
61
40
  - config/routes.rb
62
41
  - db/migrate/20120229160509_create_alchemy_essence_spree_products.rb
63
42
  - lib/alchemy_spree.rb
64
- - lib/alchemy_spree/alchemy_language_id_store.rb
43
+ - lib/alchemy_spree/alchemy_language_store.rb
65
44
  - lib/alchemy_spree/alchemy_module.rb
66
45
  - lib/alchemy_spree/engine.rb
67
46
  - lib/alchemy_spree/version.rb
47
+ - lib/spree/authentication_helpers.rb
68
48
  - script/rails
69
49
  - test/alchemy_spree_test.rb
70
50
  - test/dummy/Rakefile
@@ -114,7 +94,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
94
  version: '0'
115
95
  segments:
116
96
  - 0
117
- hash: -4177371760149923254
97
+ hash: -1812501221866682820
118
98
  required_rubygems_version: !ruby/object:Gem::Requirement
119
99
  none: false
120
100
  requirements:
@@ -123,10 +103,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
103
  version: '0'
124
104
  segments:
125
105
  - 0
126
- hash: -4177371760149923254
106
+ hash: -1812501221866682820
127
107
  requirements: []
128
108
  rubyforge_project:
129
- rubygems_version: 1.8.15
109
+ rubygems_version: 1.8.24
130
110
  signing_key:
131
111
  specification_version: 3
132
112
  summary: The World's Most Flexible E-Commerce Platform meets The World's Most Flexible
@@ -1,14 +0,0 @@
1
- module AlchemyCrm
2
- module AlchemyLanguageIdStore
3
- def self.included(c)
4
- c.send(:before_filter, :store_alchemy_language_id)
5
- end
6
-
7
- private
8
-
9
- def store_alchemy_language_id
10
- session[:language_id] ||= Alchemy::Language.get_default.id
11
- end
12
-
13
- end
14
- end