spree_core 0.30.0 → 0.30.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -68,6 +68,7 @@ class CheckoutController < Spree::BaseController
68
68
  end
69
69
 
70
70
  def before_delivery
71
+ return if params[:order].present?
71
72
  @order.shipping_method ||= (@order.rate_hash.first && @order.rate_hash.first[:shipping_method])
72
73
  end
73
74
 
@@ -1,13 +1,22 @@
1
1
  class ContentController < Spree::BaseController
2
2
 
3
+ before_filter :render_404, :if => :static_asset
4
+
3
5
  rescue_from ActionView::MissingTemplate, :with => :render_404
4
6
  caches_page :show, :index, :if => Proc.new { Spree::Config[:cache_static_content] }
5
7
 
6
8
  def show
7
9
  render params[:path]
8
10
  end
9
-
11
+
10
12
  def cvv
11
13
  render "cvv", :layout => false
12
- end
14
+ end
15
+
16
+ private
17
+ # Determines if the requested resource has a path similar to that of a static asset. In this case do not go through the
18
+ # overhead of trying to render a template or whatever.
19
+ def static_asset
20
+ params[:path] =~ /^\/([^.]+)$/
21
+ end
13
22
  end
data/app/models/order.rb CHANGED
@@ -145,6 +145,11 @@ class Order < ActiveRecord::Base
145
145
  :total => total
146
146
  })
147
147
 
148
+ #ensure checkout payment always matches order total
149
+ if payment and payment.checkout? and payment.amount != total
150
+ payment.update_attributes_without_callbacks(:amount => total)
151
+ end
152
+
148
153
  update_hooks.each { |hook| self.send hook }
149
154
  end
150
155
 
@@ -309,18 +314,13 @@ class Order < ActiveRecord::Base
309
314
  end
310
315
 
311
316
  def rate_hash
312
- begin
313
- @rate_hash ||= available_shipping_methods(:front_end).collect do |ship_method|
314
- { :id => ship_method.id,
315
- :shipping_method => ship_method,
316
- :name => ship_method.name,
317
- :cost => ship_method.calculator.compute(self)
318
- }
319
- end.sort_by{|r| r[:cost]}
320
- rescue Spree::ShippingError => ship_error
321
- flash[:error] = ship_error.to_s
322
- []
323
- end
317
+ @rate_hash ||= available_shipping_methods(:front_end).collect do |ship_method|
318
+ { :id => ship_method.id,
319
+ :shipping_method => ship_method,
320
+ :name => ship_method.name,
321
+ :cost => ship_method.calculator.compute(self)
322
+ }
323
+ end.sort_by{|r| r[:cost]}
324
324
  end
325
325
 
326
326
  def payment
@@ -14,7 +14,7 @@ class ReturnAuthorization < ActiveRecord::Base
14
14
  transition :to => 'received', :from => 'authorized', :if => :allow_receive?
15
15
  end
16
16
  event :cancel do
17
- transition :to => 'cancelled', :from => 'authorized'
17
+ transition :to => 'canceled', :from => 'authorized'
18
18
  end
19
19
  end
20
20
 
@@ -10,7 +10,7 @@
10
10
  <td><%=ot.name %></td>
11
11
  <td><%=ot.presentation %></td>
12
12
  <td class="actions"><%= link_to icon('add') + ' ' + t("select"),
13
- url_for (:controller => "admin/option_types",
13
+ url_for(:controller => "admin/option_types",
14
14
  :id => ot,
15
15
  :product_id => @product.permalink,
16
16
  :action => "select",
@@ -24,4 +24,4 @@
24
24
  <td colspan="3"><%= t('none_available') %></td>
25
25
  </tr>
26
26
  <% end %>
27
- </table>
27
+ </table>
@@ -8,22 +8,22 @@
8
8
  <ul class="sidebar product-menu">
9
9
  <%= hook :admin_product_tabs, {:current => current} do %>
10
10
 
11
- <li<%= ' class="active"' if current == "Product Details" %>>
11
+ <li<%= raw(' class="active"') if current == "Product Details" %>>
12
12
  <%= link_to t("product_details"), edit_admin_product_url(@product) %>
13
13
  </li>
14
- <li<%= ' class="active"' if current == "Images" %>>
14
+ <li<%= raw(' class="active"') if current == "Images" %>>
15
15
  <%= link_to t("images"), admin_product_images_url(@product) %>
16
16
  </li>
17
- <li<%= ' class="active"' if current == "Variants" %>>
17
+ <li<%= raw(' class="active"') if current == "Variants" %>>
18
18
  <%= link_to t("variants"), admin_product_variants_url(@product) %>
19
19
  </li>
20
- <li<%= ' class="active"' if current == "Option Types" %>>
20
+ <li<%= raw(' class="active"') if current == "Option Types" %>>
21
21
  <%= link_to t("option_types"), selected_admin_product_option_types_url(@product) %>
22
22
  </li>
23
- <li<%= ' class="active"' if current == "Product Properties" %>>
23
+ <li<%= raw(' class="active"') if current == "Product Properties" %>>
24
24
  <%= link_to t("product_properties"), admin_product_product_properties_url(@product) %>
25
25
  </li>
26
- <li<%= ' class="active"' if current == "Taxons" %>>
26
+ <li<%= raw(' class="active"') if current == "Taxons" %>>
27
27
  <%= link_to t("taxons"), selected_admin_product_taxons_url(@product) %>
28
28
  </li>
29
29
 
data/config/routes.rb CHANGED
@@ -188,6 +188,6 @@ Rails.application.routes.draw do
188
188
 
189
189
  # a catchall route for "static" content (except paths with explicit extensions: .html, .ico, etc)
190
190
  #if Spree::Config.instance && Spree::Config.get(:use_content_controller)
191
- match '/*path' => 'content#show', :constraints => { :fullpath => /^\/([^.]+)$/ }
191
+ match '/*path' => 'content#show'
192
192
  #end
193
193
  end
@@ -1,9 +1,10 @@
1
1
  class ChangePreferenceValueType < ActiveRecord::Migration
2
2
  def self.up
3
- change_column :preferences, :value, :text
3
+ remove_index :preferences, :name => 'index_preferences_on_owner_and_attribute_and_preference'
4
+ change_column :preferences, :value, :text
4
5
  end
5
6
 
6
7
  def self.down
7
- change_column :preferences, :value, :string
8
+ change_column :preferences, :value, :string
8
9
  end
9
10
  end
@@ -0,0 +1,10 @@
1
+ class RenamedRmaCancelledState < ActiveRecord::Migration
2
+ def self.up
3
+ ReturnAuthorization.where(:state => 'cancelled').each do |rma|
4
+ rma.update_attribute_without_callbacks(:state, 'canceled')
5
+ end
6
+ end
7
+
8
+ def self.down
9
+ end
10
+ end
@@ -0,0 +1,13 @@
1
+ class FixProblematicIndexNames < ActiveRecord::Migration
2
+ def self.up
3
+ begin
4
+ remove_index("preferences", "index_preferences_on_owner_and_attribute_and_preference")
5
+ rescue ArgumentError
6
+ # ignore - already remove then
7
+ end
8
+ add_index "preferences", ["owner_id", "owner_type", "name", "group_id", "group_type"], :name => "ix_prefs_on_owner_attr_pref", :unique => true
9
+ end
10
+
11
+ def self.down
12
+ end
13
+ end
data/lib/spree_core.rb CHANGED
@@ -65,7 +65,7 @@ end
65
65
 
66
66
  module Spree
67
67
  def self.version
68
- "0.30.0"
68
+ "0.30.1"
69
69
  end
70
70
  end
71
71
 
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_core
3
3
  version: !ruby/object:Gem::Version
4
- hash: 103
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 30
9
- - 0
10
- version: 0.30.0
8
+ - 1
9
+ version: 0.30.1
11
10
  platform: ruby
12
11
  authors:
13
12
  - Sean Schofield
@@ -15,18 +14,16 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-11-09 00:00:00 -05:00
17
+ date: 2010-11-17 00:00:00 -05:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: acts_as_list
23
22
  prerelease: false
24
23
  requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
24
  requirements:
27
25
  - - ">="
28
26
  - !ruby/object:Gem::Version
29
- hash: 31
30
27
  segments:
31
28
  - 0
32
29
  - 1
@@ -38,11 +35,9 @@ dependencies:
38
35
  name: rd_awesome_nested_set
39
36
  prerelease: false
40
37
  requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
38
  requirements:
43
39
  - - ">="
44
40
  - !ruby/object:Gem::Version
45
- hash: 15
46
41
  segments:
47
42
  - 1
48
43
  - 4
@@ -54,11 +49,9 @@ dependencies:
54
49
  name: rd_unobtrusive_date_picker
55
50
  prerelease: false
56
51
  requirement: &id003 !ruby/object:Gem::Requirement
57
- none: false
58
52
  requirements:
59
53
  - - ">="
60
54
  - !ruby/object:Gem::Version
61
- hash: 27
62
55
  segments:
63
56
  - 0
64
57
  - 1
@@ -70,11 +63,9 @@ dependencies:
70
63
  name: highline
71
64
  prerelease: false
72
65
  requirement: &id004 !ruby/object:Gem::Requirement
73
- none: false
74
66
  requirements:
75
67
  - - ">="
76
68
  - !ruby/object:Gem::Version
77
- hash: 1
78
69
  segments:
79
70
  - 1
80
71
  - 5
@@ -86,11 +77,9 @@ dependencies:
86
77
  name: stringex
87
78
  prerelease: false
88
79
  requirement: &id005 !ruby/object:Gem::Requirement
89
- none: false
90
80
  requirements:
91
81
  - - ">="
92
82
  - !ruby/object:Gem::Version
93
- hash: 17
94
83
  segments:
95
84
  - 1
96
85
  - 0
@@ -102,11 +91,9 @@ dependencies:
102
91
  name: state_machine
103
92
  prerelease: false
104
93
  requirement: &id006 !ruby/object:Gem::Requirement
105
- none: false
106
94
  requirements:
107
95
  - - ">="
108
96
  - !ruby/object:Gem::Version
109
- hash: 51
110
97
  segments:
111
98
  - 0
112
99
  - 9
@@ -118,11 +105,9 @@ dependencies:
118
105
  name: faker
119
106
  prerelease: false
120
107
  requirement: &id007 !ruby/object:Gem::Requirement
121
- none: false
122
108
  requirements:
123
109
  - - ">="
124
110
  - !ruby/object:Gem::Version
125
- hash: 17
126
111
  segments:
127
112
  - 0
128
113
  - 3
@@ -134,11 +119,9 @@ dependencies:
134
119
  name: paperclip
135
120
  prerelease: false
136
121
  requirement: &id008 !ruby/object:Gem::Requirement
137
- none: false
138
122
  requirements:
139
123
  - - ">="
140
124
  - !ruby/object:Gem::Version
141
- hash: 113
142
125
  segments:
143
126
  - 2
144
127
  - 3
@@ -151,11 +134,9 @@ dependencies:
151
134
  name: rd_resource_controller
152
135
  prerelease: false
153
136
  requirement: &id009 !ruby/object:Gem::Requirement
154
- none: false
155
137
  requirements:
156
138
  - - ">="
157
139
  - !ruby/object:Gem::Version
158
- hash: 3
159
140
  segments:
160
141
  - 0
161
142
  version: "0"
@@ -165,11 +146,9 @@ dependencies:
165
146
  name: rd_searchlogic
166
147
  prerelease: false
167
148
  requirement: &id010 !ruby/object:Gem::Requirement
168
- none: false
169
149
  requirements:
170
150
  - - ">="
171
151
  - !ruby/object:Gem::Version
172
- hash: 977940604
173
152
  segments:
174
153
  - 3
175
154
  - 0
@@ -182,11 +161,9 @@ dependencies:
182
161
  name: activemerchant
183
162
  prerelease: false
184
163
  requirement: &id011 !ruby/object:Gem::Requirement
185
- none: false
186
164
  requirements:
187
165
  - - ">="
188
166
  - !ruby/object:Gem::Version
189
- hash: 9
190
167
  segments:
191
168
  - 1
192
169
  - 7
@@ -198,11 +175,9 @@ dependencies:
198
175
  name: will_paginate
199
176
  prerelease: false
200
177
  requirement: &id012 !ruby/object:Gem::Requirement
201
- none: false
202
178
  requirements:
203
179
  - - ">="
204
180
  - !ruby/object:Gem::Version
205
- hash: 961915916
206
181
  segments:
207
182
  - 3
208
183
  - 0
@@ -214,11 +189,9 @@ dependencies:
214
189
  name: rails
215
190
  prerelease: false
216
191
  requirement: &id013 !ruby/object:Gem::Requirement
217
- none: false
218
192
  requirements:
219
193
  - - ">="
220
194
  - !ruby/object:Gem::Version
221
- hash: 5
222
195
  segments:
223
196
  - 3
224
197
  - 0
@@ -230,11 +203,9 @@ dependencies:
230
203
  name: jquery-rails
231
204
  prerelease: false
232
205
  requirement: &id014 !ruby/object:Gem::Requirement
233
- none: false
234
206
  requirements:
235
207
  - - ">="
236
208
  - !ruby/object:Gem::Version
237
- hash: 19
238
209
  segments:
239
210
  - 0
240
211
  - 2
@@ -748,7 +719,6 @@ files:
748
719
  - db/migrate/20100820135707_response_code_and_avs_response_for_payments.rb
749
720
  - db/migrate/20100901171814_change_guest_flag_to_anonymous.rb
750
721
  - db/migrate/20100903203949_email_for_orders.rb
751
- - db/migrate/20100908170204_remove_unique_index_on_users_email.rb
752
722
  - db/migrate/20100923162011_create_mail_methods.rb
753
723
  - db/migrate/20100929151905_rename_frozen_to_locked.rb
754
724
  - db/migrate/20101008190536_move_special_instructions_to_orders.rb
@@ -765,6 +735,8 @@ files:
765
735
  - db/migrate/20101026192225_cleanup_legacy_tables.rb
766
736
  - db/migrate/20101028151745_remove_number_and_cvv_from_credicard.rb
767
737
  - db/migrate/20101103212716_drop_anonymous_field_for_user.rb
738
+ - db/migrate/20101111133551_renamed_rma_cancelled_state.rb
739
+ - db/migrate/20101117031806_fix_problematic_index_names.rb
768
740
  - db/sample/users.rb
769
741
  - db/seeds.rb
770
742
  - public/images/add-to-cart.png
@@ -1070,29 +1042,25 @@ rdoc_options: []
1070
1042
  require_paths:
1071
1043
  - lib
1072
1044
  required_ruby_version: !ruby/object:Gem::Requirement
1073
- none: false
1074
1045
  requirements:
1075
1046
  - - ">="
1076
1047
  - !ruby/object:Gem::Version
1077
- hash: 57
1078
1048
  segments:
1079
1049
  - 1
1080
1050
  - 8
1081
1051
  - 7
1082
1052
  version: 1.8.7
1083
1053
  required_rubygems_version: !ruby/object:Gem::Requirement
1084
- none: false
1085
1054
  requirements:
1086
1055
  - - ">="
1087
1056
  - !ruby/object:Gem::Version
1088
- hash: 3
1089
1057
  segments:
1090
1058
  - 0
1091
1059
  version: "0"
1092
1060
  requirements:
1093
1061
  - none
1094
1062
  rubyforge_project: spree_core
1095
- rubygems_version: 1.3.7
1063
+ rubygems_version: 1.3.6
1096
1064
  signing_key:
1097
1065
  specification_version: 3
1098
1066
  summary: Core e-commerce functionality for the Spree project.
@@ -1,9 +0,0 @@
1
- class RemoveUniqueIndexOnUsersEmail < ActiveRecord::Migration
2
- def self.up
3
- remove_index :users, :email
4
- end
5
-
6
- def self.down
7
- add_index :users, :email, :unique => true
8
- end
9
- end