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
Binary file
@@ -1,10 +0,0 @@
1
- $(document).ready(function(){
2
-
3
- $('#new_image_link').click(function (event) {
4
- event.preventDefault();
5
- $(this).hide();
6
- $.ajax({type: 'GET', url: this.href, data: ({authenticity_token: AUTH_TOKEN}),
7
- success: function(r){ $('#images').html(r);} });
8
- });
9
-
10
- });
@@ -1,5 +0,0 @@
1
- $('#cancel_link').click(function (event) {
2
- event.preventDefault();
3
- $('#new_image_link').show();
4
- $('#images').html('');
5
- });
@@ -1,2 +0,0 @@
1
- $(function() {
2
- });
@@ -1,11 +0,0 @@
1
- (function($){
2
- $(document).ready(function(){
3
- if($('form#update-cart').is('*')){
4
- $('form#update-cart a.delete').show().on('click', function(e){
5
- $(this).parents('.line-item').first().find('input.line_item_quantity').val(0);
6
- $(this).parents('form').first().submit();
7
- e.preventDefault();
8
- });
9
- }
10
- });
11
- })(jQuery);
@@ -1,78 +0,0 @@
1
- (function($){
2
- $(document).ready(function(){
3
- if($('#checkout_form_address').is('*')){
4
-
5
- $('#checkout_form_address').validate();
6
-
7
- var get_states = function(region){
8
- country = $('p#' + region + 'country' + ' span#' + region + 'country :only-child').val();
9
- return state_mapper[country];
10
- }
11
-
12
- var update_state = function(region) {
13
- states = get_states(region);
14
-
15
- state_select = $('p#' + region + 'state select');
16
- state_input = $('p#' + region + 'state input');
17
-
18
- if(states) {
19
- selected = parseInt(state_select.val());
20
- state_select.html('');
21
- states_with_blank = [["",""]].concat(states);
22
- $.each(states_with_blank, function(pos,id_nm) {
23
- var opt = $(document.createElement('option'))
24
- .attr('value', id_nm[0])
25
- .html(id_nm[1]);
26
- if(selected==id_nm[0]){
27
- opt.prop("selected", true);
28
- }
29
- state_select.append(opt);
30
- });
31
- state_select.prop("disabled", false).show();
32
- state_input.hide().prop("disabled", true);
33
-
34
- } else {
35
- state_input.prop("disabled", false).show();
36
- state_select.hide().prop("disabled", true);
37
- }
38
-
39
- };
40
-
41
- $('p#bcountry select').change(function() { update_state('b'); });
42
- $('p#scountry select').change(function() { update_state('s'); });
43
- update_state('b');
44
- update_state('s');
45
-
46
- $('input#order_use_billing').click(function() {
47
- if($(this).is(':checked')) {
48
- $('#shipping .inner').hide();
49
- $('#shipping .inner input, #shipping .inner select').prop("disabled", true);
50
- } else {
51
- $('#shipping .inner').show();
52
- $('#shipping .inner input, #shipping .inner select').prop("disabled", false);
53
- //only want to enable relevant field
54
- if(get_states('s')){
55
- $('span#sstate input').hide().prop("disabled", true);
56
- }else{
57
- $('span#sstate select').hide().prop("disabled", true);
58
- }
59
-
60
- }
61
- }).triggerHandler('click');
62
- }
63
-
64
- if($('#checkout_form_payment').is('*')){
65
- // Show fields for the selected payment method
66
- $("input[type='radio'][name='order[payments_attributes][][payment_method_id]']").click(function(){
67
- $('#payment-methods li').hide();
68
- if(this.checked){ $('#payment_method_'+this.value).show(); }
69
- }).triggerHandler('click');
70
- }
71
- });
72
- })(jQuery);
73
-
74
- function disableSaveOnClick() {
75
- $('form.edit_order').submit(function() {
76
- $(this).find(':submit, :image').attr('disabled', true).removeClass('primary').addClass('disabled');
77
- });
78
- }
@@ -1,49 +0,0 @@
1
- var add_image_handlers = function() {
2
- $("#main-image").data('selectedThumb', $('#main-image img').attr('src'));
3
- $('ul.thumbnails li').eq(0).addClass('selected');
4
-
5
- $('ul.thumbnails a').on('click', function(event) {
6
- $("#main-image").data('selectedThumb', $(event.currentTarget).attr('href'));
7
- $("#main-image").data('selectedThumbId', $(event.currentTarget).parent().attr('id'));
8
- $(this).mouseout(function() {
9
- $('ul.thumbnails li').removeClass('selected');
10
- $(event.currentTarget).parent('li').addClass('selected');
11
- });
12
- return false;
13
- });
14
- $('ul.thumbnails li').on('mouseenter', function(event) {
15
- $('#main-image img').attr('src', $(event.currentTarget).find('a').attr('href'));
16
- });
17
- $('ul.thumbnails li').on('mouseleave', function(event) {
18
- $('#main-image img').attr('src', $("#main-image").data('selectedThumb'));
19
- });
20
- };
21
-
22
- var show_variant_images = function(variant_id) {
23
- $('li.vtmb').hide();
24
- $('li.vtmb-' + variant_id).show();
25
- var currentThumb = $('#' + $("#main-image").data('selectedThumbId'));
26
- // if currently selected thumb does not belong to current variant, nor to common images,
27
- // hide it and select the first available thumb instead.
28
- if(!currentThumb.hasClass('vtmb-' + variant_id) && !currentThumb.hasClass('tmb-all')) {
29
- var thumb = $($('ul.thumbnails li:visible').eq(0));
30
- var newImg = thumb.find('a').attr('href');
31
- $('ul.thumbnails li').removeClass('selected');
32
- thumb.addClass('selected');
33
- $('#main-image img').attr('src', newImg);
34
- $("#main-image").data('selectedThumb', newImg);
35
- $("#main-image").data('selectedThumbId', thumb.attr('id'));
36
- }
37
- }
38
-
39
- $(document).ready(function() {
40
- add_image_handlers();
41
- if($('#product-variants input[type=radio]').length > 0) {
42
- show_variant_images($('#product-variants input[type=radio]').eq(0).attr('value'));
43
- }
44
-
45
- $('#product-variants input[type=radio]').click(function (event) {
46
- show_variant_images(this.value);
47
- });
48
- });
49
-
@@ -1,68 +0,0 @@
1
- module Spree
2
- module Admin
3
- class UsersController < ResourceController
4
-
5
- # http://spreecommerce.com/blog/2010/11/02/json-hijacking-vulnerability/
6
- before_filter :check_json_authenticity, :only => :index
7
-
8
- def index
9
- respond_with(@collection) do |format|
10
- format.html
11
- format.json { render :json => json_data }
12
- end
13
- end
14
-
15
- def dismiss_banner
16
- if request.xhr? and params[:banner_id]
17
- current_user.dismiss_banner(params[:banner_id])
18
- render :nothing => true
19
- end
20
- end
21
-
22
- protected
23
-
24
- def collection
25
- return @collection if @collection.present?
26
- unless request.xhr?
27
- @search = Spree::User.registered.ransack(params[:q])
28
- @collection = @search.result.page(params[:page]).per(Spree::Config[:admin_products_per_page])
29
- else
30
- #disabling proper nested include here due to rails 3.1 bug
31
- #@collection = User.includes(:bill_address => [:state, :country], :ship_address => [:state, :country]).
32
- @collection = Spree::User.includes(:bill_address, :ship_address).
33
- where("spree_users.email #{LIKE} :search
34
- OR (spree_addresses.firstname #{LIKE} :search AND spree_addresses.id = spree_users.bill_address_id)
35
- OR (spree_addresses.lastname #{LIKE} :search AND spree_addresses.id = spree_users.bill_address_id)
36
- OR (spree_addresses.firstname #{LIKE} :search AND spree_addresses.id = spree_users.ship_address_id)
37
- OR (spree_addresses.lastname #{LIKE} :search AND spree_addresses.id = spree_users.ship_address_id)",
38
- { :search => "#{params[:q].strip}%" }).
39
- limit(params[:limit] || 100)
40
- end
41
- end
42
-
43
- private
44
-
45
- # handling raise from Admin::ResourceController#destroy
46
- def user_destroy_with_orders_error
47
- invoke_callbacks(:destroy, :fails)
48
- render :status => :forbidden, :text => t(:error_user_destroy_with_orders)
49
- end
50
-
51
- # Allow different formats of json data to suit different ajax calls
52
- def json_data
53
- json_format = params[:json_format] or 'default'
54
- case json_format
55
- when 'basic'
56
- collection.map { |u| { 'id' => u.id, 'name' => u.email } }.to_json
57
- else
58
- address_fields = [:firstname, :lastname, :address1, :address2, :city, :zipcode, :phone, :state_name, :state_id, :country_id]
59
- includes = { :only => address_fields , :include => { :state => { :only => :name }, :country => { :only => :name } } }
60
-
61
- collection.to_json(:only => [:id, :email], :include =>
62
- { :bill_address => includes, :ship_address => includes })
63
- end
64
- end
65
-
66
- end
67
- end
68
- end
@@ -1,28 +0,0 @@
1
- <h4><%= t(:add_option_types) %></h4>
2
- <table class="index">
3
- <tr data-hook="option_type_header">
4
- <th><%= t(:name) %></th>
5
- <th><%= t(:presentation) %></th>
6
- <th></th>
7
- </tr>
8
- <% @available_option_types.each do |ot| %>
9
- <tr data-hook="option_type_row">
10
- <td><%= ot.name %></td>
11
- <td><%= ot.presentation %></td>
12
- <td class="actions"><%= link_to icon('add') + ' ' + t(:select),
13
- url_for(:controller => 'admin/option_types',
14
- :id => ot,
15
- :product_id => @product.permalink,
16
- :action => 'select',
17
- :option_type_id => ot),
18
- :remote => true,
19
- :class => 'iconlink' %>
20
- </td>
21
- </tr>
22
- <% end %>
23
- <% if @available_option_types.empty? %>
24
- <tr data-hook="option_type_empty">
25
- <td colspan="3"><%= t(:none_available) %></td>
26
- </tr>
27
- <% end %>
28
- </table>
@@ -1,26 +0,0 @@
1
- <table class="index">
2
- <tr data-hook="selected_head">
3
- <th><%= t(:name) %></th>
4
- <th><%= t(:presentation) %></th>
5
- <th>&nbsp;</th>
6
- </tr>
7
- <% @option_types.each do |option_type| %>
8
- <tr data-hook="selected_row">
9
- <td><%= option_type.name %></td>
10
- <td><%= option_type.presentation %></td>
11
- <td class="actions">
12
- <%= link_to_with_icon 'delete', t(:remove), remove_admin_product_option_type_url(@product, option_type) %>
13
- </td>
14
- </tr>
15
- <% end %>
16
- <% if @option_types.empty? %>
17
- <tr data-hook="selected_none"><td colspan="3"><%= t(:none) %></td></tr>
18
- <% end %>
19
- </table>
20
-
21
- <div id="option-types" data-hook></div>
22
- <% if @product.variants.empty? %>
23
- <span id="new_opt_link" data-hook="links">
24
- <%= link_to icon('add') + ' ' + t(:add_option_type), available_admin_product_option_types_url(@product), :remote => :true, :class => 'iconlink' %>
25
- </span>
26
- <% end %>
@@ -1,2 +0,0 @@
1
- $("#option-types").html("<%= escape_javascript(render 'available') %>");
2
- $("#new_opt_link").hide();
@@ -1,3 +0,0 @@
1
- $("#selected-options").html("<%= escape_javascript(render 'selected') %>");
2
- $("#option-types").html("");
3
- $("#new_opt_link").show();
@@ -1,6 +0,0 @@
1
- <%= render :partial => 'spree/admin/shared/product_sub_menu' %>
2
- <%= render :partial => 'spree/admin/shared/product_tabs', :locals => { :current => 'Option Types' } %>
3
-
4
- <div id="selected-options" data-hook>
5
- <%= render :partial => 'selected' %>
6
- </div>
@@ -1,29 +0,0 @@
1
- <%= render :partial => 'spree/admin/shared/order_tabs', :locals => { :current => 'History' } %>
2
-
3
- <h2><%= t(:history) %></h2>
4
-
5
- <table class="index">
6
- <tr data-hook="history_header">
7
- <th><%= t(:event) %></th>
8
- <th><%= t(:from_state) %></th>
9
- <th><%= t(:to_state) %></th>
10
- <th><%= t(:user) %></th>
11
- <th><%= "#{t('spree.date')}/#{t('spree.time')}" %></th>
12
- </tr>
13
- <% @order.state_changes.sort.each do |event| %>
14
- <tr data-hook="history_row">
15
- <td><%=t("#{event.name}") if event.name.present? %></td>
16
- <td><%=t("#{event.name}_state#{'s' unless event.name == 'order'}.#{event.previous_state}") %></td>
17
- <td><%=t("#{event.name}_state#{'s' unless event.name == 'order'}.#{event.next_state}") %></td>
18
- <td><%=event.user.email if event.user %></td>
19
- <td><%=event.created_at.to_s(:date_time24) %></td>
20
- </tr>
21
- <% end %>
22
- <% if @order.state_changes.empty? %>
23
- <tr data-hook="history_none">
24
- <td colspan="5"><%= t(:none_available) %></td>
25
- </tr>
26
- <% end %>
27
- </table>
28
-
29
- <%= button_link_to t(:continue), admin_orders_url %>
@@ -1,40 +0,0 @@
1
- <h2><%= t(:selected_option_types) %></h2>
2
- <table class="option-types" data-hook="option_types">
3
- <thead>
4
- <tr data-hook="option_types_header">
5
- <th><%= t(:name) %></th>
6
- <th><%= t(:display) %></th>
7
- <th><%= t(:action) %></th>
8
- </tr>
9
- </thead>
10
- <tbody>
11
- <% @product.selected_options.each do |so| %>
12
- <tr data-hook="option_types_row">
13
- <td><%= so.option_type.name%></td>
14
- <td><%= so.option_type.presentation%></td>
15
- <td>
16
- <%= link_to_remote t(:remove),
17
- :url => {:action => 'remove_option_type', :id => @product, :product_option_type_id => so},
18
- :before => "$('#select-link').hide(); $('#busy_indicator').show()",
19
- :complete => "$('#busy_indicator').hide()",
20
- :update => 'option-type-listing' %>
21
- </td>
22
- </tr>
23
- <% end %>
24
- <% if @product.selected_options.empty? %>
25
- <tr>
26
- <td colspan="3"><%= t(:none) %></td>
27
- </tr>
28
- <% end %>
29
- </tbody>
30
- </table>
31
- <% unless @product.new_record? %>
32
- <span id="select-link" data-hook>
33
- <%= link_to_remote icon('delete') + ' ' + t(:select_option_type), {
34
- :url => {:controller => 'option_types', :action => 'select', :id => @product},
35
- :update => 'new-option-type'}, :class => 'iconlink' %>
36
- </span>
37
- <%= image_tag 'spinner.gif', :plugin => 'spree', :style => 'display:none;', :id => 'busy_indicator' %>
38
- <% end %>
39
- <br />
40
- <div id="new-option-type" data-hook></div>
@@ -1,5 +0,0 @@
1
- <p>
2
- <%= label controller.controller_name.singularize, field[:name], t('activerecord.attributes.spree/variant.' + field[:name].downcase, :default => field[:name].titleize) %><br />
3
- <%= additional_field_for(controller, field) %>
4
- <%= error_message_on controller.controller_name.singularize, attribute_name_for(field[:name]) %>
5
- </p>
@@ -1,8 +0,0 @@
1
- <script>
2
- Spree.routes = <%== {
3
- :product_search => spree.admin_products_path(:format => 'json'),
4
- :product_search_basic => spree.admin_products_path(:format => 'json', :json_format => 'basic', :limit => 10),
5
- :user_search => spree.admin_users_path(:format => 'json', :limit => 10)
6
- }.to_json
7
- %>
8
- </script>
@@ -1,17 +0,0 @@
1
- <script>
2
- Spree.translations = <%==
3
- { :date_picker => I18n.t(:format,
4
- :scope => 'spree.date_picker',
5
- :default => 'yy/mm/dd'),
6
- :abbr_day_names => I18n.t(:abbr_day_names, :scope => :date),
7
- :month_names => I18n.t(:month_names, :scope => :date).delete_if(&:blank?),
8
- :previous => I18n.t(:previous),
9
- :next => I18n.t(:next),
10
- :no_results => I18n.t(:no_results),
11
- :type_to_search => I18n.t(:type_to_search),
12
- :searching => I18n.t(:searching),
13
- :sku => I18n.t(:sku),
14
- :on_hand => I18n.t(:on_hand)
15
- }.to_json
16
- %>
17
- </script>
@@ -1,26 +0,0 @@
1
- <h4><%= t(:available_taxons) %></h4>
2
- <table class="index">
3
- <thead>
4
- <tr>
5
- <th><%= t(:name) %></th>
6
- <th><%= t(:path) %></th>
7
- <th><%= t(:action) %></th>
8
- </tr>
9
- </thead>
10
- <tbody>
11
- <% @taxons.each do |taxon| %>
12
- <tr id="<%= dom_id(taxon, :sel) %>">
13
- <td><%= taxon.name %></td>
14
- <td><%= taxon_path taxon %></td>
15
- <td class="actions">
16
- <%= link_to icon(:add) + ' ' + t(:select),
17
- select_admin_product_taxon_path(@product, taxon),
18
- :remote => true, :class => 'iconlink' %>
19
- </td>
20
- </tr>
21
- <% end %>
22
- <% if @taxons.empty? %>
23
- <tr><td colspan="3"><%= t(:no_match_found) %>.</td></tr>
24
- <% end %>
25
- </tbody>
26
- </table>