spree_core 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,6 +7,10 @@ module Spree
7
7
  before_filter :load_data, :except => :index
8
8
  update.before :update_before
9
9
 
10
+ def show
11
+ redirect_to( :action => :edit )
12
+ end
13
+
10
14
  def index
11
15
  respond_with(@collection) do |format|
12
16
  format.html
@@ -13,7 +13,7 @@ module Spree
13
13
  end
14
14
 
15
15
  def show
16
- @product = Product.find_by_permalink!(params[:id])
16
+ @product = Product.active.find_by_permalink!(params[:id])
17
17
  return unless @product
18
18
 
19
19
  @variants = Variant.active.includes([:option_values, :images]).where(:product_id => @product.id)
@@ -7,7 +7,10 @@ module Spree
7
7
  end
8
8
 
9
9
  def compute(object=nil)
10
- self.preferred_amount * object.line_items.length
10
+ return 0 if object.nil?
11
+ self.preferred_amount * object.line_items.reduce(0) do |sum, value|
12
+ sum + value.quantity
13
+ end
11
14
  end
12
15
  end
13
16
  end
@@ -553,11 +553,8 @@ module Spree
553
553
  end
554
554
 
555
555
  def restock_items!
556
- shipments.each do |shipment|
557
- shipment.inventory_units.each do |inventory_unit|
558
- line_item = line_items.find_by_variant_id(inventory_unit.variant_id)
559
- InventoryUnit.decrease(self, inventory_unit.variant, line_item.quantity)
560
- end
556
+ line_items.each do |line_item|
557
+ InventoryUnit.decrease(self, line_item.variant, line_item.quantity)
561
558
  end
562
559
  end
563
560
 
@@ -566,11 +563,8 @@ module Spree
566
563
  end
567
564
 
568
565
  def unstock_items!
569
- shipments.each do |shipment|
570
- shipment.inventory_units.each do |inventory_unit|
571
- line_item = line_items.find_by_variant_id(inventory_unit.variant_id)
572
- InventoryUnit.increase(self, inventory_unit.variant, line_item.quantity)
573
- end
566
+ line_items.each do |line_item|
567
+ InventoryUnit.increase(self, line_item.variant, line_item.quantity)
574
568
  end
575
569
  end
576
570
 
@@ -2,16 +2,21 @@
2
2
 
3
3
  <h2><%= t(:new) %> <%= t("activerecord.models.#{@payment.class.to_s.underscore}.one") %></h2>
4
4
 
5
- <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @payment } %>
5
+ <% if @payment_methods.any? %>
6
+ <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @payment } %>
6
7
 
7
- <%= form_for @payment, :url => admin_order_payments_path(@order) do |f| %>
8
+ <%= form_for @payment, :url => admin_order_payments_path(@order) do |f| %>
8
9
 
9
- <%= render :partial => 'form', :locals => { :f => f } %>
10
+ <%= render :partial => 'form', :locals => { :f => f } %>
10
11
 
11
- <p class="form-buttons" data-hook="buttons">
12
- <%= button @order.cart? ? t(:continue) : t(:update) %>
13
- </p>
12
+ <p class="form-buttons" data-hook="buttons">
13
+ <%= button @order.cart? ? t(:continue) : t(:update) %>
14
+ </p>
14
15
 
16
+ <% end %>
17
+ <% else %>
18
+ <%= t(:cannot_create_payment_without_payment_methods) %>
19
+ <%= link_to t(:please_define_payment_methods), admin_payment_methods_url %>
15
20
  <% end %>
16
21
 
17
22
  <% content_for :head do %>
@@ -284,6 +284,7 @@ en:
284
284
  cancel_my_account: Cancel my account
285
285
  cancel_my_account_description: "Unhappy?"
286
286
  canceled: Canceled
287
+ cannot_create_payment_without_payment_methods: You cannot create a payment for an order without any payment methods defined.
287
288
  cannot_create_returns: Cannot create returns as this order has no shipped units.
288
289
  cannot_perform_operation: "Cannot perform requested operation"
289
290
  capture: Capture
@@ -668,6 +669,7 @@ en:
668
669
  phone: Phone
669
670
  place_order: Place Order
670
671
  please_create_user: "Please create a user account"
672
+ please_define_payment_methods: "Please define some payment methods first."
671
673
  powered_by: "Powered by"
672
674
  presentation: Presentation
673
675
  preview: Preview
@@ -74,10 +74,6 @@ module Spree
74
74
  app.config.assets.precompile += ['store/all.*', 'admin/all.*', 'admin/orders/edit_form.js', 'admin/address_states.js', 'jqPlot/excanvas.min.js', 'admin/images/new.js', 'jquery.jstree/themes/apple/*']
75
75
  end
76
76
 
77
- initializer "spree.asset.pipeline" do |app|
78
- app.config.assets.debug = false
79
- end
80
-
81
77
  initializer "spree.mail.settings" do |app|
82
78
  if Spree::MailMethod.table_exists?
83
79
  Spree::Core::MailSettings.init
@@ -0,0 +1,9 @@
1
+ module Spree
2
+ module Core
3
+ module UrlHelpers
4
+ def spree
5
+ Spree::Core::Engine.routes.url_helpers
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  module Spree
2
2
  def self.version
3
- "1.0.3"
3
+ "1.0.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-16 00:00:00.000000000 Z
12
+ date: 2012-04-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: acts_as_list
16
- requirement: &70306761339840 !ruby/object:Gem::Requirement
16
+ requirement: &70302537108460 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - =
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.1.4
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70306761339840
24
+ version_requirements: *70302537108460
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: nested_set
27
- requirement: &70306761334700 !ruby/object:Gem::Requirement
27
+ requirement: &70302537107400 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - =
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.6.8
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70306761334700
35
+ version_requirements: *70302537107400
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: jquery-rails
38
- requirement: &70306761348180 !ruby/object:Gem::Requirement
38
+ requirement: &70302537106340 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -46,10 +46,10 @@ dependencies:
46
46
  version: 1.0.19
47
47
  type: :runtime
48
48
  prerelease: false
49
- version_requirements: *70306761348180
49
+ version_requirements: *70302537106340
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: highline
52
- requirement: &70306761367760 !ruby/object:Gem::Requirement
52
+ requirement: &70302537104500 !ruby/object:Gem::Requirement
53
53
  none: false
54
54
  requirements:
55
55
  - - =
@@ -57,10 +57,10 @@ dependencies:
57
57
  version: 1.6.8
58
58
  type: :runtime
59
59
  prerelease: false
60
- version_requirements: *70306761367760
60
+ version_requirements: *70302537104500
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: state_machine
63
- requirement: &70306761365620 !ruby/object:Gem::Requirement
63
+ requirement: &70302537124460 !ruby/object:Gem::Requirement
64
64
  none: false
65
65
  requirements:
66
66
  - - =
@@ -68,10 +68,10 @@ dependencies:
68
68
  version: 1.1.1
69
69
  type: :runtime
70
70
  prerelease: false
71
- version_requirements: *70306761365620
71
+ version_requirements: *70302537124460
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: ffaker
74
- requirement: &70306761362000 !ruby/object:Gem::Requirement
74
+ requirement: &70302537123780 !ruby/object:Gem::Requirement
75
75
  none: false
76
76
  requirements:
77
77
  - - ~>
@@ -79,21 +79,21 @@ dependencies:
79
79
  version: 1.12.0
80
80
  type: :runtime
81
81
  prerelease: false
82
- version_requirements: *70306761362000
82
+ version_requirements: *70302537123780
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: paperclip
85
- requirement: &70306761374600 !ruby/object:Gem::Requirement
85
+ requirement: &70302537123120 !ruby/object:Gem::Requirement
86
86
  none: false
87
87
  requirements:
88
88
  - - =
89
89
  - !ruby/object:Gem::Version
90
- version: 2.5.0
90
+ version: 2.7.0
91
91
  type: :runtime
92
92
  prerelease: false
93
- version_requirements: *70306761374600
93
+ version_requirements: *70302537123120
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: meta_search
96
- requirement: &70306761373120 !ruby/object:Gem::Requirement
96
+ requirement: &70302537122500 !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
99
99
  - - =
@@ -101,10 +101,10 @@ dependencies:
101
101
  version: 1.1.1
102
102
  type: :runtime
103
103
  prerelease: false
104
- version_requirements: *70306761373120
104
+ version_requirements: *70302537122500
105
105
  - !ruby/object:Gem::Dependency
106
106
  name: activemerchant
107
- requirement: &70306761371140 !ruby/object:Gem::Requirement
107
+ requirement: &70302537121860 !ruby/object:Gem::Requirement
108
108
  none: false
109
109
  requirements:
110
110
  - - =
@@ -112,10 +112,10 @@ dependencies:
112
112
  version: 1.20.1
113
113
  type: :runtime
114
114
  prerelease: false
115
- version_requirements: *70306761371140
115
+ version_requirements: *70302537121860
116
116
  - !ruby/object:Gem::Dependency
117
117
  name: rails
118
- requirement: &70306761368680 !ruby/object:Gem::Requirement
118
+ requirement: &70302537121300 !ruby/object:Gem::Requirement
119
119
  none: false
120
120
  requirements:
121
121
  - - ! '>='
@@ -126,10 +126,10 @@ dependencies:
126
126
  version: 3.1.4
127
127
  type: :runtime
128
128
  prerelease: false
129
- version_requirements: *70306761368680
129
+ version_requirements: *70302537121300
130
130
  - !ruby/object:Gem::Dependency
131
131
  name: kaminari
132
- requirement: &70306761391800 !ruby/object:Gem::Requirement
132
+ requirement: &70302537119740 !ruby/object:Gem::Requirement
133
133
  none: false
134
134
  requirements:
135
135
  - - ! '>='
@@ -137,10 +137,10 @@ dependencies:
137
137
  version: 0.13.0
138
138
  type: :runtime
139
139
  prerelease: false
140
- version_requirements: *70306761391800
140
+ version_requirements: *70302537119740
141
141
  - !ruby/object:Gem::Dependency
142
142
  name: deface
143
- requirement: &70306761389880 !ruby/object:Gem::Requirement
143
+ requirement: &70302537118780 !ruby/object:Gem::Requirement
144
144
  none: false
145
145
  requirements:
146
146
  - - ! '>='
@@ -148,10 +148,10 @@ dependencies:
148
148
  version: 0.7.2
149
149
  type: :runtime
150
150
  prerelease: false
151
- version_requirements: *70306761389880
151
+ version_requirements: *70302537118780
152
152
  - !ruby/object:Gem::Dependency
153
153
  name: stringex
154
- requirement: &70306761408520 !ruby/object:Gem::Requirement
154
+ requirement: &70302537117760 !ruby/object:Gem::Requirement
155
155
  none: false
156
156
  requirements:
157
157
  - - ~>
@@ -159,7 +159,7 @@ dependencies:
159
159
  version: 1.3.0
160
160
  type: :runtime
161
161
  prerelease: false
162
- version_requirements: *70306761408520
162
+ version_requirements: *70302537117760
163
163
  description: Required dependency for Spree
164
164
  email: sean@spreecommerce.com
165
165
  executables: []
@@ -521,7 +521,6 @@ files:
521
521
  - app/views/spree/admin/products/index.html.erb
522
522
  - app/views/spree/admin/products/new.html.erb
523
523
  - app/views/spree/admin/products/new.js.erb
524
- - app/views/spree/admin/products/show.html.erb
525
524
  - app/views/spree/admin/properties/_form.html.erb
526
525
  - app/views/spree/admin/properties/edit.html.erb
527
526
  - app/views/spree/admin/properties/filtered.html.erb
@@ -761,6 +760,7 @@ files:
761
760
  - lib/spree/core/testing_support/factories.rb
762
761
  - lib/spree/core/theme_support/hook_listener.rb
763
762
  - lib/spree/core/theme_support.rb
763
+ - lib/spree/core/url_helpers.rb
764
764
  - lib/spree/core/user_banners.rb
765
765
  - lib/spree/core/version.rb
766
766
  - lib/spree/core.rb
@@ -973,7 +973,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
973
973
  version: '0'
974
974
  segments:
975
975
  - 0
976
- hash: -2934504040878488639
976
+ hash: -350126003318038634
977
977
  requirements:
978
978
  - none
979
979
  rubyforge_project: spree_core
@@ -1,4 +0,0 @@
1
- <%= render :partial => 'shared/product_sub_menu' %>
2
- TODO - show product details here <br /><br />
3
-
4
- <%= render :partial => 'shared/show_resource_links' %>