spree_core 1.1.6 → 1.2.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (264) hide show
  1. data/app/assets/images/{creditcards → credit_cards}/amex_cid.gif +0 -0
  2. data/app/assets/images/{creditcards/creditcard.gif → credit_cards/credit_card.gif} +0 -0
  3. data/app/assets/images/{creditcards → credit_cards}/discover_cid.gif +0 -0
  4. data/app/assets/images/{creditcards → credit_cards}/icons/american_express.png +0 -0
  5. data/app/assets/images/{creditcards → credit_cards}/icons/cirrus.png +0 -0
  6. data/app/assets/images/{creditcards → credit_cards}/icons/delta.png +0 -0
  7. data/app/assets/images/{creditcards → credit_cards}/icons/dinersclub.png +0 -0
  8. data/app/assets/images/{creditcards → credit_cards}/icons/directdebit.png +0 -0
  9. data/app/assets/images/{creditcards → credit_cards}/icons/discover.png +0 -0
  10. data/app/assets/images/{creditcards → credit_cards}/icons/egold.png +0 -0
  11. data/app/assets/images/{creditcards → credit_cards}/icons/maestro.png +0 -0
  12. data/app/assets/images/{creditcards → credit_cards}/icons/master.png +0 -0
  13. data/app/assets/images/{creditcards → credit_cards}/icons/paypal.png +0 -0
  14. data/app/assets/images/{creditcards → credit_cards}/icons/solo.png +0 -0
  15. data/app/assets/images/{creditcards → credit_cards}/icons/switch.png +0 -0
  16. data/app/assets/images/{creditcards → credit_cards}/icons/visa.png +0 -0
  17. data/app/assets/images/{creditcards → credit_cards}/icons/visaelectron.png +0 -0
  18. data/app/assets/images/{creditcards → credit_cards}/icons/westernunion.png +0 -0
  19. data/app/assets/images/{creditcards → credit_cards}/icons/wirecard.png +0 -0
  20. data/app/assets/images/{creditcards → credit_cards}/icons/worldpay.png +0 -0
  21. data/app/assets/images/{creditcards → credit_cards}/master_cid.jpg +0 -0
  22. data/app/assets/images/{creditcards → credit_cards}/visa_cid.gif +0 -0
  23. data/app/assets/javascripts/admin/admin.js.erb +12 -136
  24. data/app/assets/javascripts/admin/checkouts/edit.js +18 -35
  25. data/app/assets/javascripts/admin/gateway.js +2 -2
  26. data/app/assets/javascripts/admin/images/index.js.coffee +12 -0
  27. data/app/assets/javascripts/admin/images/new.js.coffee +4 -0
  28. data/app/assets/javascripts/admin/orders/edit.js +1 -1
  29. data/app/assets/javascripts/admin/orders/edit_form.js +0 -2
  30. data/app/assets/javascripts/admin/product_autocomplete.js.erb +116 -0
  31. data/app/assets/javascripts/store/cart.js.coffee +7 -0
  32. data/app/assets/javascripts/store/checkout.js.coffee +57 -0
  33. data/app/assets/javascripts/store/product.js.coffee +36 -0
  34. data/app/assets/stylesheets/admin/admin.css.erb +5 -0
  35. data/app/assets/stylesheets/admin/spree_core.css +1 -0
  36. data/app/assets/stylesheets/store/screen.css.scss +15 -1
  37. data/app/assets/stylesheets/store/variables.css.scss +29 -29
  38. data/app/controllers/spree/admin/banners_controller.rb +14 -0
  39. data/app/controllers/spree/admin/base_controller.rb +11 -0
  40. data/app/controllers/spree/admin/images_controller.rb +13 -5
  41. data/app/controllers/spree/admin/line_items_controller.rb +16 -25
  42. data/app/controllers/spree/admin/mail_methods_controller.rb +1 -8
  43. data/app/controllers/spree/admin/option_types_controller.rb +0 -25
  44. data/app/controllers/spree/admin/orders/customer_details_controller.rb +3 -3
  45. data/app/controllers/spree/admin/orders_controller.rb +23 -14
  46. data/app/controllers/spree/admin/payment_methods_controller.rb +1 -7
  47. data/app/controllers/spree/admin/payments_controller.rb +5 -5
  48. data/app/controllers/spree/admin/products_controller.rb +15 -5
  49. data/app/controllers/spree/admin/prototypes_controller.rb +2 -2
  50. data/app/controllers/spree/admin/reports_controller.rb +1 -7
  51. data/app/controllers/spree/admin/resource_controller.rb +130 -130
  52. data/app/controllers/spree/admin/search_controller.rb +47 -0
  53. data/app/controllers/spree/admin/taxons_controller.rb +0 -43
  54. data/app/controllers/spree/base_controller.rb +2 -1
  55. data/app/controllers/spree/checkout_controller.rb +29 -10
  56. data/app/controllers/spree/orders_controller.rb +7 -11
  57. data/app/controllers/spree/products_controller.rb +5 -1
  58. data/app/helpers/spree/account_helper.rb +4 -0
  59. data/app/helpers/spree/admin/base_helper.rb +2 -44
  60. data/app/helpers/spree/admin/navigation_helper.rb +1 -3
  61. data/app/helpers/spree/admin/orders_helper.rb +3 -2
  62. data/app/helpers/spree/admin/products_helper.rb +21 -0
  63. data/app/helpers/spree/base_helper.rb +14 -11
  64. data/app/helpers/spree/checkout_helper.rb +5 -1
  65. data/app/helpers/spree/orders_helper.rb +5 -0
  66. data/app/helpers/spree/products_helper.rb +4 -0
  67. data/app/helpers/spree/trackers_helper.rb +4 -0
  68. data/app/models/spree/ability.rb +70 -0
  69. data/app/models/spree/address.rb +4 -12
  70. data/app/models/spree/adjustment.rb +30 -8
  71. data/app/models/spree/app_configuration.rb +1 -1
  72. data/app/models/spree/calculator/price_sack.rb +3 -5
  73. data/app/models/spree/country.rb +1 -4
  74. data/app/models/spree/{creditcard.rb → credit_card.rb} +4 -4
  75. data/app/models/spree/gateway.rb +2 -2
  76. data/app/models/spree/gateway/bogus.rb +10 -10
  77. data/app/models/spree/gateway/bogus_simple.rb +4 -4
  78. data/app/models/spree/image.rb +3 -12
  79. data/app/models/spree/inventory_unit.rb +4 -6
  80. data/app/models/spree/{user.rb → legacy_user.rb} +7 -6
  81. data/app/models/spree/line_item.rb +4 -5
  82. data/app/models/spree/option_type.rb +4 -6
  83. data/app/models/spree/option_value.rb +1 -1
  84. data/app/models/spree/order.rb +90 -132
  85. data/app/models/spree/order/checkout.rb +124 -0
  86. data/app/models/spree/payment.rb +6 -6
  87. data/app/models/spree/payment/processing.rb +34 -38
  88. data/app/models/spree/payment_method.rb +2 -2
  89. data/app/models/spree/preference.rb +2 -0
  90. data/app/models/spree/preferences/preferable_class_methods.rb +0 -2
  91. data/app/models/spree/preferences/store.rb +3 -21
  92. data/app/models/spree/product.rb +41 -43
  93. data/app/models/spree/product/scopes.rb +9 -25
  94. data/app/models/spree/product_option_type.rb +2 -2
  95. data/app/models/spree/product_property.rb +9 -4
  96. data/app/models/spree/property.rb +1 -1
  97. data/app/models/spree/prototype.rb +2 -2
  98. data/app/models/spree/return_authorization.rb +2 -2
  99. data/app/models/spree/role.rb +1 -1
  100. data/app/models/spree/shipment.rb +6 -5
  101. data/app/models/spree/shipping_method.rb +19 -13
  102. data/app/models/spree/state.rb +2 -5
  103. data/app/models/spree/state_change.rb +1 -1
  104. data/app/models/spree/tax_rate.rb +8 -1
  105. data/app/models/spree/taxon.rb +5 -1
  106. data/app/models/spree/taxonomy.rb +1 -1
  107. data/app/models/spree/tokenized_permission.rb +6 -0
  108. data/app/models/spree/tracker.rb +1 -1
  109. data/app/models/spree/variant.rb +13 -40
  110. data/app/models/spree/zone.rb +15 -14
  111. data/app/models/spree/zone_member.rb +1 -1
  112. data/app/views/spree/admin/image_settings/edit.html.erb +2 -2
  113. data/app/views/spree/admin/images/_form.html.erb +8 -4
  114. data/app/views/spree/admin/images/index.html.erb +1 -1
  115. data/app/views/spree/admin/line_items/create.js.erb +1 -1
  116. data/app/views/spree/admin/option_types/_option_value_fields.html.erb +1 -1
  117. data/app/views/spree/admin/option_types/index.html.erb +1 -1
  118. data/app/views/spree/admin/orders/_add_product.html.erb +1 -1
  119. data/app/views/spree/admin/orders/customer_details/edit.html.erb +1 -1
  120. data/app/views/spree/admin/orders/index.html.erb +4 -4
  121. data/app/views/spree/admin/orders/show.html.erb +1 -1
  122. data/app/views/spree/admin/payments/_form.html.erb +1 -1
  123. data/app/views/spree/admin/payments/new.html.erb +0 -4
  124. data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +1 -1
  125. data/app/views/spree/admin/payments/source_views/_gateway.html.erb +2 -2
  126. data/app/views/spree/admin/products/_form.html.erb +21 -5
  127. data/app/views/spree/admin/products/index.html.erb +2 -2
  128. data/app/views/spree/admin/properties/_form.html.erb +1 -1
  129. data/app/views/spree/admin/properties/index.html.erb +1 -1
  130. data/app/views/spree/admin/return_authorizations/_form.html.erb +33 -17
  131. data/app/views/spree/admin/return_authorizations/edit.html.erb +2 -2
  132. data/app/views/spree/admin/shared/_address_form.html.erb +1 -1
  133. data/app/views/spree/admin/shared/_head.html.erb +12 -2
  134. data/app/views/spree/admin/shared/_order_tabs.html.erb +1 -4
  135. data/app/views/spree/admin/shared/_product_tabs.html.erb +0 -6
  136. data/app/views/spree/admin/shared/_show_resource_links.html.erb +3 -3
  137. data/app/views/spree/admin/shared/_tabs.html.erb +1 -2
  138. data/app/views/spree/admin/shipments/edit.html.erb +2 -2
  139. data/app/views/spree/admin/shipping_methods/_form.html.erb +1 -1
  140. data/app/views/spree/admin/states/_state_list.html.erb +1 -1
  141. data/app/views/spree/admin/tax_rates/index.html.erb +1 -1
  142. data/app/views/spree/admin/taxonomies/_form.html.erb +1 -1
  143. data/app/views/spree/admin/taxons/_form.html.erb +1 -1
  144. data/app/views/spree/admin/taxons/_taxon_table.html.erb +2 -2
  145. data/app/views/spree/admin/variants/_form.html.erb +13 -13
  146. data/app/views/spree/admin/variants/index.html.erb +1 -7
  147. data/app/views/spree/checkout/_address.html.erb +10 -4
  148. data/app/views/spree/checkout/edit.html.erb +0 -1
  149. data/app/views/spree/checkout/payment/_gateway.html.erb +5 -5
  150. data/app/views/spree/checkout/registration.html.erb +2 -2
  151. data/app/views/spree/content/cvv.html.erb +6 -6
  152. data/app/views/spree/layouts/spree_application.html.erb +4 -48
  153. data/app/views/spree/order_mailer/cancel_email.text.erb +5 -5
  154. data/app/views/spree/order_mailer/confirm_email.text.erb +6 -7
  155. data/app/views/spree/orders/_adjustments.html.erb +14 -0
  156. data/app/views/spree/orders/_form.html.erb +1 -0
  157. data/app/views/spree/orders/show.html.erb +3 -3
  158. data/app/views/spree/products/_thumbnails.html.erb +1 -1
  159. data/app/views/spree/products/index.html.erb +1 -1
  160. data/app/views/spree/shared/_footer.html.erb +6 -0
  161. data/app/views/spree/shared/_google_analytics.html.erb +15 -16
  162. data/app/views/spree/shared/_head.html.erb +3 -9
  163. data/app/views/spree/shared/_header.html.erb +5 -0
  164. data/app/views/spree/shared/_main_nav_bar.html.erb +6 -0
  165. data/app/views/spree/shared/_nav_bar.html.erb +7 -3
  166. data/app/views/spree/shared/_order_details.html.erb +14 -11
  167. data/app/views/spree/shared/_sidebar.html.erb +3 -0
  168. data/app/views/spree/shared/unauthorized.html.erb +0 -0
  169. data/app/views/spree/shipment_mailer/shipped_email.text.erb +7 -7
  170. data/app/views/spree/taxons/show.html.erb +1 -1
  171. data/config/initializers/check_for_orphaned_preferences.rb +1 -1
  172. data/config/initializers/spree.rb +0 -12
  173. data/config/initializers/user_class_extensions.rb +25 -0
  174. data/config/initializers/workarounds_for_ruby19.rb +72 -0
  175. data/config/locales/en.yml +11 -24
  176. data/config/routes.rb +7 -37
  177. data/db/migrate/20090823005402_spree_zero_nine_zero.rb +14 -12
  178. data/db/migrate/20091015153048_add_openid_field_to_users.rb +9 -7
  179. data/db/migrate/20100209144531_polymorphic_payments.rb +5 -5
  180. data/db/migrate/20100214212536_assign_creditcard_txns_to_payment.rb +4 -4
  181. data/db/migrate/20100528185820_add_index_on_users_persistence_token.rb +3 -1
  182. data/db/migrate/20100811163637_add_guest_flag.rb +3 -1
  183. data/db/migrate/20100901171814_change_guest_flag_to_anonymous.rb +3 -1
  184. data/db/migrate/20101026184959_generate_anonymous_users.rb +3 -3
  185. data/db/migrate/20101103212716_drop_anonymous_field_for_user.rb +3 -1
  186. data/db/migrate/20111007143030_namespace_top_level_models.rb +18 -1
  187. data/db/migrate/20120315064358_migrate_images_from_products_to_variants.rb +6 -4
  188. data/db/migrate/20120509055454_create_tokenized_permissions_table.rb +16 -0
  189. data/db/migrate/20120530012000_rename_creditcards_to_credit_cards.rb +11 -0
  190. data/db/migrate/20120604203654_remove_credit_total_from_orders.rb +5 -0
  191. data/lib/generators/spree/custom_user/custom_user_generator.rb +53 -0
  192. data/lib/generators/spree/custom_user/templates/authentication_helpers.rb.tt +28 -0
  193. data/lib/generators/spree/custom_user/templates/initializer.rb.tt +1 -0
  194. data/lib/generators/spree/custom_user/templates/migration.rb.tt +7 -0
  195. data/lib/generators/spree/dummy/dummy_generator.rb +3 -0
  196. data/lib/generators/spree/dummy/templates/initializers/custom_user.rb +1 -0
  197. data/lib/generators/spree/install/templates/app/assets/javascripts/admin/all.js +0 -1
  198. data/lib/generators/spree/install/templates/app/assets/javascripts/store/all.js +0 -1
  199. data/lib/generators/spree/install/templates/app/assets/stylesheets/admin/all.css +0 -1
  200. data/lib/generators/spree/install/templates/app/assets/stylesheets/store/all.css +0 -1
  201. data/lib/generators/spree/install/templates/config/initializers/spree.rb +2 -0
  202. data/lib/spree/core.rb +15 -2
  203. data/lib/spree/core/controller_helpers.rb +123 -62
  204. data/lib/spree/core/current_order.rb +5 -0
  205. data/lib/spree/core/engine.rb +1 -1
  206. data/lib/spree/core/mail_settings.rb +1 -2
  207. data/lib/spree/core/permalinks.rb +1 -5
  208. data/lib/spree/core/preference_rescue.rb +8 -4
  209. data/lib/spree/core/relation_serialization.rb +9 -0
  210. data/lib/spree/core/respond_with.rb +1 -1
  211. data/lib/spree/core/s3_support.rb +25 -0
  212. data/lib/spree/core/search/base.rb +2 -5
  213. data/lib/spree/core/ssl_requirement.rb +2 -2
  214. data/lib/spree/core/store_helpers.rb +1 -2
  215. data/lib/spree/core/testing_support/controller_requests.rb +1 -0
  216. data/lib/spree/core/testing_support/env.rb +2 -0
  217. data/lib/spree/core/testing_support/factories/{creditcard_factory.rb → credit_card_factory.rb} +3 -3
  218. data/lib/spree/core/testing_support/factories/payment_factory.rb +1 -1
  219. data/lib/spree/core/testing_support/factories/product_factory.rb +4 -4
  220. data/lib/spree/core/testing_support/factories/user_factory.rb +3 -3
  221. data/lib/spree/core/testing_support/factories/zone_factory.rb +2 -3
  222. data/lib/spree/core/token_resource.rb +27 -0
  223. data/lib/spree/core/version.rb +1 -1
  224. data/lib/spree/product_filters.rb +12 -13
  225. data/lib/tasks/core.rake +1 -1
  226. metadata +146 -154
  227. data/app/assets/images/noimage/large.png +0 -0
  228. data/app/assets/javascripts/admin/images/index.js +0 -10
  229. data/app/assets/javascripts/admin/images/new.js +0 -5
  230. data/app/assets/javascripts/admin/products.js +0 -2
  231. data/app/assets/javascripts/store/cart.js +0 -11
  232. data/app/assets/javascripts/store/checkout.js +0 -78
  233. data/app/assets/javascripts/store/product.js +0 -49
  234. data/app/controllers/spree/admin/users_controller.rb +0 -68
  235. data/app/views/spree/admin/option_types/_available.html.erb +0 -28
  236. data/app/views/spree/admin/option_types/_selected.html.erb +0 -26
  237. data/app/views/spree/admin/option_types/available.js.erb +0 -2
  238. data/app/views/spree/admin/option_types/select.js.erb +0 -3
  239. data/app/views/spree/admin/option_types/selected.html.erb +0 -6
  240. data/app/views/spree/admin/orders/history.html.erb +0 -29
  241. data/app/views/spree/admin/products/_option_types.html.erb +0 -40
  242. data/app/views/spree/admin/shared/_additional_field.html.erb +0 -5
  243. data/app/views/spree/admin/shared/_routes.html.erb +0 -8
  244. data/app/views/spree/admin/shared/_translations.html.erb +0 -17
  245. data/app/views/spree/admin/taxons/available.js.erb +0 -26
  246. data/app/views/spree/admin/taxons/remove.html.erb +0 -1
  247. data/app/views/spree/admin/taxons/select.js.erb +0 -2
  248. data/app/views/spree/admin/taxons/selected.html.erb +0 -42
  249. data/app/views/spree/admin/users/_form.html.erb +0 -19
  250. data/app/views/spree/admin/users/edit.html.erb +0 -14
  251. data/app/views/spree/admin/users/index.html.erb +0 -48
  252. data/app/views/spree/admin/users/new.html.erb +0 -14
  253. data/app/views/spree/admin/users/show.html.erb +0 -21
  254. data/app/views/spree/shared/_store_menu.html.erb +0 -2
  255. data/config/initializers/rails_5868.rb +0 -8
  256. data/db/migrate/20120605211305_make_users_email_index_unique.rb +0 -10
  257. data/db/migrate/20121017010007_remove_not_null_constraint_from_products_on_hand.rb +0 -11
  258. data/db/sample/users.rb +0 -61
  259. data/lib/generators/spree/sandbox/sandbox_generator.rb +0 -36
  260. data/lib/generators/spree/sandbox/templates/rails/routes.rb +0 -7
  261. data/lib/spree/core/ext/array.rb +0 -14
  262. data/lib/spree/core/ext/hash.rb +0 -75
  263. data/lib/spree/core/ext/string.rb +0 -10
  264. data/lib/tasks/install.rake +0 -18
@@ -53,30 +53,29 @@ module Spree
53
53
 
54
54
  # convenience method for returning the countries contained within a zone
55
55
  def country_list
56
- @countries ||= members.includes(:zoneable).map { |zone_member|
57
- case zone_member.zoneable_type
58
- when 'Spree::Country'
59
- zone_member.zoneable
60
- when 'Spree::State'
61
- zone_member.zoneable.country
62
- else
63
- nil
64
- end
65
- }.flatten.compact.uniq
56
+ @countries ||=
57
+ case kind
58
+ when 'country'
59
+ zoneables
60
+ when 'state'
61
+ zoneables.collect(&:country)
62
+ else
63
+ nil
64
+ end.flatten.compact.uniq
66
65
  end
67
66
 
68
67
  def <=>(other)
69
68
  name <=> other.name
70
69
  end
71
70
 
72
- # All zoneables belonging to the zone members. Will be a colelction of either
71
+ # All zoneables belonging to the zone members. Will be a collection of either
73
72
  # countries or states depending on the zone type.
74
73
  def zoneables
75
- members.collect { |m| m.zoneable }
74
+ members.collect(&:zoneable)
76
75
  end
77
76
 
78
77
  def self.default_tax
79
- Zone.where(:default_tax => true).first
78
+ where(:default_tax => true).first
80
79
  end
81
80
 
82
81
  # Indicates whether the specified zone falls entirely within the zone performing
@@ -98,6 +97,7 @@ module Spree
98
97
  end
99
98
 
100
99
  private
100
+
101
101
  def remove_defunct_members
102
102
  zone_members.each do |zone_member|
103
103
  zone_member.destroy if zone_member.zoneable_id.nil? || zone_member.zoneable_type != "Spree::#{kind.capitalize}"
@@ -106,7 +106,8 @@ module Spree
106
106
 
107
107
  def remove_previous_default
108
108
  return unless default_tax
109
- Zone.all.each do |zone|
109
+
110
+ self.class.all.each do |zone|
110
111
  zone.update_column 'default_tax', false unless zone == self
111
112
  end
112
113
  end
@@ -1,6 +1,6 @@
1
1
  module Spree
2
2
  class ZoneMember < ActiveRecord::Base
3
- belongs_to :zone, :class_name => "Spree::Zone", :counter_cache => true
3
+ belongs_to :zone, :counter_cache => true
4
4
  belongs_to :zoneable, :polymorphic => true
5
5
 
6
6
  attr_accessible :zone, :zone_id, :zoneable, :zoneable_id, :zoneable_type
@@ -9,14 +9,14 @@
9
9
  <p data-hook="attachment_path">
10
10
  <label>
11
11
  <%= label_tag 'preferences[attachment_path]', t(:attachment_path) %>
12
- <%= preference_field_tag 'preferences[attachment_path]', Spree::Config[:attachment_path], :type => :string %>
12
+ <%= preference_field_tag 'preferences[attachment_path]', Spree::Config[:attachment_path], :type => :string, :size => 70 %>
13
13
  </label>
14
14
  </p>
15
15
 
16
16
  <p data-hook="attachment_default_url">
17
17
  <label>
18
18
  <%= label_tag 'preferences[attachment_default_url]', t(:attachment_default_url) %>
19
- <%= preference_field_tag 'preferences[attachment_default_url]', Spree::Config[:attachment_default_url], :type => :string %>
19
+ <%= preference_field_tag 'preferences[attachment_default_url]', Spree::Config[:attachment_default_url], :type => :string, :size => 60 %>
20
20
  </label>
21
21
  </p>
22
22
 
@@ -3,10 +3,14 @@
3
3
  <td><%= t(:filename) %>:</td>
4
4
  <td><%= f.file_field :attachment %></td>
5
5
  </tr>
6
- <tr data-hook="variant">
7
- <td><%= Spree::Variant.model_name.human %>:</td>
8
- <td><%= f.select :viewable_id, @variants %></td>
9
- </tr>
6
+ <% if @product.has_variants? %>
7
+ <tr data-hook="variant">
8
+ <td><%= Spree::Variant.model_name.human %>:</td>
9
+ <td><%= f.select :viewable_id, @variants %></td>
10
+ </tr>
11
+ <% else %>
12
+ <%= hidden_field_tag :product_id, @product.id %>
13
+ <% end %>
10
14
  <tr data-hook="alt_text">
11
15
  <td><%= t(:alt_text) %>:</td>
12
16
  <td><%= f.text_area :alt %></td>
@@ -53,5 +53,5 @@
53
53
  <div id="images" data-hook></div>
54
54
  <br />
55
55
  <p data-hook="links">
56
- <%= link_to icon('add') + ' ' + t(:new_image), new_admin_product_image_url(@product), :id => 'new_image_link' %>
56
+ <%= link_to icon('add') + ' ' + t(:new_image), new_admin_product_image_url(@product), :id => 'new_image_link' %>
57
57
  </p>
@@ -1,4 +1,4 @@
1
1
  $("#order-form-wrapper").html('<%= escape_javascript(render :partial => "spree/admin/orders/form") %>');
2
- $('#add_product_name').val('');
2
+ $('.product_autocomplete').val('');
3
3
  $('#add_variant_id').val('');
4
4
  $('#add_quantity').val(1);
@@ -1,4 +1,4 @@
1
- <tr class="option_value fields" id="<%= spree_dom_id(f.object) %>" data-hook="option_value">
1
+ <tr class="option_value fields" id="spree_<%= dom_id(f.object) %>" data-hook="option_value">
2
2
  <td class="name"><span class="handle"></span> </span><%= f.text_field :name %></td>
3
3
  <td class="presentation"><%= f.text_field :presentation %></td>
4
4
  <td class="actions"><%= link_to_remove_fields t(:remove), f %></td>
@@ -3,7 +3,7 @@
3
3
  <div class="toolbar" data-hook="toolbar">
4
4
  <ul class="actions">
5
5
  <li id="new_ot_link">
6
- <%= button_link_to t(:new_option_type), new_admin_option_type_url, {:remote => true, :icon => 'add', :id => 'new_option_type_link'} %>
6
+ <%= button_link_to t(:new_option_type), new_admin_option_type_url, { :remote => true, :icon => 'add', :id => 'new_option_type_link' } %>
7
7
  </li>
8
8
  </ul>
9
9
  <br class="clear" />
@@ -3,7 +3,7 @@
3
3
  <legend><%= t(:add_product) %></legend>
4
4
  <div style="float:left; width:65%; margin-right:5%;" data-hook="add_product_name">
5
5
  <%= label_tag :add_product_name, t(:name_or_sku) %>
6
- <%= text_field_tag :add_product_name, nil, :class => 'fullwidth title' %>
6
+ <%= text_field_tag :add_product_name, nil, :class => 'fullwidth title product_autocomplete' %>
7
7
  <%= hidden_field_tag :add_variant_id %>
8
8
  </div>
9
9
  <div style="float:left; width:10%; margin-right:5%;" data-hook="add_quantity">
@@ -2,7 +2,7 @@
2
2
  <%= csrf_meta_tags %>
3
3
 
4
4
  <% if @order.cart? %>
5
- <div id="customer-search" data-hook>
5
+ <div id="add-line-item" data-hook>
6
6
  <fieldset>
7
7
  <legend><%= t(:customer_search) %></legend>
8
8
  <%= label_tag :customer_search, t(:enter_at_least_five_letters) %>
@@ -50,11 +50,11 @@
50
50
  <%= label_tag nil, t(:date_range) %><br />
51
51
  <div class="date-range-filter">
52
52
  <div class="left sub-field">
53
- <%= f.text_field :created_at_gt, :class => 'datepicker' %><br />
53
+ <%= f.text_field :created_at_gt, :class => 'datepicker', :value => params[:q][:created_at_gt] %><br />
54
54
  <%= label_tag nil, t(:start), :class => 'sub' %>
55
55
  </div>
56
56
  <div class="right sub-field">
57
- <%= f.text_field :created_at_lt, :class => 'datepicker' %><br />
57
+ <%= f.text_field :created_at_lt, :class => 'datepicker', :value => params[:q][:created_at_lt] %><br />
58
58
  <%= label_tag nil, t(:stop), :class => 'sub' %>
59
59
  </div>
60
60
  </div>
@@ -71,11 +71,11 @@
71
71
  <%= f.text_field :email_cont, :size => 25 %>
72
72
  </p>
73
73
  <p>
74
- <%= label_tag nil, t(:first_name_start) %><br />
74
+ <%= label_tag nil, t(:first_name_begins_with) %><br />
75
75
  <%= f.text_field :bill_address_firstname_start, :size => 25 %>
76
76
  </p>
77
77
  <p>
78
- <%= label_tag nil, t(:last_name_start) %><br />
78
+ <%= label_tag nil, t(:last_name_begins_with) %><br />
79
79
  <%= f.text_field :bill_address_lastname_start, :size => 25 %>
80
80
  </p>
81
81
  <p>
@@ -1,5 +1,5 @@
1
1
  <div class="toolbar order-links" data-hook="admin_order_show_buttons">
2
- <%= button_link_to t(:cancel), fire_admin_order_url(@order.number, {:e => "cancel"}), :icon => 'delete', :confirm => t(:are_you_sure) if @order.can_cancel? %>
2
+ <%= button_link_to t(:cancel), fire_admin_order_url(@order.number, { :e => 'cancel' }), :icon => 'delete', :data => { :confirm => t(:are_you_sure) } if @order.can_cancel? %>
3
3
  <%= button_link_to t(:edit), edit_admin_order_url(@order.number), :icon => 'edit' %>
4
4
  </div>
5
5
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  <% @payment_methods.each do |method| %>
8
8
 
9
- <label data-hook="payment_method">
9
+ <label data-hook="payment_method_field">
10
10
  <%= radio_button_tag 'payment[payment_method_id]', method.id, method == @payment_method %>
11
11
  <%= t(method.name, :scope => :payment_methods, :default => method.name) %>
12
12
  </label>
@@ -18,7 +18,3 @@
18
18
  <%= t(:cannot_create_payment_without_payment_methods) %>
19
19
  <%= link_to t(:please_define_payment_methods), admin_payment_methods_url %>
20
20
  <% end %>
21
-
22
- <% content_for :head do %>
23
- <%= javascript_include_tag '/admin/javascripts/payments/new.js' %>
24
- <% end %>
@@ -6,7 +6,7 @@
6
6
  <label><%= radio_button_tag :card, 'new', @previous_cards.none? %> <%= t(:use_new_cc) %></label>
7
7
  </p>
8
8
  <div id="card_form" data-hook>
9
- <%= image_tag 'creditcards/creditcard.gif', :id => 'creditcard-image' %>
9
+ <%= image_tag 'credit_cards/credit_card.gif', :id => 'credit-card-image' %>
10
10
  <% param_prefix = "payment_source[#{payment_method.id}]" %>
11
11
 
12
12
  <div data-hook="card_number">
@@ -1,5 +1,5 @@
1
- <fieldset data-hook="creditcard">
2
- <legend><%= t(:creditcard) %></legend>
1
+ <fieldset data-hook="credit_card">
2
+ <legend><%= t(:credit_card) %></legend>
3
3
 
4
4
  <table class="index">
5
5
  <tr>
@@ -85,6 +85,17 @@
85
85
  </div>
86
86
  </div>
87
87
 
88
+
89
+ <%= f.field_container :taxons do %>
90
+ <%= f.label :taxon_ids, t(:taxons) %><br />
91
+ <%= f.select :taxon_ids, taxon_options_for(@product), {}, :class => "select2", :multiple => true %>
92
+ <% end %>
93
+
94
+ <%= f.field_container :option_types do %>
95
+ <%= f.label :option_type_ids, t(:option_types) %><br />
96
+ <%= f.select :option_type_ids, option_types_options_for(@product), {}, :class => "select2", :multiple => true %>
97
+ <% end %>
98
+
88
99
  <h2><%= t(:metadata) %></h2>
89
100
  <div data-hook="admin_product_form_meta">
90
101
  <%= f.field_container :meta_keywords do %>
@@ -98,9 +109,14 @@
98
109
  <% end %>
99
110
  </div>
100
111
 
101
- <div data-hook="admin_product_form_additional_fields">
102
- <% Spree::Variant.additional_fields.select { |af| af[:only].nil? || af[:only].include?(:product) }.each do |field| %>
103
- <%= render :partial => 'spree/admin/shared/additional_field', :locals => { :field => field, :f => f } %>
104
- <% end %>
105
- </div>
112
+ <div data-hook="admin_product_form_additional_fields"></div>
106
113
  </div>
114
+
115
+ <script>
116
+
117
+ $("#product_taxon_ids").select2({
118
+ formatSelection: function(item) { return item.text.split(' -> ').slice(-1)[0] },
119
+ });
120
+
121
+ $("#product_option_type_ids").select2();
122
+ </script>
@@ -3,7 +3,7 @@
3
3
  <div class="toolbar" data-hook="toolbar">
4
4
  <ul class="actions">
5
5
  <li id="new_product_link">
6
- <%= button_link_to t(:new_product), new_object_url, {:remote => true, :icon => 'add', :id => 'admin_new_product'} %>
6
+ <%= button_link_to t(:new_product), new_object_url, { :remote => true, :icon => 'add', :id => 'admin_new_product' } %>
7
7
  </li>
8
8
  </ul>
9
9
  <br class="clear" />
@@ -35,7 +35,7 @@
35
35
  </tr>
36
36
  <% end %>
37
37
  </table>
38
- <%= paginate @products %>
38
+ <%= paginate @collection %>
39
39
 
40
40
  <% content_for :sidebar do %>
41
41
  <div data-hook="admin_products_sidebar">
@@ -1,4 +1,4 @@
1
- <div data-hook="admin_property_form_fields">
1
+ <div data-hook="admin_property_form">
2
2
  <%= f.field_container :name do %>
3
3
  <%= f.label :name, t(:name) %> <span class="required">*</span><br />
4
4
  <%= f.text_field :name %>
@@ -3,7 +3,7 @@
3
3
  <div class="toolbar" data-hook="toolbar">
4
4
  <ul class="actions">
5
5
  <li id="new_property_link">
6
- <%= button_link_to t(:new_property), new_admin_property_url, {:remote => true, :icon => 'add', 'data-update' => 'new_property', :id => 'new_property_link'} %>
6
+ <%= button_link_to t(:new_property), new_admin_property_url, { :remote => true, :icon => 'add', 'data-update' => 'new_property', :id => 'new_property_link' } %>
7
7
  </li>
8
8
  </ul>
9
9
  <br class="clear" />
@@ -20,8 +20,8 @@
20
20
  <% elsif units.select(&:shipped?).empty? %>
21
21
  0
22
22
  <% else %>
23
- <%= number_field_tag "return_quantity[#{variant.id}]",
24
- @return_authorization.inventory_units.group_by(&:variant)[variant].try(:size) || 0, {:style => 'width:50px;', :min => 0} %>
23
+ <%= text_field_tag "return_quantity[#{variant.id}]",
24
+ @return_authorization.inventory_units.group_by(&:variant)[variant].try(:size) || 0, {:style => 'width:30px;'} %>
25
25
  <% end %>
26
26
  </td>
27
27
  </tr>
@@ -33,7 +33,7 @@
33
33
  <% if @return_authorization.received? %>
34
34
  <%= number_to_currency @return_authorization.amount %>
35
35
  <% else %>
36
- <%= f.text_field :amount, {:style => 'width:80px;'} %> <%= t(:rma_value) %>: <span id="rma_value">0.00</span>
36
+ <%= f.text_field :amount, {:style => 'width:80px;'} %> <%= t(:rma_value) %>: <span id="rma_value"></span>
37
37
  <%= f.error_message_on :amount %>
38
38
  <% end %>
39
39
  <% end %>
@@ -45,19 +45,35 @@
45
45
  <% end %>
46
46
 
47
47
 
48
- <script>
49
- $(document).ready(function(){
50
- var rma_amount = 0;
51
- $("td.return_quantity input").on('change', function() {
52
- var rma_amount = 0;
53
- $.each($("td.return_quantity input"), function(i, input) {
54
- var variant_id = $(input).attr('id').replace("return_quantity_", "");
55
- rma_amount += variant_prices[variant_id] * $(input).val()
56
- });
48
+ <% content_for :head do %>
49
+ <%= javascript_tag do -%>
50
+ var variant_prices = new Array();
51
+ <% @return_authorization.order.inventory_units.group_by(&:variant).each do | variant, units| %>
52
+ variant_prices[<%= variant.id.to_s %>] = <%= variant.price %>;
53
+ <% end %>
54
+
55
+ function calculate_rma_price(object, value){
56
+ var rma_amount = 0;
57
57
 
58
- if(!isNaN(rma_amount)){
59
- $("span#rma_value").html(rma_amount.toFixed(2));
58
+ $.each($("td.return_quantity input"), function(i, inpt){
59
+ var variant_id = $(inpt).attr('id').replace("return_quantity_", "");
60
+ rma_amount += variant_prices[variant_id] * $(inpt).val()
61
+ });
62
+
63
+ if(!isNaN(rma_amount)){
64
+ $("span#rma_value").html(rma_amount.toFixed(2));
65
+ }
60
66
  }
61
- })
62
- });
63
- </script>
67
+
68
+ $(document).ready(function(){
69
+ $.each($("td.return_quantity input"), function(i, inpt){
70
+ $(inpt).delayedObserver(function() {
71
+ calculate_rma_price();
72
+ }, 0.5);
73
+ });
74
+
75
+ calculate_rma_price();
76
+ });
77
+ <% end -%>
78
+ <% end %>
79
+ </div>
@@ -2,10 +2,10 @@
2
2
  <ul class="actions">
3
3
  <li>
4
4
  <% if @return_authorization.can_receive? %>
5
- <%= button_link_to t(:receive), fire_admin_order_return_authorization_url(@order, @return_authorization, :e => 'receive'), :method => :put, :confirm => t(:are_you_sure) %>
5
+ <%= button_link_to t(:receive), fire_admin_order_return_authorization_url(@order, @return_authorization, :e => 'receive'), :method => :put, :data => { :confirm => t(:are_you_sure) } %>
6
6
  <% end %>
7
7
  <% if @return_authorization.can_cancel? %>
8
- <%= button_link_to t(:cancel), fire_admin_order_return_authorization_url(@order, @return_authorization, :e => 'cancel'), :method => :put, :confirm => t(:are_you_sure) %>
8
+ <%= button_link_to t(:cancel), fire_admin_order_return_authorization_url(@order, @return_authorization, :e => 'cancel'), :method => :put, :data => { :confirm => t(:are_you_sure) } %>
9
9
  <% end %>
10
10
  </li>
11
11
  </ul>
@@ -71,7 +71,7 @@
71
71
  <td class="lbl-col">
72
72
  <%= f.label :phone, t(:phone) + ':' %>
73
73
  </td>
74
- <td colspan="7"><%= f.text_field :phone %></td>
74
+ <td colspan="7"><%= f.phone_field :phone %></td>
75
75
  </tr>
76
76
  </tbody>
77
77
  </table>
@@ -6,8 +6,18 @@
6
6
  <%= stylesheet_link_tag 'admin/all' %>
7
7
  <%= javascript_include_tag 'admin/all' %>
8
8
 
9
- <%= render "spree/admin/shared/translations" %>
10
- <%= render "spree/admin/shared/routes" %>
9
+ <%= javascript_tag do %>
10
+ Spree.routes = <%== {
11
+ :product_search => spree.admin_products_path(:format => 'json'),
12
+ :product_search_basic => spree.admin_products_path(:format => 'json', :json_format => 'basic', :limit => 10),
13
+ :user_search => spree.admin_search_users_path(:format => 'json', :limit => 10)
14
+ }.to_json %>;
15
+
16
+ strings = <%==
17
+ [:no_results, :type_to_search, :searching].
18
+ inject({}){|memo, item| {item => t(item) }}.to_json
19
+ %>
20
+ <% end %>
11
21
 
12
22
  <%= javascript_tag do -%>
13
23
  jQuery.alerts.dialogClass = 'spree';
@@ -6,7 +6,7 @@
6
6
  <h5 id="order_status" data-hook><%= t(:status) %>: <%= t(@order.state, :scope => :order_state) %></h5>
7
7
  <h5 id="order_total" data-hook><%= t(:total) %>: <%= number_to_currency @order.total %></h5>
8
8
  <% if @order.completed? %>
9
- <h5 id="shipment_status"><%= t(:shipment) %>: <%= t(@order.shipment_state, :scope => :shipment_states, :default => [:missing, "none"]) %></h5>
9
+ <h5 id="shipment_status"><%= t(:shipment) %>: <%= t(@order.shipment_state, :scope => :shipment_state, :default => [:missing, "none"]) %></h5>
10
10
  <h5 id="payment_status"><%= t(:payment) %>: <%= t(@order.payment_state, :scope => :payment_states, :default => [:missing, "none"]) %></h5>
11
11
  <% end %>
12
12
  <br class="clear" />
@@ -50,9 +50,6 @@
50
50
  <li<%== ' class="active"' if current == 'Return Authorizations' %>>
51
51
  <%= link_to t(:return_authorizations), admin_order_return_authorizations_url(@order) %>
52
52
  </li>
53
- <li<%== ' class="active"' if current == 'History' %>>
54
- <%= link_to t(:history), history_admin_order_url(@order) %>
55
- </li>
56
53
  <% end %>
57
54
  </ul>
58
55