spree_core 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) 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/address_states.js +1 -1
  4. data/app/assets/javascripts/admin/admin.js.erb +18 -13
  5. data/app/assets/javascripts/admin/calculator.js +2 -2
  6. data/app/assets/javascripts/admin/checkouts/edit.js +3 -1
  7. data/app/assets/javascripts/admin/image_settings.js.erb +5 -5
  8. data/app/assets/javascripts/admin/orders/edit.js +1 -1
  9. data/app/assets/javascripts/admin/payments/new.js +9 -2
  10. data/app/assets/javascripts/admin/spree_core.js +13 -1
  11. data/app/assets/javascripts/admin/taxon_autocomplete.js.erb +2 -1
  12. data/app/assets/javascripts/admin/variant_autocomplete.js.erb +23 -19
  13. data/app/assets/javascripts/spree.js.coffee +37 -0
  14. data/app/assets/javascripts/store/checkout.js.coffee +8 -0
  15. data/app/assets/javascripts/store/product.js.coffee +1 -1
  16. data/app/assets/javascripts/store/spree_core.js +1 -0
  17. data/app/assets/stylesheets/admin/components/_sidebar.scss +7 -6
  18. data/app/assets/stylesheets/admin/components/_states.scss +16 -12
  19. data/app/assets/stylesheets/admin/globals/_variables.scss +102 -96
  20. data/app/assets/stylesheets/admin/shared/_forms.scss +2 -1
  21. data/app/assets/stylesheets/admin/shared/_icons.scss +2 -1
  22. data/app/assets/stylesheets/admin/shared/_layout.scss +4 -1
  23. data/app/assets/stylesheets/admin/shared/_tables.scss +8 -0
  24. data/app/assets/stylesheets/store/screen.css.scss +28 -16
  25. data/app/assets/stylesheets/store/variables.css.scss +4 -2
  26. data/app/controllers/spree/admin/adjustments_controller.rb +7 -3
  27. data/app/controllers/spree/admin/base_controller.rb +10 -5
  28. data/app/controllers/spree/admin/line_items_controller.rb +3 -2
  29. data/app/controllers/spree/admin/orders/customer_details_controller.rb +3 -2
  30. data/app/controllers/spree/admin/orders_controller.rb +2 -2
  31. data/app/controllers/spree/admin/payments_controller.rb +1 -1
  32. data/app/controllers/spree/admin/resource_controller.rb +5 -5
  33. data/app/controllers/spree/admin/shipments_controller.rb +1 -1
  34. data/app/controllers/spree/admin/taxons_controller.rb +1 -1
  35. data/app/controllers/spree/admin/users_controller.rb +96 -0
  36. data/app/controllers/spree/checkout_controller.rb +18 -7
  37. data/app/controllers/spree/locale_controller.rb +1 -1
  38. data/app/controllers/spree/orders_controller.rb +20 -2
  39. data/app/controllers/spree/taxons_controller.rb +8 -2
  40. data/app/helpers/spree/admin/images_helper.rb +6 -2
  41. data/app/helpers/spree/admin/navigation_helper.rb +23 -3
  42. data/app/helpers/spree/base_helper.rb +9 -5
  43. data/app/helpers/spree/orders_helper.rb +13 -0
  44. data/app/helpers/spree/products_helper.rb +9 -4
  45. data/app/mailers/spree/base_mailer.rb +16 -0
  46. data/app/mailers/spree/order_mailer.rb +12 -11
  47. data/app/mailers/spree/shipment_mailer.rb +4 -7
  48. data/app/mailers/spree/test_mailer.rb +2 -3
  49. data/app/models/spree/adjustment.rb +1 -1
  50. data/app/models/spree/app_configuration.rb +9 -3
  51. data/app/models/spree/calculator/default_tax.rb +5 -1
  52. data/app/models/spree/calculator/per_item.rb +1 -1
  53. data/app/models/spree/classification.rb +7 -0
  54. data/app/models/spree/credit_card.rb +1 -5
  55. data/app/models/spree/gateway.rb +10 -2
  56. data/app/models/spree/gateway/bogus.rb +5 -5
  57. data/app/models/spree/inventory_unit.rb +4 -4
  58. data/app/models/spree/line_item.rb +1 -1
  59. data/app/models/spree/order.rb +15 -35
  60. data/app/models/spree/order/checkout.rb +52 -0
  61. data/app/models/spree/order_populator.rb +11 -3
  62. data/app/models/spree/order_updater.rb +3 -4
  63. data/app/models/spree/payment.rb +23 -1
  64. data/app/models/spree/payment/processing.rb +18 -5
  65. data/app/models/spree/payment_method.rb +4 -0
  66. data/app/models/spree/price.rb +2 -3
  67. data/app/models/spree/product.rb +12 -4
  68. data/app/models/spree/product/scopes.rb +29 -16
  69. data/app/models/spree/return_authorization.rb +1 -1
  70. data/app/models/spree/shipment.rb +1 -1
  71. data/app/models/spree/taxon.rb +21 -6
  72. data/app/models/spree/variant.rb +7 -2
  73. data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +2 -2
  74. data/app/views/spree/admin/countries/index.html.erb +1 -0
  75. data/app/views/spree/admin/general_settings/edit.html.erb +10 -2
  76. data/app/views/spree/admin/images/index.html.erb +7 -3
  77. data/app/views/spree/admin/mail_methods/index.html.erb +2 -2
  78. data/app/views/spree/admin/orders/_form.html.erb +3 -3
  79. data/app/views/spree/admin/orders/_line_item.html.erb +1 -1
  80. data/app/views/spree/admin/orders/customer_details/_form.html.erb +4 -4
  81. data/app/views/spree/admin/orders/index.html.erb +60 -52
  82. data/app/views/spree/admin/payment_methods/_form.html.erb +2 -2
  83. data/app/views/spree/admin/payment_methods/index.html.erb +39 -35
  84. data/app/views/spree/admin/payments/_list.html.erb +1 -1
  85. data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +10 -10
  86. data/app/views/spree/admin/products/_form.html.erb +7 -12
  87. data/app/views/spree/admin/products/index.html.erb +13 -15
  88. data/app/views/spree/admin/products/new.html.erb +3 -1
  89. data/app/views/spree/admin/return_authorizations/_form.html.erb +7 -7
  90. data/app/views/spree/admin/return_authorizations/edit.html.erb +17 -11
  91. data/app/views/spree/admin/return_authorizations/index.html.erb +4 -4
  92. data/app/views/spree/admin/return_authorizations/new.html.erb +13 -6
  93. data/app/views/spree/admin/shared/_alert.html.erb +1 -1
  94. data/app/views/spree/admin/shared/_configuration_menu.html.erb +6 -2
  95. data/app/views/spree/admin/shared/_order_details.html.erb +6 -6
  96. data/app/views/spree/admin/shared/_order_tabs.html.erb +20 -37
  97. data/app/views/spree/admin/shared/_routes.html.erb +1 -1
  98. data/app/views/spree/admin/shared/_tabs.html.erb +1 -2
  99. data/app/views/spree/admin/shared/_update_order_state.js +1 -1
  100. data/app/views/spree/admin/shipments/_form.html.erb +24 -24
  101. data/app/views/spree/admin/shipments/edit.html.erb +13 -13
  102. data/app/views/spree/admin/shipments/index.html.erb +35 -31
  103. data/app/views/spree/admin/shipping_methods/index.html.erb +35 -32
  104. data/app/views/spree/admin/tax_rates/_form.html.erb +2 -1
  105. data/app/views/spree/admin/taxons/_form.html.erb +17 -0
  106. data/app/views/spree/admin/taxons/edit.html.erb +3 -1
  107. data/app/views/spree/admin/trackers/_form.html.erb +2 -2
  108. data/app/views/spree/admin/trackers/index.html.erb +2 -2
  109. data/app/views/spree/admin/users/_form.html.erb +37 -0
  110. data/app/views/spree/admin/users/edit.html.erb +28 -0
  111. data/app/views/spree/admin/users/index.html.erb +53 -0
  112. data/app/views/spree/admin/users/new.html.erb +23 -0
  113. data/app/views/spree/admin/users/show.html.erb +21 -0
  114. data/app/views/spree/admin/variants/edit.html.erb +6 -4
  115. data/app/views/spree/admin/variants/index.html.erb +1 -1
  116. data/app/views/spree/admin/zones/_form.html.erb +4 -4
  117. data/app/views/spree/admin/zones/index.html.erb +3 -1
  118. data/app/views/spree/checkout/_delivery.html.erb +1 -1
  119. data/app/views/spree/checkout/_payment.html.erb +1 -1
  120. data/app/views/spree/checkout/_summary.html.erb +2 -2
  121. data/app/views/spree/checkout/payment/_gateway.html.erb +6 -6
  122. data/app/views/spree/layouts/spree_application.html.erb +0 -1
  123. data/app/views/spree/order_mailer/cancel_email.text.erb +1 -1
  124. data/app/views/spree/order_mailer/confirm_email.text.erb +1 -1
  125. data/app/views/spree/orders/_adjustments.html.erb +1 -1
  126. data/app/views/spree/orders/_line_item.html.erb +2 -2
  127. data/app/views/spree/orders/edit.html.erb +1 -1
  128. data/app/views/spree/payments/_payment.html.erb +16 -0
  129. data/app/views/spree/products/_cart_form.html.erb +2 -2
  130. data/app/views/spree/products/_thumbnails.html.erb +3 -3
  131. data/app/views/spree/products/index.html.erb +1 -1
  132. data/app/views/spree/shared/_google_analytics.html.erb +1 -1
  133. data/app/views/spree/shared/_main_nav_bar.html.erb +1 -1
  134. data/app/views/spree/shared/_order_details.html.erb +10 -24
  135. data/app/views/spree/shared/_products.html.erb +1 -1
  136. data/app/views/spree/shared/_search.html.erb +1 -1
  137. data/app/views/spree/taxons/show.html.erb +1 -1
  138. data/config/initializers/check_for_orphaned_preferences.rb +5 -2
  139. data/config/locales/en.yml +24 -5
  140. data/config/routes.rb +4 -3
  141. data/db/default/spree/countries.rb +229 -0
  142. data/db/default/spree/roles.rb +2 -0
  143. data/db/default/spree/states.rb +57 -0
  144. data/db/default/spree/zones.rb +17 -0
  145. data/db/migrate/20130207155350_add_order_id_index_to_payments.rb +9 -0
  146. data/db/migrate/20130208032954_add_primary_to_spree_products_taxons.rb +5 -0
  147. data/db/migrate/20130222032153_add_order_id_index_to_shipments.rb +5 -0
  148. data/db/migrate/20130226032817_change_meta_description_on_spree_products_to_text.rb +5 -0
  149. data/db/migrate/20130226054936_add_variant_id_index_to_spree_prices.rb +5 -0
  150. data/db/migrate/20130319062004_change_orders_total_precision.rb +8 -0
  151. data/db/migrate/20130319063911_change_spree_payments_amount_precision.rb +7 -0
  152. data/db/migrate/20130319064308_change_spree_return_authorization_amount_precision.rb +7 -0
  153. data/db/migrate/20130319082943_change_adjustments_amount_precision.rb +7 -0
  154. data/db/migrate/20130328195253_add_seo_metas_to_taxons.rb +9 -0
  155. data/lib/generators/spree/dummy/templates/rails/database.yml +9 -6
  156. data/lib/spree/core/calculated_adjustments.rb +1 -1
  157. data/lib/spree/core/controller_helpers/auth.rb +3 -3
  158. data/lib/spree/core/controller_helpers/common.rb +1 -11
  159. data/lib/spree/core/controller_helpers/order.rb +15 -12
  160. data/lib/spree/core/engine.rb +5 -1
  161. data/lib/spree/core/mail_interceptor.rb +4 -6
  162. data/lib/spree/core/mail_settings.rb +52 -23
  163. data/lib/spree/core/permalinks.rb +1 -3
  164. data/lib/spree/core/testing_support/authorization_helpers.rb +1 -1
  165. data/lib/spree/core/testing_support/capybara_ext.rb +30 -0
  166. data/lib/spree/core/testing_support/common_rake.rb +8 -0
  167. data/lib/spree/core/testing_support/factories/payment_factory.rb +1 -1
  168. data/lib/spree/core/testing_support/factories/product_factory.rb +7 -2
  169. data/lib/spree/core/testing_support/factories/variant_factory.rb +4 -2
  170. data/lib/spree/core/validators/email.rb +1 -1
  171. data/lib/spree/core/version.rb +1 -1
  172. data/lib/spree/money.rb +14 -3
  173. data/lib/spree/product_filters.rb +1 -1
  174. data/vendor/assets/javascripts/jquery.jstree/jquery.jstree.js +3 -2
  175. data/vendor/assets/javascripts/jsuri.js +2 -0
  176. data/vendor/assets/javascripts/modernizr.js +3 -3
  177. metadata +78 -69
  178. data/db/default/spree/countries.yml +0 -1589
  179. data/db/default/spree/roles.yml +0 -5
  180. data/db/default/spree/states.yml +0 -256
  181. data/db/default/spree/zone_members.yml +0 -169
  182. data/db/default/spree/zones.yml +0 -13
@@ -58,5 +58,9 @@ module Spree
58
58
  def auto_capture?
59
59
  Spree::Config[:auto_capture]
60
60
  end
61
+
62
+ def supports?(source)
63
+ true
64
+ end
61
65
  end
62
66
  end
@@ -8,13 +8,12 @@ module Spree
8
8
  attr_accessible :variant_id, :currency, :amount
9
9
 
10
10
  def display_amount
11
- return nil if amount.nil?
12
- money.to_s
11
+ money
13
12
  end
14
13
  alias :display_price :display_amount
15
14
 
16
15
  def money
17
- Spree::Money.new(amount, { :currency => currency })
16
+ Spree::Money.new(amount || 0, { :currency => currency })
18
17
  end
19
18
 
20
19
  def price
@@ -24,7 +24,8 @@ module Spree
24
24
  has_many :product_properties, :dependent => :destroy
25
25
  has_many :properties, :through => :product_properties
26
26
 
27
- has_and_belongs_to_many :taxons, :join_table => 'spree_products_taxons'
27
+ has_many :classifications, :dependent => :delete_all
28
+ has_many :taxons, :through => :classifications
28
29
 
29
30
  belongs_to :tax_category
30
31
  belongs_to :shipping_category
@@ -130,6 +131,10 @@ module Spree
130
131
  self[:on_demand] = new_on_demand
131
132
  end
132
133
 
134
+ def count_on_hand=(value)
135
+ raise I18n.t('exceptions.count_on_hand_setter')
136
+ end
137
+
133
138
  # Returns true if there are inventory units (any variant) with "on_hand" state for this product
134
139
  # Variants take precedence over master
135
140
  def has_stock?
@@ -263,9 +268,12 @@ module Spree
263
268
  end
264
269
 
265
270
  def recalculate_count_on_hand
266
- product_count_on_hand = has_variants? ?
267
- variants.sum(:count_on_hand) : (master ? master.count_on_hand : 0)
268
- self.count_on_hand = product_count_on_hand
271
+ value = if has_variants?
272
+ variants.sum(:count_on_hand)
273
+ else
274
+ (master ? master.count_on_hand : 0)
275
+ end
276
+ self[:count_on_hand] = value
269
277
  end
270
278
 
271
279
  # the master on_hand is meaningless once a product has variants as the inventory
@@ -18,14 +18,18 @@ module Spree
18
18
  ]
19
19
  end
20
20
 
21
- simple_scopes.each do |name|
22
- # We should not define price scopes here, as they require something slightly different
23
- next if name.to_s.include?("master_price")
24
- parts = name.to_s.match(/(.*)_by_(.*)/)
25
- order_text = "#{Product.quoted_table_name}.#{parts[2]} #{parts[1] == 'ascend' ? "ASC" : "DESC"}"
26
- self.scope(name.to_s, relation.order(order_text))
21
+ def self.add_simple_scopes(scopes)
22
+ scopes.each do |name|
23
+ # We should not define price scopes here, as they require something slightly different
24
+ next if name.to_s.include?("master_price")
25
+ parts = name.to_s.match(/(.*)_by_(.*)/)
26
+ order_text = "#{Product.quoted_table_name}.#{parts[2]} #{parts[1] == 'ascend' ? "ASC" : "DESC"}"
27
+ self.scope(name.to_s, relation.order(order_text))
28
+ end
27
29
  end
28
30
 
31
+ add_simple_scopes simple_scopes
32
+
29
33
  add_search_scope :ascend_by_master_price do
30
34
  joins(:master => :default_price).order("#{price_table_name}.amount ASC")
31
35
  end
@@ -64,9 +68,14 @@ module Spree
64
68
  #
65
69
  # SELECT COUNT(*) ...
66
70
  add_search_scope :in_taxon do |taxon|
67
- select("DISTINCT(spree_products.id), spree_products.*").
68
- joins(:taxons).
69
- where(Taxon.table_name => { :id => taxon.self_and_descendants.pluck(:id) })
71
+ if ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
72
+ scope = select("DISTINCT ON (spree_products.id) spree_products.*")
73
+ else
74
+ scope = select("DISTINCT(spree_products.id), spree_products.*")
75
+ end
76
+
77
+ scope.joins(:taxons).
78
+ where(Taxon.table_name => { :id => taxon.self_and_descendants.map(&:id) })
70
79
  end
71
80
 
72
81
  # This scope selects products in all taxons AND all its descendants
@@ -184,7 +193,7 @@ module Spree
184
193
  end
185
194
 
186
195
  add_search_scope :not_deleted do
187
- where(:deleted_at => nil)
196
+ where("#{Product.quoted_table_name}.deleted_at IS NULL or #{Product.quoted_table_name}.deleted_at >= ?", Time.zone.now)
188
197
  end
189
198
 
190
199
  # Can't use add_search_scope for this as it needs a default argument
@@ -211,14 +220,18 @@ module Spree
211
220
  group("spree_products.id").joins(:taxons).where(Taxon.arel_table[:name].eq(name))
212
221
  end
213
222
 
214
- if (ActiveRecord::Base.connection.adapter_name == 'PostgreSQL')
215
- if table_exists?
216
- scope :group_by_products_id, { :group => column_names.map { |col_name| "#{table_name}.#{col_name}"} }
223
+ # This method needs to be defined *as a method*, otherwise it will cause the
224
+ # problem shown in #1247.
225
+ def self.group_by_products_id
226
+ if (ActiveRecord::Base.connection.adapter_name == 'PostgreSQL')
227
+ # Need to check, otherwise `column_names` will fail
228
+ if table_exists?
229
+ group(column_names.map { |col_name| "#{table_name}.#{col_name}"})
230
+ end
231
+ else
232
+ group("#{self.quoted_table_name}.id")
217
233
  end
218
- else
219
- scope :group_by_products_id, { :group => "#{self.quoted_table_name}.id" }
220
234
  end
221
- search_scopes << :group_by_products_id
222
235
 
223
236
  private
224
237
 
@@ -44,7 +44,7 @@ module Spree
44
44
  next unless inventory_unit.return_authorization.nil? && count < quantity
45
45
 
46
46
  inventory_unit.return_authorization = self
47
- inventory_unit.return!
47
+ inventory_unit.save!
48
48
 
49
49
  count += 1
50
50
  end
@@ -154,7 +154,7 @@ module Spree
154
154
  end
155
155
 
156
156
  def send_shipped_email
157
- ShipmentMailer.shipped_email(self).deliver
157
+ ShipmentMailer.shipped_email(self.id).deliver
158
158
  end
159
159
 
160
160
  def ensure_correct_adjustment
@@ -3,11 +3,13 @@ module Spree
3
3
  acts_as_nested_set :dependent => :destroy
4
4
 
5
5
  belongs_to :taxonomy
6
- has_and_belongs_to_many :products, :join_table => 'spree_products_taxons'
6
+ has_many :classifications, :dependent => :delete_all
7
+ has_many :products, :through => :classifications
7
8
 
8
9
  before_create :set_permalink
9
10
 
10
- attr_accessible :name, :parent_id, :position, :icon, :description, :permalink, :taxonomy_id
11
+ attr_accessible :name, :parent_id, :position, :icon, :description, :permalink, :taxonomy_id,
12
+ :meta_description, :meta_keywords, :meta_title
11
13
 
12
14
  validates :name, :presence => true
13
15
 
@@ -35,16 +37,29 @@ module Spree
35
37
  fs
36
38
  end
37
39
 
40
+ # Return meta_title if set otherwise generates from root name and/or taxon name
41
+ def seo_title
42
+ if meta_title
43
+ meta_title
44
+ else
45
+ root? ? name : "#{root.name} - #{name}"
46
+ end
47
+ end
48
+
38
49
  # Creates permalink based on Stringex's .to_url method
39
50
  def set_permalink
40
- if parent_id.nil?
41
- self.permalink = name.to_url if permalink.blank?
51
+ if parent.present?
52
+ self.permalink = [parent.permalink, (permalink.blank? ? name.to_url : permalink.split('/').last)].join('/')
42
53
  else
43
- parent_taxon = Taxon.find(parent_id)
44
- self.permalink = [parent_taxon.permalink, (permalink.blank? ? name.to_url : permalink.split('/').last)].join('/')
54
+ self.permalink = name.to_url if permalink.blank?
45
55
  end
46
56
  end
47
57
 
58
+ # For #2759
59
+ def to_param
60
+ permalink
61
+ end
62
+
48
63
  def active_products
49
64
  scope = products.active
50
65
  scope = scope.on_hand unless Spree::Config[:show_zero_stock_products]
@@ -14,7 +14,7 @@ module Spree
14
14
  has_many :inventory_units
15
15
  has_many :line_items
16
16
  has_and_belongs_to_many :option_values, :join_table => :spree_option_values_variants
17
- has_many :images, :as => :viewable, :order => :position, :dependent => :destroy
17
+ has_many :images, :as => :viewable, :order => :position, :dependent => :destroy, :class_name => "Spree::Image"
18
18
 
19
19
  has_one :default_price,
20
20
  :class_name => 'Spree::Price',
@@ -35,7 +35,8 @@ module Spree
35
35
  before_validation :set_cost_currency
36
36
  after_save :process_backorders
37
37
  after_save :save_default_price
38
- after_save :recalculate_product_on_hand, :if => :is_master?
38
+ after_save :recalculate_product_on_hand
39
+ after_create :set_position
39
40
 
40
41
  # default variant scope only lists non-deleted variants
41
42
  scope :deleted, lambda { where('deleted_at IS NOT NULL') }
@@ -221,6 +222,10 @@ module Spree
221
222
  def set_cost_currency
222
223
  self.cost_currency = Spree::Config[:currency] if cost_currency.nil? || cost_currency.empty?
223
224
  end
225
+
226
+ def set_position
227
+ self.update_column(:position, product.variants.maximum(:position).to_i + 1)
228
+ end
224
229
  end
225
230
  end
226
231
 
@@ -8,14 +8,14 @@
8
8
  </tr>
9
9
  </thead>
10
10
  <tbody>
11
- <% @order.adjustments.each do |adjustment|
11
+ <% @collection.each do |adjustment|
12
12
  @edit_url = edit_admin_order_adjustment_path(@order, adjustment)
13
13
  @delete_url = admin_order_adjustment_path(@order, adjustment)
14
14
  %>
15
15
  <tr id="<%= spree_dom_id(adjustment) %>" data-hook="adjustment_row" class="<%= cycle('odd', 'even')%>">
16
16
  <td class="align-center"><%= pretty_time(adjustment.created_at) %></td>
17
17
  <td class="align-center"><%= adjustment.label %></td>
18
- <td class="align-center"><%= adjustment.display_amount %></td>
18
+ <td class="align-center"><%= adjustment.display_amount.to_html %></td>
19
19
  <td class='actions'>
20
20
  <%= link_to_edit adjustment, :no_text => true %>
21
21
  <%= link_to_delete adjustment, :no_text => true %>
@@ -27,6 +27,7 @@
27
27
  <td class="align-center"><%= country.states_required.to_s.titleize %></td>
28
28
  <td class="actions">
29
29
  <%= link_to_edit country, :no_text => true %>
30
+ </td>
30
31
  </tr>
31
32
  <% end %>
32
33
  </tbody>
@@ -52,16 +52,24 @@
52
52
  <div class="choices">
53
53
  <ul>
54
54
  <li>
55
- <%= radio_button_tag :currency_symbol_position, "before" %>
55
+ <%= radio_button_tag :currency_symbol_position, "before", Spree::Config[:currency_symbol_position] == "before" %>
56
56
  <%= label_tag :currency_symbol_position_before, Spree::Money.new(10, :symbol_position => "before") %>
57
57
  </li>
58
58
  <li class="white-space-nowrap">
59
- <%= radio_button_tag :currency_symbol_position, "after" %>
59
+ <%= radio_button_tag :currency_symbol_position, "after", Spree::Config[:currency_symbol_position] == "after" %>
60
60
  <%= label_tag :currency_symbol_position_after, Spree::Money.new(10, :symbol_position => "after") %>
61
61
  </li>
62
62
  </ul>
63
63
  </div>
64
64
  </div>
65
+ <div class="field">
66
+ <%= label_tag :currency_decimal_mark, t(:currency_decimal_mark) %><br>
67
+ <%= text_field_tag :currency_decimal_mark, Spree::Config[:currency_decimal_mark], :size => 3 %>
68
+ </div>
69
+ <div class="field">
70
+ <%= label_tag :currency_thousands_separator, t(:currency_thousands_separator) %><br>
71
+ <%= text_field_tag :currency_thousands_separator, Spree::Config[:currency_thousands_separator], :size => 3 %>
72
+ </div>
65
73
  </fieldset>
66
74
  </div>
67
75
  </div>
@@ -17,7 +17,9 @@
17
17
  <colgroup>
18
18
  <col style="width: 5%">
19
19
  <col style="width: 10%">
20
- <col style="width: 25%">
20
+ <% if @product.has_variants? %>
21
+ <col style="width: 25%">
22
+ <% end %>
21
23
  <col style="width: 45%">
22
24
  <col style="width: 15%">
23
25
  </colgroup>
@@ -33,7 +35,7 @@
33
35
  </thead>
34
36
 
35
37
  <tbody>
36
- <% (@product.images + @product.variant_images).each do |image| %>
38
+ <% (@product.variant_images).each do |image| %>
37
39
  <tr id="<%= spree_dom_id image %>" data-hook="images_row" class="<%= cycle('odd', 'even')%>">
38
40
  <td class="no-border">
39
41
  <span class="handle"></span>
@@ -41,7 +43,9 @@
41
43
  <td>
42
44
  <%= link_to image_tag(image.attachment.url(:mini)), image.attachment.url(:product) %>
43
45
  </td>
44
- <td><%= options_text_for(image) %></td>
46
+ <% if @product.has_variants? %>
47
+ <td><%= options_text_for(image) %></td>
48
+ <% end %>
45
49
  <td><%= image.alt %></td>
46
50
  <td class="actions">
47
51
  <%= link_to_with_icon 'icon-edit', t(:edit), edit_admin_product_image_url(@product, image), :no_text => true, :data => {:action => 'edit'} %>
@@ -28,7 +28,7 @@
28
28
  <% @mail_methods.each do |method|%>
29
29
  <tr id="<%= spree_dom_id method %>" data-hook="admin_mail_methods_index_rows" class="<%= cycle('odd', 'even')%>">
30
30
  <td><%= method.environment.to_s.titleize %></td>
31
- <td><%= method.active ? t(:yes) : t(:no) %></td>
31
+ <td><%= method.active ? t(:say_yes) : t(:say_no) %></td>
32
32
  <td data-hook="admin_mail_methods_index_row_actions" class="actions">
33
33
  <%= link_to_edit method, :no_text => true%>
34
34
  <%= link_to_delete method, :no_text => true %>
@@ -38,4 +38,4 @@
38
38
  <% end %>
39
39
  </tbody>
40
40
  </table>
41
- <% end%>
41
+ <% end%>
@@ -31,7 +31,7 @@
31
31
  <tbody id="subtotal" data-hook="admin_order_form_subtotal" class="no-border-top">
32
32
  <tr id="subtotal-row">
33
33
  <td colspan="3"><b><%= t(:subtotal) %>:</b></td>
34
- <td class="total align-center"><span><%= @order.display_item_total %></span></td>
34
+ <td class="total align-center"><span><%= @order.display_item_total.to_html %></span></td>
35
35
  <td class="actions"></td>
36
36
  </tr>
37
37
  </tbody>
@@ -39,7 +39,7 @@
39
39
  <% @order.adjustments.eligible.each do |adjustment| %>
40
40
  <tr>
41
41
  <td colspan="3"><strong><%= adjustment.label %>:</strong></td>
42
- <td class="total align-center"><span><%= adjustment.display_amount %></span></td>
42
+ <td class="total align-center"><span><%= adjustment.display_amount.to_html %></span></td>
43
43
  <td class="actions"></td>
44
44
  </tr>
45
45
  <% end %>
@@ -47,7 +47,7 @@
47
47
  <tbody id="order-total" data-hook="admin_order_form_total" class="grand-total no-border-top">
48
48
  <tr>
49
49
  <td colspan="3"><b><%= t(:order_total) %>:</b></td>
50
- <td class="total align-center"><span id="order_total"><%= @order.display_total %></span></td>
50
+ <td class="total align-center"><span id="order_form_total"><%= @order.display_total.to_html %></span></td>
51
51
  <td class="actions"></td>
52
52
  </tr>
53
53
  </tbody>
@@ -1,6 +1,6 @@
1
1
  <tr id="<%= spree_dom_id(f.object) %>" data-hook="admin_order_form_line_item_row" class="<%= cycle('odd', 'even')%>">
2
2
  <td><%=f.object.variant.product.name%> <%= "(#{f.object.variant.options_text})" unless f.object.variant.option_values.empty? %></td>
3
- <td class="price align-center"><%= f.object.variant.display_amount %></td>
3
+ <td class="price align-center"><%= f.object.single_money %></td>
4
4
  <td class="qty"><%= f.number_field :quantity, :min => 0, :class => "qty" %></td>
5
5
  <td class="total align-center"><%= f.object.display_amount %></td>
6
6
  <td data-hook="admin_order_form_line_item_actions" class="actions">
@@ -16,17 +16,17 @@
16
16
  <ul>
17
17
  <% if @order.completed? %>
18
18
  <li>
19
- <%= @order.user.nil? ? t(:yes) : t(:no) %>
19
+ <%= @order.user.nil? ? t(:say_yes) : t(:say_no) %>
20
20
  </li>
21
21
  <% else %>
22
22
  <% guest = @order.user.nil? || @order.user.anonymous? %>
23
23
  <li>
24
24
  <%= radio_button_tag :guest_checkout, true, guest %>
25
- <%= t(:yes) %>
25
+ <%= t(:say_yes) %>
26
26
  </li>
27
27
  <li>
28
28
  <%= radio_button_tag :guest_checkout, false, !guest, :disabled => @order.cart? %>
29
- <%= t(:no) %>
29
+ <%= t(:say_no) %>
30
30
  </li>
31
31
  <%= hidden_field_tag :user_id, @order.user_id %>
32
32
  <% end %>
@@ -63,4 +63,4 @@
63
63
  <% content_for :head do %>
64
64
  <%= javascript_include_tag states_path, 'admin/address_states.js' %>
65
65
  <% end %>
66
- </fieldset>
66
+ </fieldset>
@@ -15,26 +15,26 @@
15
15
  <% content_for :table_filter do %>
16
16
  <div data-hook="admin_orders_index_search">
17
17
  <%= search_form_for [:admin, @search] do |f| %>
18
- <div class="field-block alpha four columns">
18
+ <div class="field-block alpha four columns">
19
19
  <div class="date-range-filter field">
20
20
  <%= label_tag nil, t(:date_range) %>
21
21
  <div class="date-range-fields">
22
22
  <%= f.text_field :created_at_gt, :class => 'datepicker datepicker-from', :value => params[:q][:created_at_gt], :placeholder => t(:start) %>
23
-
23
+
24
24
  <span class="range-divider">
25
25
  <i class="icon-arrow-right"></i>
26
26
  </span>
27
-
27
+
28
28
  <%= f.text_field :created_at_lt, :class => 'datepicker datepicker-to', :value => params[:q][:created_at_lt], :placeholder => t(:stop) %>
29
29
  </div>
30
30
  </div>
31
31
 
32
32
  <div class="field">
33
33
  <%= label_tag nil, t(:status) %>
34
- <%= f.select :state_eq, Spree::Order.state_machines[:state].states.collect {|s| [t("order_state.#{s.name}"), s.value]}, {:include_blank => true}, :class => 'select2' %>
34
+ <%= f.select :state_eq, Spree::Order.state_machines[:state].states.collect {|s| [t("order_state.#{s.name}"), s.value]}, {:include_blank => true}, :class => 'select2' %>
35
35
  </div>
36
36
  </div>
37
-
37
+
38
38
  <div class="four columns">
39
39
  <div class="field">
40
40
  <%= label_tag nil, t(:order_number) %>
@@ -45,7 +45,7 @@
45
45
  <%= f.email_field :email_cont %>
46
46
  </div>
47
47
  </div>
48
-
48
+
49
49
  <div class="four columns">
50
50
  <div class="field">
51
51
  <%= label_tag nil, t(:first_name_begins_with) %>
@@ -56,7 +56,7 @@
56
56
  <%= f.text_field :bill_address_lastname_start, :size => 25%>
57
57
  </div>
58
58
  </div>
59
-
59
+
60
60
  <div class="omega four columns">
61
61
  <div class="field checkbox">
62
62
  <label>
@@ -80,53 +80,61 @@
80
80
  <%= button t(:filter_results), 'icon-search' %>
81
81
  </div>
82
82
  </div>
83
- <% end %>
83
+ <% end %>
84
84
  </div>
85
85
  <% end %>
86
86
 
87
- <table class="index responsive" id="listing_orders" data-hook>
88
- <colgroup>
89
- <col style="width: 16%;">
90
- <col style="width: 10%;">
91
- <col style="width: 13%;">
92
- <col style="width: 13%;">
93
- <col style="width: 13%;">
94
- <col style="width: 17%;">
95
- <col style="width: 10%;">
96
- <col style="width: 8%;">
97
- </colgroup>
98
- <thead>
99
- <tr data-hook="admin_orders_index_headers">
100
- <% if @show_only_completed %>
101
- <th><%= sort_link @search, :completed_at, t(:completed_at, :scope => 'activerecord.attributes.spree/order') %></th>
102
- <% else %>
103
- <th><%= sort_link @search, :created_at, t(:created_at, :scope => 'activerecord.attributes.spree/order') %></th>
104
- <% end %>
105
- <th><%= sort_link @search, :number, t(:number, :scope => 'activerecord.attributes.spree/order') %></th>
106
- <th><%= sort_link @search, :state, t(:state, :scope => 'activerecord.attributes.spree/order') %></th>
107
- <th><%= sort_link @search, :payment_state, t(:payment_state, :scope => 'activerecord.attributes.spree/order') %></th>
108
- <th><%= sort_link @search, :shipment_state, t(:shipment_state, :scope => 'activerecord.attributes.spree/order') %></th>
109
- <th><%= sort_link @search, :email, t(:email, :scope => 'activerecord.attributes.spree/order') %></th>
110
- <th><%= sort_link @search, :total, t(:total, :scope => 'activerecord.attributes.spree/order') %></th>
111
- <th data-hook="admin_orders_index_header_actions" class="actions"></th>
112
- </tr>
113
- </thead>
114
- <tbody>
115
- <% @orders.each do |order| %>
116
- <tr data-hook="admin_orders_index_rows" class="state-<%= order.state.downcase %> <%= cycle('odd', 'even') %>">
117
- <td class="align-center"><%= l (@show_only_completed ? order.completed_at : order.created_at).to_date %></td>
118
- <td><%= link_to order.number, admin_order_path(order) %></td>
119
- <td class="align-center"><span class="state <%= order.state.downcase %>"><%= t("order_state.#{order.state.downcase}") %></span></td>
120
- <td class="align-center"><span class="state <%= order.payment_state %>"><%= link_to t("payment_states.#{order.payment_state}"), admin_order_payments_path(order) if order.payment_state %></span></td>
121
- <td class="align-center"><span class="state <%= order.shipment_state %>"><%= link_to t("shipment_states.#{order.shipment_state}"), admin_order_shipments_path(order) if order.shipment_state %></span></td>
122
- <td><%= mail_to order.email %></td>
123
- <td class="align-center"><%= order.display_total %></td>
124
- <td class='actions align-center' data-hook="admin_orders_index_row_actions">
125
- <%= link_to_edit_url edit_admin_order_path(order), :title => "admin_edit_#{dom_id(order)}", :no_text => true %>
126
- </td>
127
- </tr>
128
- <% end %>
129
- </tbody>
130
- </table>
87
+ <%= paginate @orders %>
88
+
89
+ <% unless @orders.empty? %>
90
+ <table class="index responsive" id="listing_orders" data-hook width="100%">
91
+ <colgroup>
92
+ <col style="width: 16%;">
93
+ <col style="width: 10%;">
94
+ <col style="width: 13%;">
95
+ <col style="width: 13%;">
96
+ <col style="width: 13%;">
97
+ <col style="width: 17%;">
98
+ <col style="width: 10%;">
99
+ <col style="width: 8%;">
100
+ </colgroup>
101
+ <thead>
102
+ <tr data-hook="admin_orders_index_headers">
103
+ <% if @show_only_completed %>
104
+ <th><%= sort_link @search, :completed_at, t(:completed_at, :scope => 'activerecord.attributes.spree/order') %></th>
105
+ <% else %>
106
+ <th><%= sort_link @search, :created_at, t(:created_at, :scope => 'activerecord.attributes.spree/order') %></th>
107
+ <% end %>
108
+ <th><%= sort_link @search, :number, t(:number, :scope => 'activerecord.attributes.spree/order') %></th>
109
+ <th><%= sort_link @search, :state, t(:state, :scope => 'activerecord.attributes.spree/order') %></th>
110
+ <th><%= sort_link @search, :payment_state, t(:payment_state, :scope => 'activerecord.attributes.spree/order') %></th>
111
+ <th><%= sort_link @search, :shipment_state, t(:shipment_state, :scope => 'activerecord.attributes.spree/order') %></th>
112
+ <th><%= sort_link @search, :email, t(:email, :scope => 'activerecord.attributes.spree/order') %></th>
113
+ <th><%= sort_link @search, :total, t(:total, :scope => 'activerecord.attributes.spree/order') %></th>
114
+ <th data-hook="admin_orders_index_header_actions" class="actions"></th>
115
+ </tr>
116
+ </thead>
117
+ <tbody>
118
+ <% @orders.each do |order| %>
119
+ <tr data-hook="admin_orders_index_rows" class="state-<%= order.state.downcase %> <%= cycle('odd', 'even') %>">
120
+ <td class="align-center"><%= l (@show_only_completed ? order.completed_at : order.created_at).to_date %></td>
121
+ <td><%= link_to order.number, admin_order_path(order) %></td>
122
+ <td class="align-center"><span class="state <%= order.state.downcase %>"><%= t("order_state.#{order.state.downcase}") %></span></td>
123
+ <td class="align-center"><span class="state <%= order.payment_state %>"><%= link_to t("payment_states.#{order.payment_state}"), admin_order_payments_path(order) if order.payment_state %></span></td>
124
+ <td class="align-center"><span class="state <%= order.shipment_state %>"><%= link_to t("shipment_states.#{order.shipment_state}"), admin_order_shipments_path(order) if order.shipment_state %></span></td>
125
+ <td><%= mail_to order.email %></td>
126
+ <td class="align-center"><%= order.display_total.to_html %></td>
127
+ <td class='actions align-center' data-hook="admin_orders_index_row_actions">
128
+ <%= link_to_edit_url edit_admin_order_path(order), :title => "admin_edit_#{dom_id(order)}", :no_text => true %>
129
+ </td>
130
+ </tr>
131
+ <% end %>
132
+ </tbody>
133
+ </table>
134
+ <% else %>
135
+ <div class="no-objects-found">
136
+ <%= t(:no_orders_found)%>
137
+ </div>
138
+ <% end %>
131
139
 
132
140
  <%= paginate @orders %>