spree_core 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/app/assets/images/credit_cards/icons/diners_club.png +0 -0
  3. data/app/assets/javascripts/admin/calculator.js +2 -2
  4. data/app/assets/javascripts/admin/checkouts/edit.js +1 -1
  5. data/app/assets/stylesheets/admin/admin.css.erb +5 -0
  6. data/app/controllers/spree/admin/adjustments_controller.rb +7 -3
  7. data/app/controllers/spree/admin/orders/customer_details_controller.rb +3 -2
  8. data/app/controllers/spree/admin/orders_controller.rb +1 -1
  9. data/app/controllers/spree/checkout_controller.rb +1 -1
  10. data/app/controllers/spree/orders_controller.rb +1 -1
  11. data/app/helpers/spree/base_helper.rb +2 -2
  12. data/app/helpers/spree/products_helper.rb +7 -3
  13. data/app/mailers/spree/order_mailer.rb +17 -6
  14. data/app/mailers/spree/shipment_mailer.rb +8 -3
  15. data/app/mailers/spree/test_mailer.rb +5 -0
  16. data/app/models/spree/adjustment.rb +1 -1
  17. data/app/models/spree/app_configuration.rb +3 -0
  18. data/app/models/spree/calculator/default_tax.rb +5 -1
  19. data/app/models/spree/credit_card.rb +1 -1
  20. data/app/models/spree/gateway.rb +3 -1
  21. data/app/models/spree/order.rb +2 -2
  22. data/app/models/spree/order/checkout.rb +4 -0
  23. data/app/models/spree/preferences/store.rb +4 -0
  24. data/app/models/spree/product.rb +1 -1
  25. data/app/models/spree/product/scopes.rb +17 -8
  26. data/app/models/spree/shipment.rb +1 -1
  27. data/app/models/spree/taxon.rb +5 -0
  28. data/app/models/spree/variant.rb +1 -1
  29. data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +2 -1
  30. data/app/views/spree/admin/general_settings/edit.html.erb +2 -2
  31. data/app/views/spree/admin/general_settings/show.html.erb +1 -1
  32. data/app/views/spree/admin/shared/_tabs.html.erb +0 -1
  33. data/app/views/spree/admin/taxons/edit.html.erb +1 -1
  34. data/app/views/spree/order_mailer/confirm_email.text.erb +4 -4
  35. data/app/views/spree/products/index.html.erb +1 -1
  36. data/app/views/spree/shared/_google_analytics.html.erb +1 -1
  37. data/app/views/spree/shared/_order_details.html.erb +3 -3
  38. data/db/migrate/20130222032153_add_order_id_index_to_shipments.rb +5 -0
  39. data/lib/generators/spree/dummy/templates/rails/database.yml +9 -6
  40. data/lib/spree/core/calculated_adjustments.rb +1 -1
  41. data/lib/spree/core/controller_helpers.rb +1 -1
  42. data/lib/spree/core/engine.rb +5 -1
  43. data/lib/spree/core/testing_support/preferences.rb +12 -6
  44. data/lib/spree/core/validators/email.rb +1 -1
  45. data/lib/spree/core/version.rb +1 -1
  46. data/lib/spree/money.rb +19 -2
  47. data/lib/spree/product_filters.rb +1 -1
  48. metadata +45 -58
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 16d58098294c8bf04bef89c6b99752f87946df0b
4
+ data.tar.gz: c4e00836ddc65709877257f29d4fd0f6f5bac591
5
+ SHA512:
6
+ metadata.gz: 35394a723cf2c3d50c612fcc83616b966af998b53e26feaefb975045855baf63c7de18052bc0d4ba99185cd6d5943ef1c608af14588af091865a3bcc27353831
7
+ data.tar.gz: 9bff71faf94f7bcf0c192454e66327afe83a5db91368069d5b1e363837a73372bb2b7f7a6201e15e9b6090593e507a370397cabd6b113041ceedbcdde4c82526
@@ -6,11 +6,11 @@ $(function() {
6
6
  if (calculator_select.attr('value') == original_calc_type) {
7
7
  $('div.calculator-settings').show();
8
8
  $('div#calculator-settings-warning').hide();
9
- $('.calculator-settings input').prop("disabled", false);
9
+ $('.calculator-settings').find('input,textarea').prop("disabled", false);
10
10
  } else {
11
11
  $('div.calculator-settings').hide();
12
12
  $('div#calculator-settings-warning').show();
13
- $('.calculator-settings input').prop("disabled", true);
13
+ $('.calculator-settings').find('input,textarea').prop("disabled", true);
14
14
  }
15
15
  });
16
16
  })
@@ -49,7 +49,7 @@ $(document).ready(function(){
49
49
  source: function(request, response) {
50
50
  var params = { q: $('#customer_search').val(),
51
51
  authenticity_token: AUTH_TOKEN }
52
- $.get(Spree.routes.user_search + '&' + jQuery.param(params), function(data) {
52
+ $.get(Spree.routes.user_search + '?' + jQuery.param(params), function(data) {
53
53
  result = prep_user_autocomplete_data(data)
54
54
  response(result);
55
55
  });
@@ -675,3 +675,8 @@ span.handle{
675
675
  select.select2 {
676
676
  width: 30em;
677
677
  }
678
+
679
+ .ui-widget-content .ui-menu-item .ui-state-focus {
680
+ color: #476D9B;
681
+ border: none;
682
+ }
@@ -5,9 +5,13 @@ module Spree
5
5
  destroy.after :reload_order
6
6
 
7
7
  private
8
- def reload_order
9
- @order.reload
10
- end
8
+ def reload_order
9
+ @order.reload
10
+ end
11
+
12
+ def collection
13
+ parent.adjustments.eligible
14
+ end
11
15
  end
12
16
  end
13
17
  end
@@ -25,14 +25,15 @@ module Spree
25
25
  @order.user_id = params[:user_id]
26
26
  @order.user true
27
27
  end
28
- @order.save
29
- @order.create_shipment!
28
+
29
+ while @order.next; end
30
30
  flash[:notice] = t('customer_details_updated')
31
31
  redirect_to edit_admin_order_shipment_path(@order, @order.shipment)
32
32
  else
33
33
  flash[:error] = t('errors.messages.no_shipping_methods_available')
34
34
  redirect_to admin_order_customer_path(@order)
35
35
  end
36
+
36
37
  else
37
38
  render :action => :edit
38
39
  end
@@ -102,7 +102,7 @@ module Spree
102
102
  end
103
103
 
104
104
  def resend
105
- OrderMailer.confirm_email(@order, true).deliver
105
+ OrderMailer.confirm_email(@order.id, true).deliver
106
106
  flash.notice = t(:order_email_resent)
107
107
 
108
108
  respond_with(@order) { |format| format.html { redirect_to :back } }
@@ -76,7 +76,7 @@ module Spree
76
76
 
77
77
  def object_params
78
78
  # For payment step, filter order parameters to produce the expected nested attributes for a single payment and its source, discarding attributes for payment methods other than the one selected
79
- if @order.payment?
79
+ if @order.has_checkout_step?("payment") && @order.payment?
80
80
  if params[:payment_source].present? && source_params = params.delete(:payment_source)[params[:order][:payments_attributes].first[:payment_method_id].underscore]
81
81
  params[:order][:payments_attributes].first[:source_attributes] = source_params
82
82
  end
@@ -78,7 +78,7 @@ module Spree
78
78
  private
79
79
 
80
80
  def accurate_title
81
- @order && @order.completed? ? "#{Order.model_name.human} #{@order.number}" : t(:shopping_cart)
81
+ @order && @order.completed? ? "#{I18n.t(:order)} #{@order.number}" : t(:shopping_cart)
82
82
  end
83
83
  end
84
84
  end
@@ -64,7 +64,7 @@ module Spree
64
64
  end
65
65
 
66
66
  if meta[:description].blank? && object.kind_of?(Spree::Product)
67
- meta[:description] = strip_tags(object.description)
67
+ meta[:description] = strip_tags(truncate(object.description, :length => 160, :separator => ' '))
68
68
  end
69
69
 
70
70
  meta.reverse_merge!({
@@ -165,7 +165,7 @@ module Spree
165
165
  end
166
166
 
167
167
  def money(amount)
168
- Spree::Money.new(amount)
168
+ Spree::Money.new(amount).to_html
169
169
  end
170
170
 
171
171
  def method_missing(method_name, *args, &block)
@@ -6,15 +6,19 @@ module Spree
6
6
  diff = variant.price - variant.product.price
7
7
  return nil if diff == 0
8
8
  if diff > 0
9
- "(#{t(:add)}: #{Spree::Money.new(diff.abs)})"
9
+ "(#{t(:add)}: #{Spree::Money.new(diff.abs).to_html})".html_safe
10
10
  else
11
- "(#{t(:subtract)}: #{Spree::Money.new(diff.abs)})"
11
+ "(#{t(:subtract)}: #{Spree::Money.new(diff.abs).to_html})".html_safe
12
12
  end
13
13
  end
14
14
 
15
15
  # converts line breaks in product description into <p> tags (for html display purposes)
16
16
  def product_description(product)
17
- raw(product.description.gsub(/(.*?)\r?\n\r?\n/m, '<p>\1</p>'))
17
+ if Spree::Config[:show_raw_product_description]
18
+ raw(product.description)
19
+ else
20
+ raw(product.description.gsub(/(.*?)\r?\n\r?\n/m, '<p>\1</p>'))
21
+ end
18
22
  end
19
23
 
20
24
  def line_item_description(variant)
@@ -2,20 +2,31 @@ module Spree
2
2
  class OrderMailer < ActionMailer::Base
3
3
  helper 'spree/base'
4
4
 
5
+ def from_address
6
+ MailMethod.current.preferred_mails_from
7
+ end
8
+
5
9
  def confirm_email(order, resend = false)
6
- @order = order
10
+ find_order(order)
7
11
  subject = (resend ? "[#{t(:resend).upcase}] " : '')
8
- subject += "#{Spree::Config[:site_name]} #{t('order_mailer.confirm_email.subject')} ##{order.number}"
9
- mail(:to => order.email,
12
+ subject += "#{Spree::Config[:site_name]} #{t('order_mailer.confirm_email.subject')} ##{@order.number}"
13
+ mail(:to => @order.email,
14
+ :from => from_address,
10
15
  :subject => subject)
11
16
  end
12
17
 
13
18
  def cancel_email(order, resend = false)
14
- @order = order
19
+ find_order(order)
15
20
  subject = (resend ? "[#{t(:resend).upcase}] " : '')
16
- subject += "#{Spree::Config[:site_name]} #{t('order_mailer.cancel_email.subject')} ##{order.number}"
17
- mail(:to => order.email,
21
+ subject += "#{Spree::Config[:site_name]} #{t('order_mailer.cancel_email.subject')} ##{@order.number}"
22
+ mail(:to => @order.email,
23
+ :from => from_address,
18
24
  :subject => subject)
19
25
  end
26
+
27
+ def find_order(order)
28
+ @order = order.is_a?(Spree::Order) ? order : Spree::Order.find(order)
29
+ end
30
+
20
31
  end
21
32
  end
@@ -2,11 +2,16 @@ module Spree
2
2
  class ShipmentMailer < ActionMailer::Base
3
3
  helper 'spree/base'
4
4
 
5
+ def from_address
6
+ MailMethod.current.preferred_mails_from
7
+ end
8
+
5
9
  def shipped_email(shipment, resend = false)
6
- @shipment = shipment
10
+ @shipment = shipment.is_a?(Spree::Shipment) ? shipment : Spree::Shipment.find(shipment)
7
11
  subject = (resend ? "[#{t(:resend).upcase}] " : '')
8
- subject += "#{Spree::Config[:site_name]} #{t('shipment_mailer.shipped_email.subject')} ##{shipment.order.number}"
9
- mail(:to => shipment.order.email,
12
+ subject += "#{Spree::Config[:site_name]} #{t('shipment_mailer.shipped_email.subject')} ##{@shipment.order.number}"
13
+ mail(:to => @shipment.order.email,
14
+ :from => from_address,
10
15
  :subject => subject)
11
16
  end
12
17
  end
@@ -1,9 +1,14 @@
1
1
  module Spree
2
2
  class TestMailer < ActionMailer::Base
3
+ def from_address
4
+ MailMethod.current.preferred_mails_from
5
+ end
6
+
3
7
  def test_email(mail_method, user)
4
8
  @mail_method = mail_method
5
9
  subject = "#{Spree::Config[:site_name]} #{t('test_mailer.test_email.subject')}"
6
10
  mail(:to => user.email,
11
+ :from => from_address,
7
12
  :subject => subject)
8
13
  end
9
14
  end
@@ -66,7 +66,7 @@ module Spree
66
66
  end
67
67
 
68
68
  def display_amount
69
- Spree::Money.new(amount).to_s
69
+ Spree::Money.new(amount)
70
70
  end
71
71
 
72
72
  private
@@ -50,6 +50,8 @@ module Spree
50
50
  preference :default_meta_keywords, :string, :default => 'spree, demo'
51
51
  preference :default_seo_title, :string, :default => ''
52
52
  preference :dismissed_spree_alerts, :string, :default => ''
53
+ preference :emails_sent_from, :string, :default => 'spree@example.com'
54
+ preference :hide_cents, :boolean, :default => false
53
55
  preference :last_check_for_spree_alerts, :string, :default => nil
54
56
  preference :layout, :string, :default => 'spree/layouts/spree_application'
55
57
  preference :logo, :string, :default => 'admin/bg/spree_50.png'
@@ -62,6 +64,7 @@ module Spree
62
64
  preference :shipping_instructions, :boolean, :default => false # Request instructions/info for shipping
63
65
  preference :show_descendents, :boolean, :default => true
64
66
  preference :show_only_complete_orders_by_default, :boolean, :default => true
67
+ preference :show_raw_product_description, :boolean, :default => false
65
68
  preference :show_zero_stock_products, :boolean, :default => true
66
69
  preference :site_name, :string, :default => 'Spree Demo Site'
67
70
  preference :site_url, :string, :default => 'demo.spreecommerce.com'
@@ -33,7 +33,11 @@ module Spree
33
33
 
34
34
  def compute_line_item(line_item)
35
35
  if line_item.product.tax_category == rate.tax_category
36
- deduced_total_by_rate(line_item.total, rate)
36
+ if rate.included_in_price
37
+ deduced_total_by_rate(line_item.total, rate)
38
+ else
39
+ round_to_two_places(line_item.total * rate.amount)
40
+ end
37
41
  else
38
42
  0
39
43
  end
@@ -60,7 +60,7 @@ module Spree
60
60
 
61
61
  # needed for some of the ActiveMerchant gateways (eg. SagePay)
62
62
  def brand
63
- cc_type
63
+ spree_cc_type
64
64
  end
65
65
 
66
66
  scope :with_payment_profile, lambda { where('gateway_customer_profile_id IS NOT NULL') }
@@ -21,7 +21,9 @@ module Spree
21
21
  def provider
22
22
  gateway_options = options
23
23
  gateway_options.delete :login if gateway_options.has_key?(:login) and gateway_options[:login].nil?
24
- ActiveMerchant::Billing::Base.gateway_mode = gateway_options[:server].to_sym
24
+ if gateway_options[:server]
25
+ ActiveMerchant::Billing::Base.gateway_mode = gateway_options[:server].to_sym
26
+ end
25
27
  @provider ||= provider_class.new(gateway_options)
26
28
  end
27
29
 
@@ -388,7 +388,7 @@ module Spree
388
388
 
389
389
  def deliver_order_confirmation_email
390
390
  begin
391
- OrderMailer.confirm_email(self).deliver
391
+ OrderMailer.confirm_email(self.id).deliver
392
392
  rescue Exception => e
393
393
  logger.error("#{e.class.name}: #{e.message}")
394
394
  logger.error(e.backtrace * "\n")
@@ -637,7 +637,7 @@ module Spree
637
637
  restock_items!
638
638
 
639
639
  #TODO: make_shipments_pending
640
- OrderMailer.cancel_email(self).deliver
640
+ OrderMailer.cancel_email(self.id).deliver
641
641
  unless %w(partial shipped).include?(shipment_state)
642
642
  self.payment_state = 'credit_owed'
643
643
  end
@@ -131,6 +131,10 @@ module Spree
131
131
  steps << "complete" unless steps.include?("complete")
132
132
  steps
133
133
  end
134
+
135
+ def has_checkout_step?(step)
136
+ step.present? ? self.checkout_steps.include?(step) : false
137
+ end
134
138
  end
135
139
  end
136
140
  end
@@ -64,6 +64,10 @@ module Spree::Preferences
64
64
  destroy(key)
65
65
  end
66
66
 
67
+ def clear_cache
68
+ @cache.clear
69
+ end
70
+
67
71
  private
68
72
 
69
73
  def persist(cache_key, value, type)
@@ -231,7 +231,7 @@ module Spree
231
231
  end
232
232
 
233
233
  def display_price
234
- Spree::Money.new(price).to_s
234
+ Spree::Money.new(price)
235
235
  end
236
236
 
237
237
  private
@@ -64,8 +64,13 @@ module Spree
64
64
  #
65
65
  # SELECT COUNT(*) ...
66
66
  add_search_scope :in_taxon do |taxon|
67
- select("DISTINCT(spree_products.id), spree_products.*").
68
- joins(:taxons).
67
+ if ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
68
+ scope = select("DISTINCT ON (spree_products.id) spree_products.*")
69
+ else
70
+ scope = select("DISTINCT(spree_products.id), spree_products.*")
71
+ end
72
+
73
+ scope.joins(:taxons).
69
74
  where(Taxon.table_name => { :id => taxon.self_and_descendants.map(&:id) })
70
75
  end
71
76
 
@@ -206,14 +211,18 @@ module Spree
206
211
  group("spree_products.id").joins(:taxons).where(Taxon.arel_table[:name].eq(name))
207
212
  end
208
213
 
209
- if (ActiveRecord::Base.connection.adapter_name == 'PostgreSQL')
210
- if table_exists?
211
- scope :group_by_products_id, { :group => column_names.map { |col_name| "#{table_name}.#{col_name}"} }
214
+ # This method needs to be defined *as a method*, otherwise it will cause the
215
+ # problem shown in #1247.
216
+ def self.group_by_products_id
217
+ if (ActiveRecord::Base.connection.adapter_name == 'PostgreSQL')
218
+ # Need to check, otherwise `column_names` will fail
219
+ if table_exists?
220
+ group(column_names.map { |col_name| "#{table_name}.#{col_name}"})
221
+ end
222
+ else
223
+ group("#{self.quoted_table_name}.id")
212
224
  end
213
- else
214
- scope :group_by_products_id, { :group => "#{self.quoted_table_name}.id" }
215
225
  end
216
- search_scopes << :group_by_products_id
217
226
 
218
227
  private
219
228
 
@@ -144,7 +144,7 @@ module Spree
144
144
  end
145
145
 
146
146
  def send_shipped_email
147
- ShipmentMailer.shipped_email(self).deliver
147
+ ShipmentMailer.shipped_email(self.id).deliver
148
148
  end
149
149
 
150
150
  def ensure_correct_adjustment
@@ -45,6 +45,11 @@ module Spree
45
45
  end
46
46
  end
47
47
 
48
+ # For #2759
49
+ def to_param
50
+ permalink
51
+ end
52
+
48
53
  def active_products
49
54
  scope = products.active
50
55
  scope = scope.on_hand unless Spree::Config[:show_zero_stock_products]
@@ -22,7 +22,7 @@ module Spree
22
22
  validates :count_on_hand, :numericality => true
23
23
 
24
24
  after_save :process_backorders
25
- after_save :recalculate_product_on_hand, :if => :is_master?
25
+ after_save :recalculate_product_on_hand
26
26
 
27
27
  # default variant scope only lists non-deleted variants
28
28
  scope :active, lambda { where(:deleted_at => nil) }
@@ -5,7 +5,8 @@
5
5
  <th><%= t(:amount) %></th>
6
6
  <th></th>
7
7
  </tr>
8
- <% @order.adjustments.each do |adjustment|
8
+
9
+ <% @collection.each do |adjustment|
9
10
  @edit_url = edit_admin_order_adjustment_path(@order, adjustment)
10
11
  @delete_url = admin_order_adjustment_path(@order, adjustment)
11
12
  %>
@@ -19,9 +19,9 @@
19
19
  <p>
20
20
  <strong><%= t(:currency_symbol_position) %></strong><br>
21
21
  <%= radio_button_tag :currency_symbol_position, "before" %>
22
- <%= label_tag :currency_symbol_position_before, Spree::Money.new(10, :symbol_position => "before") %><br>
22
+ <%= label_tag :currency_symbol_position_before, Spree::Money.new(10, :symbol_position => "before").to_html %><br>
23
23
  <%= radio_button_tag :currency_symbol_position, "after" %>
24
- <%= label_tag :currency_symbol_position_after, Spree::Money.new(10, :symbol_position => "after") %>
24
+ <%= label_tag :currency_symbol_position_after, Spree::Money.new(10, :symbol_position => "after").to_html %>
25
25
  </p>
26
26
  </fieldset>
27
27
 
@@ -11,7 +11,7 @@
11
11
  <% end %>
12
12
  <tr>
13
13
  <td colspan="2">
14
- <%= t(:dollar_amounts_displayed_as, :example => Spree::Money.new(20.99)) %>
14
+ <%= t(:dollar_amounts_displayed_as, :example => Spree::Money.new(20.99).to_html) %>
15
15
  </td>
16
16
  </tr>
17
17
 
@@ -1,4 +1,3 @@
1
- <%= tab :overview, :route => :admin %>
2
1
  <%= tab :orders, :payments, :creditcard_payments, :shipments, :credit_cards, :return_authorizations %>
3
2
  <%= tab :products , :option_types, :properties, :prototypes, :variants, :product_properties, :taxons %>
4
3
  <%= tab :reports %>
@@ -2,7 +2,7 @@
2
2
 
3
3
  <h1><%= t(:taxon_edit) %></h1>
4
4
 
5
- <%= form_for [:admin, @taxonomy, @taxon], :method => :put, :html => { :multipart => true } do |f| %>
5
+ <%= form_for [:admin, @taxonomy, @taxon], :url => admin_taxonomy_taxon_path(@taxonomy, @taxon.id), :method => :put, :html => { :multipart => true } do |f| %>
6
6
  <%= render :partial => 'form', :locals => { :f => f } %>
7
7
 
8
8
  <p class="form-buttons" data-hook="buttons">
@@ -6,15 +6,15 @@
6
6
  <%= t('order_mailer.confirm_email.order_summary') %>
7
7
  ============================================================
8
8
  <% @order.line_items.each do |item| %>
9
- <%= item.variant.sku %> <%= raw(item.variant.product.name) %> <%= raw(item.variant.options_text) -%> (<%=item.quantity%>) @ <%= money item.price %> = <%= money(item.price * item.quantity) %>
9
+ <%= item.variant.sku %> <%= raw(item.variant.product.name) %> <%= raw(item.variant.options_text) -%> (<%=item.quantity%>) @ <%= Spree::Money.new(item.price) %> = <%= Spree::Money.new(item.price * item.quantity) %>
10
10
  <% end %>
11
11
  ============================================================
12
- <%= t('order_mailer.confirm_email.subtotal') %>: <%= money @order.item_total %>
12
+ <%= t('order_mailer.confirm_email.subtotal') %> <%= Spree::Money.new @order.item_total %>
13
13
 
14
14
  <% @order.adjustments.eligible.each do |adjustment| %>
15
- <%= raw(adjustment.label) %> <%= money(adjustment.amount) %>
15
+ <%= raw(adjustment.label) %> <%= adjustment.display_amount %>
16
16
  <% end %>
17
17
 
18
- <%= t('order_mailer.confirm_email.total') %>: <%= money(@order.total) %>
18
+ <%= t('order_mailer.confirm_email.total') %> <%= @order.display_total.to_s %>
19
19
 
20
20
  <%= t('order_mailer.confirm_email.thanks') %>
@@ -1,6 +1,6 @@
1
1
  <% content_for :sidebar do %>
2
2
  <div data-hook="homepage_sidebar_navigation">
3
- <% if "products" == params[:controller] && @taxon %>
3
+ <% if "spree/products" == params[:controller] && @taxon %>
4
4
  <%= render :partial => 'spree/shared/filters' %>
5
5
  <% else %>
6
6
  <%= render :partial => 'spree/shared/taxonomies' %>
@@ -32,7 +32,7 @@
32
32
 
33
33
  (function() {
34
34
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
35
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
35
+ ga.src = '//google-analytics.com/ga.js';
36
36
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
37
37
  })();
38
38
  <% end %>
@@ -48,14 +48,14 @@
48
48
 
49
49
  <hr />
50
50
 
51
- <table class="index columns alpha omega sixteen" data-hook="order_details">
51
+ <table id='line-items' class="index columns alpha omega sixteen" data-hook="order_details">
52
52
  <col width="15%" valign="middle" halign="center">
53
53
  <col width="70%" valign="middle">
54
54
  <col width="5%" valign="middle" halign="center">
55
55
  <col width="5%" valign="middle" halign="center">
56
56
  <col width="5%" valign="middle" halign="center">
57
57
 
58
- <thead id="line-items" data-hook>
58
+ <thead data-hook>
59
59
  <tr data-hook="order_details_line_items_headers">
60
60
  <th colspan="2"><%= t(:item) %></th>
61
61
  <th class="price"><%= t(:price) %></th>
@@ -64,7 +64,7 @@
64
64
  </tr>
65
65
  </thead>
66
66
 
67
- <tbody id="line-items" data-hook>
67
+ <tbody data-hook>
68
68
  <% @order.line_items.each do |item| %>
69
69
  <tr data-hook="order_details_line_item_row">
70
70
  <td data-hook="order_item_image">
@@ -0,0 +1,5 @@
1
+ class AddOrderIdIndexToShipments < ActiveRecord::Migration
2
+ def change
3
+ add_index :spree_shipments, :order_id
4
+ end
5
+ end
@@ -1,3 +1,6 @@
1
+ <% if agent_number = ENV['TC_AGENT_NUMBER']
2
+ database_prefix = agent_number + "_"
3
+ end %>
1
4
  <% case ENV['DB']
2
5
  when 'sqlite' %>
3
6
  development:
@@ -12,33 +15,33 @@ production:
12
15
  <% when 'mysql' %>
13
16
  development:
14
17
  adapter: mysql2
15
- database: spree_development
18
+ database: <%= database_prefix %>spree_development
16
19
  username:
17
20
  encoding: utf8
18
21
  test:
19
22
  adapter: mysql2
20
- database: spree_test
23
+ database: <%= database_prefix %>spree_test
21
24
  username:
22
25
  encoding: utf8
23
26
  production:
24
27
  adapter: mysql2
25
- database: spree_production
28
+ database: <%= database_prefix %>spree_production
26
29
  username:
27
30
  encoding: utf8
28
31
  <% when 'postgres' %>
29
32
  development:
30
33
  adapter: postgresql
31
- database: spree_development
34
+ database: <%= database_prefix %>spree_development
32
35
  username: postgres
33
36
  min_messages: warning
34
37
  test:
35
38
  adapter: postgresql
36
- database: spree_test
39
+ database: <%= database_prefix %>spree_test
37
40
  username: postgres
38
41
  min_messages: warning
39
42
  production:
40
43
  adapter: postgresql
41
- database: spree_production
44
+ database: <%= database_prefix %>spree_production
42
45
  username: postgres
43
46
  min_messages: warning
44
47
  <% else %>
@@ -3,7 +3,7 @@ module Spree
3
3
  module CalculatedAdjustments
4
4
  module ClassMethods
5
5
  def calculated_adjustments
6
- has_one :calculator, :as => :calculable, :dependent => :destroy
6
+ has_one :calculator, :class_name => "Spree::Calculator", :as => :calculable, :dependent => :destroy
7
7
  accepts_nested_attributes_for :calculator
8
8
  attr_accessible :calculator_type, :calculator_attributes
9
9
  validates :calculator, :presence => true
@@ -26,7 +26,7 @@ module Spree
26
26
  end
27
27
  end
28
28
  # can be used in views as well as controllers.
29
- # e.g. <% title = 'This is a custom title for this view' %>
29
+ # e.g. <% self.title = 'This is a custom title for this view' %>
30
30
  attr_writer :title
31
31
 
32
32
  # proxy method to *possible* spree_current_user method
@@ -65,7 +65,11 @@ module Spree
65
65
 
66
66
  # filter sensitive information during logging
67
67
  initializer "spree.params.filter" do |app|
68
- app.config.filter_parameters += [:password, :password_confirmation, :number]
68
+ app.config.filter_parameters += [
69
+ :password,
70
+ :password_confirmation,
71
+ :number,
72
+ :verification_value]
69
73
  end
70
74
 
71
75
  # sets the manifests / assets to be precompiled, even when initialize_on_precompile is false
@@ -2,17 +2,23 @@ module Spree
2
2
  module Core
3
3
  module TestingSupport
4
4
  module Preferences
5
- # Resets all preferences to default values, you can
6
- # pass a block to override the defaults with a block
5
+ def reset_spree_preferences(&config_block)
6
+ Spree::Preferences::Store.instance.persistence = false
7
+ Spree::Preferences::Store.instance.clear_cache
8
+
9
+ configure_spree_preferences &config_block if block_given?
10
+ end
11
+
12
+ # The preference cache is cleared before each test, so the
13
+ # default values will be used. You can define preferences
14
+ # for your spec with:
7
15
  #
8
- # reset_spree_preferences do |config|
16
+ # configure_spree_preferences do |config|
9
17
  # config.site_name = "my fancy pants store"
10
18
  # end
11
19
  #
12
- def reset_spree_preferences
13
- Spree::Preferences::Store.instance.persistence = false
20
+ def configure_spree_preferences
14
21
  config = Rails.application.config.spree.preferences
15
- config.reset
16
22
  yield(config) if block_given?
17
23
  end
18
24
 
@@ -18,6 +18,6 @@ class EmailValidator < ActiveModel::EachValidator
18
18
  rescue Exception => e
19
19
  r = false
20
20
  end
21
- record.errors[attribute] << (options[:message] || I18n.t("errors.messages.invalid")) unless r
21
+ record.errors.add(attribute, :invalid, {:value => value}.merge!(options)) unless r
22
22
  end
23
23
  end
@@ -1,5 +1,5 @@
1
1
  module Spree
2
2
  def self.version
3
- "1.2.4"
3
+ "1.2.5"
4
4
  end
5
5
  end
data/lib/spree/money.rb CHANGED
@@ -2,11 +2,14 @@ require 'money'
2
2
 
3
3
  module Spree
4
4
  class Money
5
+ attr_reader :money
6
+
5
7
  def initialize(amount, options={})
6
- @money = ::Money.parse([amount, Spree::Config[:currency]].join)
8
+ @money = ::Money.parse([amount, (options[:currency] || Spree::Config[:currency])].join)
7
9
  @options = {}
8
- @options[:with_currency] = true if Spree::Config[:display_currency]
10
+ @options[:with_currency] = Spree::Config[:display_currency]
9
11
  @options[:symbol_position] = Spree::Config[:currency_symbol_position].to_sym
12
+ @options[:no_cents] = Spree::Config[:hide_cents]
10
13
  @options.merge!(options)
11
14
  # Must be a symbol because the Money gem doesn't do the conversion
12
15
  @options[:symbol_position] = @options[:symbol_position].to_sym
@@ -15,5 +18,19 @@ module Spree
15
18
  def to_s
16
19
  @money.format(@options)
17
20
  end
21
+
22
+ def to_html(options = { :html => true })
23
+ output = @money.format(@options.merge(options))
24
+ if options[:html]
25
+ # 1) prevent blank, breaking spaces
26
+ # 2) prevent escaping of HTML character entities
27
+ output = output.gsub(" ", "&nbsp;").html_safe
28
+ end
29
+ output
30
+ end
31
+
32
+ def ==(obj)
33
+ @money == obj.money
34
+ end
18
35
  end
19
36
  end
@@ -65,7 +65,7 @@ module Spree
65
65
  end
66
66
 
67
67
  def ProductFilters.format_price(amount)
68
- Spree::Money.new(amount)
68
+ Spree::Money.new(amount).to_html
69
69
  end
70
70
 
71
71
  def ProductFilters.price_filter
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
5
- prerelease:
4
+ version: 1.2.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Sean Schofield
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-04 00:00:00.000000000 Z
11
+ date: 2013-06-12 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: acts_as_list
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - '='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - '='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: awesome_nested_set
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - '='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - '='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: jquery-rails
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: select2-rails
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ~>
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: select2-rails
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ~>
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ~>
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: highline
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - '='
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - '='
108
95
  - !ruby/object:Gem::Version
@@ -110,7 +97,6 @@ dependencies:
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: state_machine
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
101
  - - '='
116
102
  - !ruby/object:Gem::Version
@@ -118,7 +104,6 @@ dependencies:
118
104
  type: :runtime
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
108
  - - '='
124
109
  - !ruby/object:Gem::Version
@@ -126,7 +111,6 @@ dependencies:
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: ffaker
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
115
  - - ~>
132
116
  - !ruby/object:Gem::Version
@@ -134,7 +118,6 @@ dependencies:
134
118
  type: :runtime
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
122
  - - ~>
140
123
  - !ruby/object:Gem::Version
@@ -142,7 +125,6 @@ dependencies:
142
125
  - !ruby/object:Gem::Dependency
143
126
  name: paperclip
144
127
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
128
  requirements:
147
129
  - - ~>
148
130
  - !ruby/object:Gem::Version
@@ -150,7 +132,6 @@ dependencies:
150
132
  type: :runtime
151
133
  prerelease: false
152
134
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
135
  requirements:
155
136
  - - ~>
156
137
  - !ruby/object:Gem::Version
@@ -158,7 +139,6 @@ dependencies:
158
139
  - !ruby/object:Gem::Dependency
159
140
  name: aws-sdk
160
141
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
142
  requirements:
163
143
  - - ~>
164
144
  - !ruby/object:Gem::Version
@@ -166,7 +146,6 @@ dependencies:
166
146
  type: :runtime
167
147
  prerelease: false
168
148
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
149
  requirements:
171
150
  - - ~>
172
151
  - !ruby/object:Gem::Version
@@ -174,55 +153,62 @@ dependencies:
174
153
  - !ruby/object:Gem::Dependency
175
154
  name: ransack
176
155
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
156
  requirements:
179
- - - ~>
157
+ - - '='
180
158
  - !ruby/object:Gem::Version
181
159
  version: 0.7.2
182
160
  type: :runtime
183
161
  prerelease: false
184
162
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
163
  requirements:
187
- - - ~>
164
+ - - '='
188
165
  - !ruby/object:Gem::Version
189
166
  version: 0.7.2
190
167
  - !ruby/object:Gem::Dependency
191
168
  name: activemerchant
192
169
  requirement: !ruby/object:Gem::Requirement
193
- none: false
194
170
  requirements:
195
171
  - - ~>
196
172
  - !ruby/object:Gem::Version
197
- version: 1.29.3
173
+ version: '1.31'
198
174
  type: :runtime
199
175
  prerelease: false
200
176
  version_requirements: !ruby/object:Gem::Requirement
201
- none: false
202
177
  requirements:
203
178
  - - ~>
204
179
  - !ruby/object:Gem::Version
205
- version: 1.29.3
180
+ version: '1.31'
181
+ - !ruby/object:Gem::Dependency
182
+ name: json
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - '>='
186
+ - !ruby/object:Gem::Version
187
+ version: 1.5.5
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - '>='
193
+ - !ruby/object:Gem::Version
194
+ version: 1.5.5
206
195
  - !ruby/object:Gem::Dependency
207
196
  name: rails
208
197
  requirement: !ruby/object:Gem::Requirement
209
- none: false
210
198
  requirements:
211
199
  - - ~>
212
200
  - !ruby/object:Gem::Version
213
- version: 3.2.11
201
+ version: 3.2.13
214
202
  type: :runtime
215
203
  prerelease: false
216
204
  version_requirements: !ruby/object:Gem::Requirement
217
- none: false
218
205
  requirements:
219
206
  - - ~>
220
207
  - !ruby/object:Gem::Version
221
- version: 3.2.11
208
+ version: 3.2.13
222
209
  - !ruby/object:Gem::Dependency
223
210
  name: kaminari
224
211
  requirement: !ruby/object:Gem::Requirement
225
- none: false
226
212
  requirements:
227
213
  - - '='
228
214
  - !ruby/object:Gem::Version
@@ -230,7 +216,6 @@ dependencies:
230
216
  type: :runtime
231
217
  prerelease: false
232
218
  version_requirements: !ruby/object:Gem::Requirement
233
- none: false
234
219
  requirements:
235
220
  - - '='
236
221
  - !ruby/object:Gem::Version
@@ -238,23 +223,20 @@ dependencies:
238
223
  - !ruby/object:Gem::Dependency
239
224
  name: deface
240
225
  requirement: !ruby/object:Gem::Requirement
241
- none: false
242
226
  requirements:
243
- - - ! '>='
227
+ - - '>='
244
228
  - !ruby/object:Gem::Version
245
229
  version: 0.9.0
246
230
  type: :runtime
247
231
  prerelease: false
248
232
  version_requirements: !ruby/object:Gem::Requirement
249
- none: false
250
233
  requirements:
251
- - - ! '>='
234
+ - - '>='
252
235
  - !ruby/object:Gem::Version
253
236
  version: 0.9.0
254
237
  - !ruby/object:Gem::Dependency
255
238
  name: stringex
256
239
  requirement: !ruby/object:Gem::Requirement
257
- none: false
258
240
  requirements:
259
241
  - - ~>
260
242
  - !ruby/object:Gem::Version
@@ -262,7 +244,6 @@ dependencies:
262
244
  type: :runtime
263
245
  prerelease: false
264
246
  version_requirements: !ruby/object:Gem::Requirement
265
- none: false
266
247
  requirements:
267
248
  - - ~>
268
249
  - !ruby/object:Gem::Version
@@ -270,7 +251,6 @@ dependencies:
270
251
  - !ruby/object:Gem::Dependency
271
252
  name: cancan
272
253
  requirement: !ruby/object:Gem::Requirement
273
- none: false
274
254
  requirements:
275
255
  - - '='
276
256
  - !ruby/object:Gem::Version
@@ -278,7 +258,6 @@ dependencies:
278
258
  type: :runtime
279
259
  prerelease: false
280
260
  version_requirements: !ruby/object:Gem::Requirement
281
- none: false
282
261
  requirements:
283
262
  - - '='
284
263
  - !ruby/object:Gem::Version
@@ -286,7 +265,6 @@ dependencies:
286
265
  - !ruby/object:Gem::Dependency
287
266
  name: money
288
267
  requirement: !ruby/object:Gem::Requirement
289
- none: false
290
268
  requirements:
291
269
  - - '='
292
270
  - !ruby/object:Gem::Version
@@ -294,7 +272,6 @@ dependencies:
294
272
  type: :runtime
295
273
  prerelease: false
296
274
  version_requirements: !ruby/object:Gem::Requirement
297
- none: false
298
275
  requirements:
299
276
  - - '='
300
277
  - !ruby/object:Gem::Version
@@ -302,7 +279,6 @@ dependencies:
302
279
  - !ruby/object:Gem::Dependency
303
280
  name: rabl
304
281
  requirement: !ruby/object:Gem::Requirement
305
- none: false
306
282
  requirements:
307
283
  - - '='
308
284
  - !ruby/object:Gem::Version
@@ -310,11 +286,24 @@ dependencies:
310
286
  type: :runtime
311
287
  prerelease: false
312
288
  version_requirements: !ruby/object:Gem::Requirement
313
- none: false
314
289
  requirements:
315
290
  - - '='
316
291
  - !ruby/object:Gem::Version
317
292
  version: 0.7.2
293
+ - !ruby/object:Gem::Dependency
294
+ name: truncate_html
295
+ requirement: !ruby/object:Gem::Requirement
296
+ requirements:
297
+ - - ~>
298
+ - !ruby/object:Gem::Version
299
+ version: 0.5.5
300
+ type: :runtime
301
+ prerelease: false
302
+ version_requirements: !ruby/object:Gem::Requirement
303
+ requirements:
304
+ - - ~>
305
+ - !ruby/object:Gem::Version
306
+ version: 0.5.5
318
307
  description: Required dependency for Spree
319
308
  email: sean@spreecommerce.com
320
309
  executables: []
@@ -408,6 +397,7 @@ files:
408
397
  - app/assets/images/credit_cards/icons/american_express.png
409
398
  - app/assets/images/credit_cards/icons/cirrus.png
410
399
  - app/assets/images/credit_cards/icons/delta.png
400
+ - app/assets/images/credit_cards/icons/diners_club.png
411
401
  - app/assets/images/credit_cards/icons/dinersclub.png
412
402
  - app/assets/images/credit_cards/icons/directdebit.png
413
403
  - app/assets/images/credit_cards/icons/discover.png
@@ -1035,6 +1025,7 @@ files:
1035
1025
  - db/migrate/20121017010007_remove_not_null_constraint_from_products_on_hand.rb
1036
1026
  - db/migrate/20121124203911_add_position_to_taxonomies.rb
1037
1027
  - db/migrate/20130203232234_add_identifier_to_spree_payments.rb
1028
+ - db/migrate/20130222032153_add_order_id_index_to_shipments.rb
1038
1029
  - db/seeds.rb
1039
1030
  - vendor/assets/images/datepicker/cal.gif
1040
1031
  - vendor/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png
@@ -1117,30 +1108,26 @@ files:
1117
1108
  homepage: http://spreecommerce.com
1118
1109
  licenses:
1119
1110
  - BSD-3
1111
+ metadata: {}
1120
1112
  post_install_message:
1121
1113
  rdoc_options: []
1122
1114
  require_paths:
1123
1115
  - lib
1124
1116
  required_ruby_version: !ruby/object:Gem::Requirement
1125
- none: false
1126
1117
  requirements:
1127
- - - ! '>='
1118
+ - - '>='
1128
1119
  - !ruby/object:Gem::Version
1129
1120
  version: 1.8.7
1130
1121
  required_rubygems_version: !ruby/object:Gem::Requirement
1131
- none: false
1132
1122
  requirements:
1133
- - - ! '>='
1123
+ - - '>='
1134
1124
  - !ruby/object:Gem::Version
1135
1125
  version: '0'
1136
- segments:
1137
- - 0
1138
- hash: -97604365585348825
1139
1126
  requirements:
1140
1127
  - none
1141
1128
  rubyforge_project: spree_core
1142
- rubygems_version: 1.8.23
1129
+ rubygems_version: 2.0.0
1143
1130
  signing_key:
1144
- specification_version: 3
1131
+ specification_version: 4
1145
1132
  summary: Core e-commerce functionality for the Spree project.
1146
1133
  test_files: []