spree_core 1.0.7 → 1.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. data/app/assets/javascripts/admin/admin.js.erb +9 -18
  2. data/app/assets/javascripts/admin/calculator.js +7 -6
  3. data/app/assets/javascripts/admin/checkouts/edit.js +2 -2
  4. data/app/assets/javascripts/admin/image_settings.js +49 -0
  5. data/app/assets/javascripts/admin/orders/edit_form.js +14 -14
  6. data/app/assets/stylesheets/admin/admin.css.erb +36 -54
  7. data/app/assets/stylesheets/store/screen.css.scss +25 -12
  8. data/app/controllers/spree/admin/base_controller.rb +3 -3
  9. data/app/controllers/spree/admin/image_settings_controller.rb +71 -0
  10. data/app/controllers/spree/admin/images_controller.rb +22 -21
  11. data/app/controllers/spree/admin/mail_methods_controller.rb +1 -1
  12. data/app/controllers/spree/admin/orders/customer_details_controller.rb +2 -2
  13. data/app/controllers/spree/admin/orders_controller.rb +13 -13
  14. data/app/controllers/spree/admin/payment_methods_controller.rb +1 -1
  15. data/app/controllers/spree/admin/payments_controller.rb +1 -1
  16. data/app/controllers/spree/admin/product_properties_controller.rb +3 -4
  17. data/app/controllers/spree/admin/products_controller.rb +49 -47
  18. data/app/controllers/spree/admin/properties_controller.rb +1 -1
  19. data/app/controllers/spree/admin/prototypes_controller.rb +12 -6
  20. data/app/controllers/spree/admin/reports_controller.rb +15 -16
  21. data/app/controllers/spree/admin/resource_controller.rb +1 -1
  22. data/app/controllers/spree/admin/return_authorizations_controller.rb +1 -1
  23. data/app/controllers/spree/admin/shipments_controller.rb +0 -3
  24. data/app/controllers/spree/admin/states_controller.rb +9 -9
  25. data/app/controllers/spree/admin/users_controller.rb +18 -42
  26. data/app/controllers/spree/admin/variants_controller.rb +22 -21
  27. data/app/controllers/spree/admin/zones_controller.rb +11 -11
  28. data/app/controllers/spree/content_controller.rb +1 -1
  29. data/app/controllers/spree/locale_controller.rb +2 -2
  30. data/app/controllers/spree/orders_controller.rb +4 -6
  31. data/app/controllers/spree/products_controller.rb +1 -1
  32. data/app/controllers/spree/states_controller.rb +4 -7
  33. data/app/helpers/spree/admin/base_helper.rb +4 -0
  34. data/app/helpers/spree/admin/navigation_helper.rb +4 -16
  35. data/app/helpers/spree/base_helper.rb +22 -3
  36. data/app/models/spree/activator.rb +4 -1
  37. data/app/models/spree/address.rb +45 -45
  38. data/app/models/spree/adjustment.rb +4 -4
  39. data/app/models/spree/app_configuration.rb +12 -0
  40. data/app/models/spree/calculator/default_tax.rb +1 -3
  41. data/app/models/spree/calculator/flat_percent_item_total.rb +0 -2
  42. data/app/models/spree/calculator/flat_rate.rb +0 -3
  43. data/app/models/spree/calculator/flexi_rate.rb +1 -3
  44. data/app/models/spree/calculator/per_item.rb +1 -6
  45. data/app/models/spree/calculator/price_sack.rb +0 -2
  46. data/app/models/spree/country.rb +1 -1
  47. data/app/models/spree/creditcard.rb +9 -10
  48. data/app/models/spree/gateway.rb +0 -2
  49. data/app/models/spree/image.rb +18 -2
  50. data/app/models/spree/inventory_unit.rb +4 -2
  51. data/app/models/spree/mail_method.rb +1 -6
  52. data/app/models/spree/option_type.rb +3 -1
  53. data/app/models/spree/order.rb +68 -62
  54. data/app/models/spree/payment.rb +1 -1
  55. data/app/models/spree/payment_method.rb +0 -6
  56. data/app/models/spree/product/scopes.rb +44 -44
  57. data/app/models/spree/product.rb +44 -26
  58. data/app/models/spree/product_property.rb +0 -2
  59. data/app/models/spree/property.rb +0 -16
  60. data/app/models/spree/prototype.rb +0 -1
  61. data/app/models/spree/return_authorization.rb +0 -2
  62. data/app/models/spree/shipment.rb +2 -3
  63. data/app/models/spree/shipping_category.rb +0 -2
  64. data/app/models/spree/shipping_method.rb +1 -2
  65. data/app/models/spree/shipping_rate.rb +9 -0
  66. data/app/models/spree/state.rb +10 -2
  67. data/app/models/spree/{state_event.rb → state_change.rb} +1 -4
  68. data/app/models/spree/tax_rate.rb +3 -3
  69. data/app/models/spree/taxon.rb +1 -6
  70. data/app/models/spree/taxonomy.rb +3 -6
  71. data/app/models/spree/user.rb +1 -0
  72. data/app/models/spree/variant.rb +3 -4
  73. data/app/models/spree/zone.rb +0 -10
  74. data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +1 -1
  75. data/app/views/spree/admin/configurations/index.html.erb +4 -0
  76. data/app/views/spree/admin/image_settings/edit.html.erb +91 -0
  77. data/app/views/spree/admin/image_settings/show.html.erb +11 -0
  78. data/app/views/spree/admin/images/index.html.erb +3 -3
  79. data/app/views/spree/admin/mail_methods/_form.html.erb +1 -1
  80. data/app/views/spree/admin/mail_methods/index.html.erb +1 -1
  81. data/app/views/spree/admin/option_types/_option_value_fields.html.erb +1 -1
  82. data/app/views/spree/admin/option_types/index.html.erb +1 -1
  83. data/app/views/spree/admin/option_types/new.js.erb +1 -1
  84. data/app/views/spree/admin/orders/_form.html.erb +3 -5
  85. data/app/views/spree/admin/orders/_line_item.html.erb +1 -1
  86. data/app/views/spree/admin/orders/customer_details/_form.html.erb +1 -1
  87. data/app/views/spree/admin/orders/history.html.erb +2 -2
  88. data/app/views/spree/admin/orders/index.html.erb +19 -19
  89. data/app/views/spree/admin/payment_methods/_form.html.erb +1 -1
  90. data/app/views/spree/admin/payment_methods/index.html.erb +1 -3
  91. data/app/views/spree/admin/payments/_list.html.erb +1 -1
  92. data/app/views/spree/admin/product_properties/index.html.erb +1 -1
  93. data/app/views/spree/admin/products/_form.html.erb +30 -27
  94. data/app/views/spree/admin/products/index.html.erb +9 -9
  95. data/app/views/spree/admin/products/new.html.erb +28 -4
  96. data/app/views/spree/admin/products/new.js.erb +1 -1
  97. data/app/views/spree/admin/properties/index.html.erb +1 -1
  98. data/app/views/spree/admin/properties/new.js.erb +1 -1
  99. data/app/views/spree/admin/prototypes/index.html.erb +1 -1
  100. data/app/views/spree/admin/prototypes/new.js.erb +1 -1
  101. data/app/views/spree/admin/prototypes/show.html.erb +42 -0
  102. data/app/views/spree/admin/return_authorizations/index.html.erb +1 -1
  103. data/app/views/spree/admin/shared/_address_form.html.erb +1 -1
  104. data/app/views/spree/admin/shared/_calculator_fields.html.erb +2 -2
  105. data/app/views/spree/admin/shared/_head.html.erb +3 -3
  106. data/app/views/spree/admin/shared/_order_details.html.erb +1 -1
  107. data/app/views/spree/admin/shared/_order_tabs.html.erb +6 -6
  108. data/app/views/spree/admin/shared/_product_sub_menu.html.erb +0 -1
  109. data/app/views/spree/admin/shared/_report_criteria.html.erb +3 -3
  110. data/app/views/spree/admin/shared/_tabs.html.erb +1 -1
  111. data/app/views/spree/admin/shared/_update_order_state.js +5 -4
  112. data/app/views/spree/admin/shipments/index.html.erb +1 -1
  113. data/app/views/spree/admin/shipping_categories/index.html.erb +1 -1
  114. data/app/views/spree/admin/shipping_methods/index.html.erb +1 -1
  115. data/app/views/spree/admin/states/_state_list.html.erb +1 -1
  116. data/app/views/spree/admin/states/new.js.erb +1 -1
  117. data/app/views/spree/admin/tax_categories/index.html.erb +2 -2
  118. data/app/views/spree/admin/tax_rates/index.html.erb +2 -2
  119. data/app/views/spree/admin/taxonomies/_list.html.erb +1 -1
  120. data/app/views/spree/admin/trackers/_form.html.erb +1 -1
  121. data/app/views/spree/admin/trackers/index.html.erb +1 -1
  122. data/app/views/spree/admin/users/_form.html.erb +1 -16
  123. data/app/views/spree/admin/users/index.html.erb +3 -4
  124. data/app/views/spree/admin/variants/index.html.erb +2 -2
  125. data/app/views/spree/admin/variants/new.js.erb +1 -1
  126. data/app/views/spree/admin/zones/index.html.erb +1 -1
  127. data/app/views/spree/checkout/_address.html.erb +1 -1
  128. data/app/views/spree/checkout/edit.html.erb +1 -1
  129. data/app/views/spree/checkout/registration.html.erb +2 -2
  130. data/app/views/spree/order_mailer/confirm_email.text.erb +3 -3
  131. data/app/views/spree/orders/show.html.erb +2 -2
  132. data/app/views/spree/products/_cart_form.html.erb +1 -2
  133. data/app/views/spree/products/_image.html.erb +1 -1
  134. data/app/views/spree/products/show.html.erb +3 -3
  135. data/app/views/spree/shared/_filters.html.erb +26 -24
  136. data/app/views/spree/shared/_google_analytics.html.erb +26 -26
  137. data/app/views/spree/shared/_products.html.erb +2 -2
  138. data/app/views/spree/shared/_search.html.erb +1 -1
  139. data/app/views/spree/shared/_store_menu.html.erb +1 -1
  140. data/app/views/spree/states/index.js.erb +1 -1
  141. data/config/initializers/rails_3_1.rb +3 -3
  142. data/config/locales/en.yml +40 -35
  143. data/config/routes.rb +5 -13
  144. data/db/migrate/20101026184714_migrate_transactions_to_payment_state.rb +4 -4
  145. data/db/migrate/20111007143030_namespace_top_level_models.rb +0 -3
  146. data/db/migrate/20120203001428_rename_state_events_to_state_changes.rb +9 -0
  147. data/db/migrate/20120315064358_migrate_images_from_products_to_variants.rb +35 -0
  148. data/lib/generators/spree/dummy/templates/rails/database.yml +48 -20
  149. data/lib/generators/spree/install/install_generator.rb +17 -1
  150. data/lib/generators/spree/install/templates/app/assets/javascripts/admin/all.js +0 -1
  151. data/lib/generators/spree/install/templates/app/assets/javascripts/store/all.js +0 -1
  152. data/lib/generators/spree/install/templates/app/assets/stylesheets/admin/all.css +0 -1
  153. data/lib/generators/spree/install/templates/app/assets/stylesheets/store/all.css +0 -1
  154. data/lib/generators/spree/sandbox/sandbox_generator.rb +9 -2
  155. data/lib/spree/core/calculated_adjustments.rb +29 -34
  156. data/lib/spree/core/controller_helpers.rb +36 -34
  157. data/lib/spree/core/custom_fixtures.rb +1 -1
  158. data/lib/spree/core/delegate_belongs_to.rb +22 -24
  159. data/lib/spree/core/engine.rb +3 -3
  160. data/lib/spree/core/environment_extension.rb +12 -15
  161. data/lib/spree/core/mail_settings.rb +1 -1
  162. data/lib/spree/core/permalinks.rb +24 -16
  163. data/lib/spree/core/preference_rescue.rb +1 -1
  164. data/lib/spree/core/respond_with.rb +13 -8
  165. data/lib/spree/core/responder.rb +1 -2
  166. data/lib/spree/core/search/base.rb +36 -19
  167. data/lib/spree/core/ssl_requirement.rb +18 -10
  168. data/lib/spree/core/testing_support/common_rake.rb +1 -1
  169. data/lib/spree/core/testing_support/factories/product_factory.rb +9 -9
  170. data/lib/spree/core/testing_support/factories/role_factory.rb +1 -1
  171. data/lib/spree/core/testing_support/factories/shipping_category_factory.rb +1 -1
  172. data/lib/spree/core/testing_support/factories/shipping_method_factory.rb +3 -3
  173. data/lib/spree/core/testing_support/factories/user_factory.rb +1 -1
  174. data/lib/spree/core/testing_support/factories/zone_factory.rb +4 -2
  175. data/lib/spree/core/validators/email.rb +23 -0
  176. data/lib/spree/core/version.rb +1 -1
  177. data/lib/spree/core.rb +2 -2
  178. data/lib/spree/product_filters.rb +10 -19
  179. data/lib/tasks/core.rake +1 -1
  180. data/vendor/assets/javascripts/jquery.alerts/jquery.alerts.css.erb +5 -5
  181. data/vendor/assets/stylesheets/jquery-ui.datepicker.css.erb +1 -1
  182. metadata +68 -140
  183. data/app/assets/images/noimage/large.png +0 -0
  184. data/app/controllers/spree/admin/product_groups_controller.rb +0 -49
  185. data/app/controllers/spree/admin/product_scopes_controller.rb +0 -39
  186. data/app/helpers/spree/admin/product_groups_helper.rb +0 -14
  187. data/app/helpers/spree/admin/product_properties_helper.rb +0 -24
  188. data/app/models/spree/product_group.rb +0 -200
  189. data/app/models/spree/product_scope.rb +0 -79
  190. data/app/views/spree/admin/banners/_gateway.html.erb +0 -14
  191. data/app/views/spree/admin/product_groups/_preview.html.erb +0 -33
  192. data/app/views/spree/admin/product_groups/_product_scope.html.erb +0 -24
  193. data/app/views/spree/admin/product_groups/edit.html.erb +0 -59
  194. data/app/views/spree/admin/product_groups/index.html.erb +0 -37
  195. data/app/views/spree/admin/product_groups/new.html.erb +0 -12
  196. data/app/views/spree/admin/product_groups/show.html.erb +0 -32
  197. data/app/views/spree/admin/product_scopes/create.js.erb +0 -6
  198. data/app/views/spree/admin/product_scopes/destroy.js.erb +0 -3
  199. data/app/views/spree/admin/product_scopes/new.html.erb +0 -1
  200. data/app/views/spree/admin/shared/_group_from_products_form.html.erb +0 -12
  201. data/db/migrate/20091012120519_product_groups_and_scopes.rb +0 -18
  202. data/db/migrate/20100126103714_create_products_product_groups.rb +0 -8
  203. data/db/migrate/20100306153445_fix_by_popularity.rb +0 -9
  204. data/db/migrate/20120523061241_convert_sales_tax_to_default_tax.rb +0 -9
  205. data/lib/spree/core/testing_support/factories/product_group_factory.rb +0 -5
  206. data/lib/spree/core/testing_support/factories/product_scope_factory.rb +0 -7
  207. data/lib/spree/core/theme_support/hook_listener.rb +0 -145
  208. data/lib/spree/core/theme_support.rb +0 -1
  209. data/vendor/assets/javascripts/jquery.alerts/jquery.alerts.css +0 -57
@@ -1,4 +1,3 @@
1
- <%# encoding: utf-8 %>
2
1
  //= require_self
3
2
 
4
3
  /**
@@ -60,10 +59,8 @@ format_product_autocomplete = function(item){
60
59
  }
61
60
 
62
61
  html += "<div><h4>" + product['name'] + "</h4>";
63
- if (product['master']) {
64
- html += "<span><strong><%= ::I18n.t(:sku) %>: </strong>" + product['master']['sku'] + "</span>";
65
- }
66
- html += "<span><strong><%= ::I18n.t(:on_hand) %>: </strong>" + product['count_on_hand'] + "</span></div>";
62
+ html += "<span><strong>Sku: </strong>" + product['master']['sku'] + "</span>";
63
+ html += "<span><strong>On Hand: </strong>" + product['count_on_hand'] + "</span></div>";
67
64
  }else{
68
65
  // variant
69
66
  var variant = item.data['variant'];
@@ -78,12 +75,12 @@ format_product_autocomplete = function(item){
78
75
  }
79
76
 
80
77
  name += " - " + $.map(variant['option_values'], function(option_value){
81
- return option_value["option_type"]["presentation"] + ": " + option_value['presentation'];
78
+ return option_value["option_type"]["presentation"] + ": " + option_value['name'];
82
79
  }).join(", ")
83
80
 
84
81
  html += "<div><h4>" + name + "</h4>";
85
- html += "<span><strong><%= ::I18n.t(:sku) %>: </strong>" + variant['sku'] + "</span>";
86
- html += "<span><strong><%= ::I18n.t(:on_hand) %>: </strong>" + variant['count_on_hand'] + "</span></div>";
82
+ html += "<span><strong>Sku: </strong>" + variant['sku'] + "</span>";
83
+ html += "<span><strong>On Hand: </strong>" + variant['count_on_hand'] + "</span></div>";
87
84
  }
88
85
 
89
86
  return html
@@ -100,7 +97,7 @@ prep_product_autocomplete_data = function(data){
100
97
 
101
98
  var name = product['name'];
102
99
  name += " - " + $.map(variant['option_values'], function(option_value){
103
- return option_value["option_type"]["presentation"] + ": " + option_value['presentation'];
100
+ return option_value["option_type"]["presentation"] + ": " + option_value['name'];
104
101
  }).join(", ");
105
102
 
106
103
  return {
@@ -123,7 +120,7 @@ $.fn.product_autocomplete = function(){
123
120
  return this.each(function() {
124
121
  $(this).autocomplete({
125
122
  source: function(request, response) {
126
- $.get(ajax_urls.product_search_json + "?q=" + $('#add_product_name').val() + "&authenticity_token=" + encodeURIComponent($('meta[name=csrf-token]').attr("content")), function(data) {
123
+ $.get("/admin/products.json?q=" + $('#add_product_name').val() + "&authenticity_token=" + encodeURIComponent($('meta[name=csrf-token]').attr("content")), function(data) {
127
124
  result = prep_product_autocomplete_data(data)
128
125
  response(result);
129
126
  });
@@ -174,9 +171,8 @@ $.fn.objectPicker = function(url){
174
171
  $.fn.productPicker = function(){
175
172
  $(this).objectPicker(ajax_urls.product_search_basic_json);
176
173
  }
177
-
178
174
  $.fn.userPicker = function(){
179
- $(this).objectPicker(ajax_urls.user_search_json);
175
+ $(this).objectPicker(ajax_urls.user_search_basic_json);
180
176
  }
181
177
 
182
178
  // Possible defunct
@@ -210,12 +206,7 @@ $(".observe_field").live('change', function() {
210
206
 
211
207
  handle_date_picker_fields = function(){
212
208
  $('.datepicker').datepicker({
213
- dateFormat: "<%= ::I18n.t(:format, :scope => 'spree.date_picker', :default => 'yy/mm/dd') %>",
214
- dayNames: <%= ::I18n.t(:day_names, :scope => :date).to_json %>,
215
- dayNamesMin: <%= ::I18n.t(:abbr_day_names, :scope => :date).to_json %>,
216
- monthNames: <%= (::I18n.t(:month_names, :scope => :date).delete_if(&:blank?)).to_json %>,
217
- prevText: '<%= ::I18n.t(:previous) %>',
218
- nextText: '<%= ::I18n.t(:next) %>',
209
+ dateFormat: 'yy/mm/dd',
219
210
  showOn: "button",
220
211
  buttonImage: "<%= asset_path 'datepicker/cal.gif' %>",
221
212
  buttonImageOnly: true
@@ -1,14 +1,15 @@
1
1
  $(function() {
2
- var original_calc_type = $('#calc-type').attr('value');
3
- $('div.calculator-settings-warning').hide();
4
- $('#calc-type').change(function() {
5
- if ($('#calc-type').attr('value') == original_calc_type) {
2
+ var calculator_select = $('select#calc_type')
3
+ var original_calc_type = calculator_select.attr('value');
4
+ $('div#calculator-settings-warning').hide();
5
+ calculator_select.change(function() {
6
+ if (calculator_select.attr('value') == original_calc_type) {
6
7
  $('div.calculator-settings').show();
7
- $('div.calculator-settings-warning').hide();
8
+ $('div#calculator-settings-warning').hide();
8
9
  $('.calculator-settings input').prop("disabled", false);
9
10
  } else {
10
11
  $('div.calculator-settings').hide();
11
- $('div.calculator-settings-warning').show();
12
+ $('div#calculator-settings-warning').show();
12
13
  $('.calculator-settings input').prop("disabled", true);
13
14
  }
14
15
  });
@@ -46,7 +46,7 @@ $(document).ready(function(){
46
46
  minChars: 5,
47
47
  delay: 1500,
48
48
  source: function(request, response) {
49
- $.get(ajax_urls.user_search_json + "&q=" + $("#customer_search").val() + "&authenticity_token=" + encodeURIComponent($('meta[name=csrf-token]').attr("content")), function(data) {
49
+ $.get("/admin/users.json?q=" + $("#customer_search").val() + "&authenticity_token=" + encodeURIComponent($('meta[name=csrf-token]').attr("content")), function(data) {
50
50
  result = prep_user_autocomplete_data(data)
51
51
  response(result);
52
52
  });
@@ -78,7 +78,6 @@ $(document).ready(function(){
78
78
  $('#user_id').val(ui.item.data['id']);
79
79
  $('#guest_checkout_true').prop("checked", false);
80
80
  $('#guest_checkout_false').prop("checked", true);
81
- $('#guest_checkout_false').prop("disabled", false);
82
81
  return true;
83
82
  }
84
83
  }).data("autocomplete")._renderItem = function(ul, item) {
@@ -108,6 +107,7 @@ $(document).ready(function(){
108
107
  $('#customer_search').val("");
109
108
  $('#user_id').val("");
110
109
  $('#checkout_email').val("");
110
+ $('#guest_checkout_false').prop("disabled", true);
111
111
 
112
112
  $('#order_bill_address_attributes_firstname').val("");
113
113
  $('#order_bill_address_attributes_lastname').val("");
@@ -0,0 +1,49 @@
1
+ $(document).ready(function() {
2
+
3
+ if ($('input#preferences_use_s3[type="checkbox"]:checked').length > 0)
4
+ $('#s3_settings').show();
5
+
6
+ // Toggle display of S3 settings based on value of use_s3 checkbox
7
+ $('input#preferences_use_s3[type="checkbox"]').click(function() {
8
+ $('#s3_settings').toggle();
9
+ });
10
+
11
+ $('.destroy_style').live("click", function() {
12
+ $(this).parent().remove();
13
+ });
14
+
15
+ $('.destroy_header').live("click", function() {
16
+ $(this).parent().remove();
17
+ });
18
+
19
+ // Handle adding new styles
20
+ var styles_hash_index = 1;
21
+ $('.add_style').click(function() {
22
+ $('#styles_list').append(generate_html_for_hash("new_attachment_styles", styles_hash_index));
23
+ });
24
+
25
+ // Handle adding new headers
26
+ var headers_hash_index = 1;
27
+ $('.add_header').click(function() {
28
+ $('#headers_list').append(generate_html_for_hash("new_s3_headers", headers_hash_index));
29
+ });
30
+
31
+ // Generates html for new paperclip styles form fields
32
+ generate_html_for_hash = function(hash_name, index) {
33
+ var html = '<li>';
34
+ html += '<label for="' + hash_name + '_' + index + '_name">';
35
+ html += 'Name</label>';
36
+ html += '<input id="' + hash_name + '_' + index + '_name" name="' + hash_name + '[' + index + '][name]" type="text">';
37
+ html += '<label for="' + hash_name + '_' + index + '_value">';
38
+ html += 'Value</label>';
39
+ html += '<input id="' + hash_name + '_' + index + '_value" name="' + hash_name + '[' + index + '][value]" type="text">';
40
+ html += '<a href="#" alt="Destroy" class="destroy_style">&nbsp;x</a>';
41
+ html += '</li>';
42
+
43
+ index += 1;
44
+ return html;
45
+ };
46
+
47
+
48
+
49
+ });
@@ -1,18 +1,18 @@
1
- $.each($('td.qty input'), function(i, inpt){
1
+ $(document).ready(function() {
2
+ $.each($('td.qty input'), function(i, input) {
2
3
 
3
- $(inpt).delayedObserver(function() {
4
+ $(input).live('change', function() {
4
5
 
5
- var id = $(this).attr('id').replace("order_line_items_attributes_", "").replace("_quantity", "");
6
- id = "#order_line_items_attributes_" + id + "_id";
6
+ var id = "#" + $(this).attr('id').replace("_quantity", "_id");
7
+ console.log($(this))
8
+ console.log($(id))
7
9
 
8
- jQuery.ajax({
9
- type: "POST",
10
- url: "/admin/orders/" + $('input#order_number').val() + "/line_items/" + $(id).val(),
11
- data: ({_method: "put", "line_item[quantity]": $(this).val()}),
12
- complete: function(resp){
13
- $('#order-form-wrapper').html(resp.responseText);
14
- }
15
- });
16
-
17
- }, 0,5);
10
+ jQuery.post("/admin/orders/" + $('input#order_number').val() + "/line_items/" + $(id).val(),
11
+ { _method: "put", "line_item[quantity]": $(this).val()},
12
+ function(resp) {
13
+ $('#order-form-wrapper').html(resp.responseText);
14
+ })
15
+ })
16
+ })
18
17
  });
18
+
@@ -313,7 +313,7 @@ body {
313
313
  width: 24px; }
314
314
  button.small {
315
315
  font-size: 1em;
316
- padding: 0 20px 0 0;
316
+ padding: 0 10px 0 10px;
317
317
  }
318
318
  input.title,
319
319
  textarea {
@@ -476,25 +476,15 @@ div#calculator-settings-warning, .warning {
476
476
  padding-right:10px;
477
477
  }
478
478
 
479
- ul#shipping-specs {
479
+ ul#shipping_specs {
480
480
  margin: 0;
481
481
  padding-bottom:10px;
482
482
  }
483
- ul#shipping-specs li {
483
+ ul#shipping_specs li {
484
484
  list-style-image:none;
485
485
  display:inline;
486
486
  }
487
487
 
488
- .product-scopes ul > li {
489
- float: left;
490
- width: 220px;
491
- margin-right: 20px;
492
- }
493
-
494
- .product-scopes .invalid {
495
- background-color: red;
496
- }
497
-
498
488
  div.product-preview-products {
499
489
  max-height: 200px;
500
490
  overflow: auto;
@@ -536,50 +526,29 @@ div.product-preview-products {
536
526
  padding-left:10px;
537
527
  }
538
528
 
539
-
540
-
541
-
542
-
543
-
544
-
545
- /* Product Groups */
546
-
547
- table#product_scopes tr {
548
- background-color: #eee;
549
-
550
- }
551
- table#product_scopes tr td {
552
- border-top: 4px solid #fff;
553
- border-bottom: 1px solid #bbb;
554
- padding: 5px 10px;
529
+ .product-prototype-options,
530
+ .product-prototype-options ul {
531
+ list-style-type: none;
532
+ margin-left: 0;
555
533
  }
556
- table#product_scopes tr td.actions {
557
- vertical-align: middle;
558
- text-align: right;
559
- }
560
- table#product_scopes tr td table {
561
- margin: 0;
534
+ .product-prototype-options > li {
535
+ display: block;
536
+ float: left;
562
537
  width: auto;
563
538
  }
564
- table#product_scopes tr td table tr td {
565
- padding: 0;
566
- border: none;
567
- padding-right: 5px;
539
+ .product-prototype-options > li b {
540
+ display: block;
541
+ padding-right: 30px;
542
+ margin-right: 20px;
543
+ font-size: 14px;
544
+ border-bottom: 1px solid #ddd;
568
545
  }
569
-
570
- #product_group_forms_container {
571
- position: relative;
546
+ .product-prototype-options > li ul {
547
+ padding: 5px 0;
572
548
  }
573
- #new_product_group_form {
574
- position: absolute;
575
- right: 25px;
576
- bottom: 0;
549
+ .product-prototype-options > li label {
550
+ padding-left: 5px;
577
551
  }
578
- #new_product_group_form p {
579
- text-align: right;
580
- margin: 0;
581
- }
582
-
583
552
 
584
553
  span.handle{
585
554
  background-image: url(<%= asset_path 'admin/icons/switch.png' %>);
@@ -597,9 +566,7 @@ span.handle{
597
566
  border: 1px solid #000;
598
567
  }
599
568
 
600
- .ac_results li div { max-width: 90%; }
601
-
602
- .ac_results li h4 { width: 100%; }
569
+ .ac_results li h4 { width: 100% }
603
570
 
604
571
  .ac_results li:last-child { border: none; }
605
572
 
@@ -686,3 +653,18 @@ span.handle{
686
653
  float: right;
687
654
  margin-right: 25px;
688
655
  }
656
+
657
+ /* Image Settings Styles */
658
+ #s3_settings {
659
+ display: none;
660
+ }
661
+ #styles_list {
662
+ list-style: none;
663
+ }
664
+ #headers_list {
665
+ list-style: none;
666
+ }
667
+ #s3_settings label, #attachment_styles label {
668
+ padding-left: 3px;
669
+ padding-right: 5px;
670
+ }
@@ -462,6 +462,7 @@ mark {background-color: $link_text_color; color: $layout_background_color; font-
462
462
  margin-top: 15px;
463
463
 
464
464
  input[type="number"] {
465
+ margin-right: 3px;
465
466
  width: 60px;
466
467
  vertical-align: middle;
467
468
  padding: 5px;
@@ -474,13 +475,13 @@ mark {background-color: $link_text_color; color: $layout_background_color; font-
474
475
  color: $link_text_color;
475
476
 
476
477
  &.selling {
477
- font-size: $product_detail_price_font_size;
478
+ font-size: $product_detail_price_font_size;
478
479
  }
479
480
  &.diff {
480
481
  font-weight: bold;
481
482
  }
482
483
  }
483
-
484
+
484
485
  .taxon-title {
485
486
  font-size: $product_list_header_font_size;
486
487
  }
@@ -490,14 +491,14 @@ mark {background-color: $link_text_color; color: $layout_background_color; font-
490
491
  }
491
492
 
492
493
  ul#products {
493
- &:after {
494
- content: " ";
495
- display: block;
496
- clear: both;
497
- visibility: hidden;
498
- line-height: 0;
499
- height: 0;
500
- }
494
+ &:after {
495
+ content: " ";
496
+ display: block;
497
+ clear: both;
498
+ visibility: hidden;
499
+ line-height: 0;
500
+ height: 0;
501
+ }
501
502
 
502
503
  li {
503
504
  text-align: center;
@@ -513,6 +514,7 @@ mark {background-color: $link_text_color; color: $layout_background_color; font-
513
514
  font-size: $product_list_name_font_size;
514
515
  color: $product_link_text_color;
515
516
  border-bottom: 1px solid lighten($body_text_color, 60);
517
+ overflow: hidden;
516
518
  }
517
519
  }
518
520
 
@@ -567,7 +569,7 @@ mark {background-color: $link_text_color; color: $layout_background_color; font-
567
569
  line-height: 24px;
568
570
  }
569
571
  }
570
-
572
+
571
573
  .taxon {
572
574
  overflow: hidden;
573
575
  }
@@ -629,6 +631,17 @@ mark {background-color: $link_text_color; color: $layout_background_color; font-
629
631
  }
630
632
  }
631
633
 
634
+ #cart-form {
635
+ #inside-product-cart-form:after {
636
+ content: " ";
637
+ display: block;
638
+ clear: both;
639
+ visibility: hidden;
640
+ line-height: 0;
641
+ height: 0;
642
+ }
643
+ }
644
+
632
645
  /*--------------------------------------*/
633
646
  /* Checkout
634
647
  /*--------------------------------------*/
@@ -807,7 +820,7 @@ mark {background-color: $link_text_color; color: $layout_background_color; font-
807
820
  /* Cart
808
821
  /*--------------------------------------*/
809
822
  table#cart-detail {
810
- width: 100%;
823
+ width: 100%;
811
824
  tbody#line_items {
812
825
  tr {
813
826
 
@@ -7,11 +7,11 @@ module Spree
7
7
  helper 'spree/admin/navigation'
8
8
  layout '/spree/layouts/admin'
9
9
 
10
- before_filter :check_alerts unless Rails.env.development?
10
+ before_filter :check_alerts
11
11
 
12
12
  protected
13
13
  def check_alerts
14
- return unless current_user and should_check_alerts?
14
+ return unless should_check_alerts?
15
15
 
16
16
  unless session.has_key? :alerts
17
17
  begin
@@ -25,7 +25,7 @@ module Spree
25
25
  end
26
26
 
27
27
  def should_check_alerts?
28
- return false if not Spree::Config[:check_for_spree_alerts]
28
+ return false if !Rails.env.production? || !Spree::Config[:check_for_spree_alerts]
29
29
 
30
30
  last_check = Spree::Config[:last_check_for_spree_alerts]
31
31
  return true if last_check.blank?
@@ -0,0 +1,71 @@
1
+ module Spree
2
+ module Admin
3
+ class ImageSettingsController < BaseController
4
+ def show
5
+ styles = ActiveSupport::JSON.decode(Spree::Config[:attachment_styles])
6
+ @styles_list = styles.collect { |k, v| k }.join(", ")
7
+ end
8
+
9
+ def edit
10
+ @styles = ActiveSupport::JSON.decode(Spree::Config[:attachment_styles])
11
+ @headers = ActiveSupport::JSON.decode(Spree::Config[:s3_headers])
12
+ end
13
+
14
+ def update
15
+ update_styles(params)
16
+ update_headers(params) if Spree::Config[:use_s3]
17
+
18
+ Spree::Config.set(params[:preferences])
19
+ update_paperclip_settings
20
+
21
+ respond_to do |format|
22
+ format.html {
23
+ flash[:notice] = t(:image_settings_updated)
24
+ redirect_to admin_image_settings_path
25
+ }
26
+ end
27
+ end
28
+
29
+
30
+ private
31
+
32
+ def update_styles(params)
33
+ params[:new_attachment_styles].each do |index, style|
34
+ params[:attachment_styles][style[:name]] = style[:value] unless style[:value].empty?
35
+ end if params[:new_attachment_styles].present?
36
+
37
+ styles = params[:attachment_styles]
38
+
39
+ Spree::Config[:attachment_styles] = ActiveSupport::JSON.encode(styles) unless styles.nil?
40
+ end
41
+
42
+ def update_headers(params)
43
+ params[:new_s3_headers].each do |index, header|
44
+ params[:s3_headers][header[:name]] = header[:value] unless header[:value].empty?
45
+ end if params[:new_s3_headers].present?
46
+
47
+ headers = params[:s3_headers]
48
+
49
+ Spree::Config[:s3_headers] = ActiveSupport::JSON.encode(headers) unless headers.nil?
50
+ end
51
+
52
+ def update_paperclip_settings
53
+ if Spree::Config[:use_s3]
54
+ s3_creds = { :access_key_id => Spree::Config[:s3_access_key], :secret_access_key => Spree::Config[:s3_secret], :bucket => Spree::Config[:s3_bucket] }
55
+ Spree::Image.attachment_definitions[:attachment][:storage] = :s3
56
+ Spree::Image.attachment_definitions[:attachment][:s3_credentials] = s3_creds
57
+ Spree::Image.attachment_definitions[:attachment][:s3_headers] = ActiveSupport::JSON.decode(Spree::Config[:s3_headers])
58
+ Spree::Image.attachment_definitions[:attachment][:bucket] = Spree::Config[:s3_bucket]
59
+ else
60
+ Spree::Image.attachment_definitions[:attachment].delete :storage
61
+ end
62
+
63
+ Spree::Image.attachment_definitions[:attachment][:styles] = ActiveSupport::JSON.decode(Spree::Config[:attachment_styles])
64
+ Spree::Image.attachment_definitions[:attachment][:path] = Spree::Config[:attachment_path]
65
+ Spree::Image.attachment_definitions[:attachment][:default_url] = Spree::Config[:attachment_default_url]
66
+ Spree::Image.attachment_definitions[:attachment][:default_style] = Spree::Config[:attachment_default_style]
67
+ end
68
+ end
69
+ end
70
+ end
71
+
@@ -17,36 +17,37 @@ module Spree
17
17
  end
18
18
  end
19
19
 
20
+
20
21
  private
21
22
 
22
- def location_after_save
23
- admin_product_images_url(@product)
24
- end
23
+ def location_after_save
24
+ admin_product_images_url(@product)
25
+ end
25
26
 
26
- def load_data
27
- @product = Product.find_by_permalink(params[:product_id])
28
- @variants = @product.variants.collect do |variant|
29
- [variant.options_text, variant.id ]
27
+ def load_data
28
+ @product = Product.find_by_permalink(params[:product_id])
29
+ @variants = @product.variants.collect do |variant|
30
+ [variant.options_text, variant.id]
31
+ end
32
+ @variants.insert(0, [I18n.t(:all), 'All'])
30
33
  end
31
- @variants.insert(0, [I18n.t(:all), 'All'])
32
- end
33
34
 
34
- def set_viewable
35
- if params[:image].has_key? :viewable_id
36
- if params[:image][:viewable_id] == "All"
37
- @image.viewable = @product
35
+ def set_viewable
36
+ if params[:image].has_key? :viewable_id
37
+ if params[:image][:viewable_id] == 'All'
38
+ @image.viewable = @product.master
39
+ else
40
+ @image.viewable_type = 'Spree::Variant'
41
+ @image.viewable_id = params[:image][:viewable_id]
42
+ end
38
43
  else
39
- @image.viewable_type = 'Spree::Variant'
40
- @image.viewable_id = params[:image][:viewable_id]
44
+ @image.viewable = @product.master
41
45
  end
42
- else
43
- @image.viewable = @product
44
46
  end
45
- end
46
47
 
47
- def destroy_before
48
- @viewable = @image.viewable
49
- end
48
+ def destroy_before
49
+ @viewable = @image.viewable
50
+ end
50
51
 
51
52
  end
52
53
  end
@@ -5,7 +5,7 @@ module Spree
5
5
 
6
6
  def testmail
7
7
  @mail_method = Spree::MailMethod.find(params[:id])
8
- if TestMailer.test_email(@mail_method, current_user).deliver
8
+ if TestMailer.test_email(@mail_method, respond_to?(:current_user) ? current_user : nil).deliver
9
9
  flash.notice = t('admin.mail_methods.testmail.delivery_success')
10
10
  else
11
11
  flash[:error] = t('admin.mail_methods.testmail.delivery_error')
@@ -10,8 +10,8 @@ module Spree
10
10
  end
11
11
 
12
12
  def edit
13
- @order.bill_address = Address.default if @order.bill_address.nil?
14
- @order.ship_address = Address.default if @order.ship_address.nil?
13
+ @order.build_bill_address(:country_id => Spree::Config[:default_country_id]) if @order.bill_address.nil?
14
+ @order.build_ship_address(:country_id => Spree::Config[:default_country_id]) if @order.ship_address.nil?
15
15
  end
16
16
 
17
17
  def update
@@ -9,27 +9,26 @@ module Spree
9
9
  respond_to :html
10
10
 
11
11
  def index
12
- params[:search] ||= {}
13
- params[:search][:completed_at_is_not_null] ||= '1' if Spree::Config[:show_only_complete_orders_by_default]
14
- @show_only_completed = params[:search][:completed_at_is_not_null].present?
15
- params[:search][:meta_sort] ||= @show_only_completed ? 'completed_at.desc' : 'created_at.desc'
12
+ params[:q] ||= {}
13
+ params[:q][:completed_at_not_null] ||= '1' if Spree::Config[:show_only_complete_orders_by_default]
14
+ @show_only_completed = params[:q][:completed_at_not_null].present?
15
+ params[:q][:meta_sort] ||= @show_only_completed ? 'completed_at.desc' : 'created_at.desc'
16
16
 
17
- @search = Order.metasearch(params[:search])
18
-
19
- if !params[:search][:created_at_greater_than].blank?
20
- params[:search][:created_at_greater_than] = Time.zone.parse(params[:search][:created_at_greater_than]).beginning_of_day rescue ""
17
+ if !params[:q][:created_at_gt].blank?
18
+ params[:q][:created_at_gt] = Time.zone.parse(params[:q][:created_at_gt]).beginning_of_day rescue ""
21
19
  end
22
20
 
23
- if !params[:search][:created_at_less_than].blank?
24
- params[:search][:created_at_less_than] = Time.zone.parse(params[:search][:created_at_less_than]).end_of_day rescue ""
21
+ if !params[:q][:created_at_lt].blank?
22
+ params[:q][:created_at_lt] = Time.zone.parse(params[:q][:created_at_lt]).end_of_day rescue ""
25
23
  end
26
24
 
27
25
  if @show_only_completed
28
- params[:search][:completed_at_greater_than] = params[:search].delete(:created_at_greater_than)
29
- params[:search][:completed_at_less_than] = params[:search].delete(:created_at_less_than)
26
+ params[:q][:completed_at_gt] = params[:q].delete(:created_at_gt)
27
+ params[:q][:completed_at_lt] = params[:q].delete(:created_at_lt)
30
28
  end
31
29
 
32
- @orders = Order.metasearch(params[:search]).includes([:user, :shipments, :payments]).page(params[:page]).per(Spree::Config[:orders_per_page])
30
+ @search = Order.search(params[:q])
31
+ @orders = @search.result.includes([:user, :shipments, :payments]).page(params[:page]).per(Spree::Config[:orders_per_page])
33
32
  respond_with(@orders)
34
33
  end
35
34
 
@@ -49,6 +48,7 @@ module Spree
49
48
  def update
50
49
  return_path = nil
51
50
  if @order.update_attributes(params[:order]) && @order.line_items.present?
51
+ @order.update!
52
52
  unless @order.complete?
53
53
 
54
54
  else
@@ -5,7 +5,7 @@ module Spree
5
5
  before_filter :load_data
6
6
 
7
7
  def create
8
- @payment_method = params[:payment_method][:type].constantize.new(params[:payment_method])
8
+ @payment_method = params[:payment_method].delete(:type).constantize.new(params[:payment_method])
9
9
  @object = @payment_method
10
10
  invoke_callbacks(:create, :before)
11
11
  if @payment_method.save