spree_core 1.2.0 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. data/app/assets/javascripts/admin/admin.js.erb +10 -9
  2. data/app/assets/javascripts/admin/checkouts/edit.js +4 -4
  3. data/app/assets/javascripts/admin/product_autocomplete.js.erb +5 -5
  4. data/app/assets/javascripts/admin/taxon_autocomplete.js.erb +34 -0
  5. data/app/assets/javascripts/admin/taxonomy.js +11 -11
  6. data/app/assets/javascripts/store/cart.js.coffee +5 -2
  7. data/app/assets/javascripts/store/checkout.js.coffee +8 -4
  8. data/app/assets/stylesheets/admin/admin-form.css.erb +4 -0
  9. data/app/assets/stylesheets/store/screen.css.scss +1 -1
  10. data/app/controllers/spree/admin/banners_controller.rb +2 -2
  11. data/app/controllers/spree/admin/mail_methods_controller.rb +7 -0
  12. data/app/controllers/spree/admin/orders_controller.rb +3 -1
  13. data/app/controllers/spree/admin/payment_methods_controller.rb +7 -1
  14. data/app/controllers/spree/admin/products_controller.rb +11 -6
  15. data/app/controllers/spree/admin/prototypes_controller.rb +1 -1
  16. data/app/controllers/spree/admin/search_controller.rb +11 -31
  17. data/app/controllers/spree/admin/taxons_controller.rb +8 -0
  18. data/app/controllers/spree/checkout_controller.rb +7 -1
  19. data/app/controllers/spree/home_controller.rb +1 -0
  20. data/app/controllers/spree/orders_controller.rb +18 -5
  21. data/app/controllers/spree/products_controller.rb +1 -0
  22. data/app/controllers/spree/taxons_controller.rb +1 -0
  23. data/app/helpers/spree/admin/general_settings_helper.rb +1 -1
  24. data/app/helpers/spree/base_helper.rb +1 -1
  25. data/app/models/spree/ability.rb +5 -0
  26. data/app/models/spree/app_configuration.rb +1 -0
  27. data/app/models/spree/calculator/price_sack.rb +5 -3
  28. data/app/models/spree/credit_card.rb +2 -2
  29. data/app/models/spree/image.rb +2 -1
  30. data/app/models/spree/inventory_unit.rb +11 -3
  31. data/app/models/spree/line_item.rb +3 -2
  32. data/app/models/spree/order.rb +52 -9
  33. data/app/models/spree/order/checkout.rb +5 -8
  34. data/app/models/spree/payment.rb +1 -1
  35. data/app/models/spree/payment/processing.rb +21 -16
  36. data/app/models/spree/payment_method.rb +1 -1
  37. data/app/models/spree/preference.rb +1 -1
  38. data/app/models/spree/preferences/preferable_class_methods.rb +2 -0
  39. data/app/models/spree/preferences/store.rb +20 -2
  40. data/app/models/spree/product.rb +16 -0
  41. data/app/models/spree/product/scopes.rb +19 -8
  42. data/app/models/spree/return_authorization.rb +1 -0
  43. data/app/models/spree/shipment.rb +6 -4
  44. data/app/models/spree/shipping_method.rb +5 -6
  45. data/app/models/spree/tax_rate.rb +4 -2
  46. data/app/models/spree/taxon.rb +7 -0
  47. data/app/models/spree/variant.rb +26 -15
  48. data/app/views/spree/admin/banners/_gateway.html.erb +14 -0
  49. data/app/views/spree/admin/general_settings/edit.html.erb +13 -4
  50. data/app/views/spree/admin/orders/_form.html.erb +1 -1
  51. data/app/views/spree/admin/orders/customer_details/_form.html.erb +1 -1
  52. data/app/views/spree/admin/product_properties/index.html.erb +1 -1
  53. data/app/views/spree/admin/products/_form.html.erb +7 -8
  54. data/app/views/spree/admin/products/new.html.erb +1 -1
  55. data/app/views/spree/admin/return_authorizations/_form.html.erb +17 -33
  56. data/app/views/spree/admin/search/users.rabl +32 -0
  57. data/app/views/spree/admin/shared/_head.html.erb +3 -13
  58. data/app/views/spree/admin/shared/_routes.html.erb +8 -0
  59. data/app/views/spree/admin/shared/_translations.html.erb +26 -0
  60. data/app/views/spree/admin/tax_rates/_form.html.erb +8 -0
  61. data/app/views/spree/admin/tax_rates/index.html.erb +5 -1
  62. data/app/views/spree/admin/taxonomies/edit.erb +2 -2
  63. data/app/views/spree/admin/taxonomies/get_children.json.erb +1 -1
  64. data/app/views/spree/admin/taxons/search.rabl +5 -0
  65. data/app/views/spree/checkout/_confirm.html.erb +1 -0
  66. data/app/views/spree/checkout/payment/_gateway.html.erb +1 -1
  67. data/app/views/spree/orders/_adjustments.html.erb +1 -1
  68. data/app/views/spree/orders/edit.html.erb +3 -1
  69. data/app/views/spree/products/_cart_form.html.erb +3 -3
  70. data/app/views/spree/products/_thumbnails.html.erb +1 -1
  71. data/app/views/spree/shared/_head.html.erb +0 -2
  72. data/app/views/spree/shared/_order_details.html.erb +2 -2
  73. data/app/views/spree/shared/_products.html.erb +1 -1
  74. data/app/views/spree/shared/_taxonomies.html.erb +1 -1
  75. data/app/views/spree/shipment_mailer/shipped_email.text.erb +1 -1
  76. data/config/initializers/check_for_orphaned_preferences.rb +1 -1
  77. data/config/initializers/rails_5868.rb +8 -0
  78. data/config/locales/en.yml +4 -0
  79. data/config/routes.rb +13 -0
  80. data/db/default/spree/countries.yml +6 -0
  81. data/db/migrate/20120905145253_add_tax_rate_label.rb +5 -0
  82. data/db/migrate/20120905151823_add_toggle_tax_rate_display.rb +5 -0
  83. data/db/migrate/20121009142519_add_lock_version_to_variant.rb +5 -0
  84. data/db/migrate/20121017010007_remove_not_null_constraint_from_products_on_hand.rb +11 -0
  85. data/lib/generators/spree/custom_user/custom_user_generator.rb +4 -1
  86. data/lib/spree/core.rb +3 -2
  87. data/lib/spree/core/mail_settings.rb +2 -1
  88. data/lib/spree/core/permalinks.rb +1 -2
  89. data/lib/spree/core/search/base.rb +1 -0
  90. data/lib/spree/core/testing_support/authorization_helpers.rb +30 -0
  91. data/lib/spree/core/testing_support/factories/product_factory.rb +1 -1
  92. data/lib/spree/core/testing_support/flash.rb +17 -0
  93. data/lib/spree/core/testing_support/preferences.rb +26 -0
  94. data/lib/spree/core/version.rb +1 -1
  95. data/lib/spree/money.rb +4 -1
  96. metadata +69 -46
  97. data/config/initializers/workarounds_for_ruby19.rb +0 -72
  98. data/lib/spree/core/testing_support/env.rb +0 -2
@@ -1,6 +1,7 @@
1
1
  //<%#encoding: UTF-8%>
2
2
  //= require_self
3
3
  //= require admin/product_autocomplete
4
+ //= require admin/taxon_autocomplete
4
5
  //= require select2
5
6
 
6
7
  /**
@@ -50,9 +51,9 @@ $.fn.radioControlsVisibilityOfElement = function(dependentElementSelector){
50
51
  $.fn.objectPicker = function(url){
51
52
  $(this).tokenInput(url + "&authenticity_token=" + escape(AUTH_TOKEN), {
52
53
  searchDelay : 600,
53
- hintText : strings.type_to_search,
54
- noResultsText : strings.no_results,
55
- searchingText : strings.searching,
54
+ hintText : Spree.translations.type_to_search,
55
+ noResultsText : Spree.translations.no_results,
56
+ searchingText : Spree.translations.searching,
56
57
  prePopulateFromInput : true
57
58
  });
58
59
  };
@@ -63,12 +64,12 @@ $.fn.productPicker = function(){
63
64
 
64
65
  handle_date_picker_fields = function(){
65
66
  $('.datepicker').datepicker({
66
- dateFormat: "<%= ::I18n.t(:format, :scope => 'spree.date_picker', :default => 'yy/mm/dd') %>",
67
- dayNames: <%= ::I18n.t(:day_names, :scope => :date).to_json %>,
68
- dayNamesMin: <%= ::I18n.t(:abbr_day_names, :scope => :date).to_json %>,
69
- monthNames: <%= (::I18n.t(:month_names, :scope => :date).delete_if(&:blank?)).to_json %>,
70
- prevText: '<%= ::I18n.t(:previous) %>',
71
- nextText: '<%= ::I18n.t(:next) %>',
67
+ dateFormat: Spree.translations.date_picker,
68
+ dayNames: Spree.translations.abbr_day_names,
69
+ dayNamesMin: Spree.translations.abbr_day_names,
70
+ monthNames: Spree.translations.month_names,
71
+ prevText: Spree.translations.previous,
72
+ nextText: Spree.translations.next,
72
73
  showOn: "button",
73
74
  buttonImage: "<%= asset_path 'datepicker/cal.gif' %>",
74
75
  buttonImageOnly: true
@@ -33,7 +33,7 @@ $(document).ready(function(){
33
33
  }
34
34
 
35
35
  prep_user_autocomplete_data = function(data){
36
- return $.map(eval(data), function(row) {
36
+ return $.map(eval(data['users']), function(row) {
37
37
  return {
38
38
  data: row['user'],
39
39
  value: row['user']['email'],
@@ -45,10 +45,10 @@ $(document).ready(function(){
45
45
  if ($("#customer_search").length > 0) {
46
46
  $("#customer_search").autocomplete({
47
47
  minChars: 5,
48
- delay: 1500,
48
+ delay: 500,
49
49
  source: function(request, response) {
50
50
  var params = { q: $('#customer_search').val(),
51
- authenticity_token: encodeURIComponent($('meta[name=csrf-token]').attr("content")) }
51
+ authenticity_token: AUTH_TOKEN }
52
52
  $.get(Spree.routes.user_search + '&' + jQuery.param(params), function(data) {
53
53
  result = prep_user_autocomplete_data(data)
54
54
  response(result);
@@ -81,7 +81,7 @@ $(document).ready(function(){
81
81
  $('#user_id').val(ui.item.data['id']);
82
82
  $('#guest_checkout_true').prop("checked", false);
83
83
  $('#guest_checkout_false').prop("checked", true);
84
- $('#guest_checkout_false').prob("disabled", false);
84
+ $('#guest_checkout_false').prop("disabled", false);
85
85
  return true;
86
86
  }
87
87
  }).data("autocomplete")._renderItem = function(ul, item) {
@@ -1,4 +1,4 @@
1
- //<%#encoding: UTF-8%>
1
+ <%#encoding: UTF-8%>
2
2
  // Product autocompletion
3
3
  image_html = function(item){
4
4
  return "<img src='" + item['images'][0]["mini_url"] + "'/>";
@@ -16,9 +16,9 @@ format_product_autocomplete = function(item){
16
16
 
17
17
  html += "<div><h4>" + product['name'] + "</h4>";
18
18
  if (product['master']) {
19
- html += "<span><strong><%= ::I18n.t(:sku) %>: </strong>" + product['master']['sku'] + "</span>";
19
+ html += "<span><strong>" + Spree.translations.sku + ":</strong>" + product['master']['sku'] + "</span>";
20
20
  }
21
- html += "<span><strong><%= ::I18n.t(:on_hand) %>: </strong>" + product['count_on_hand'] + "</span></div>";
21
+ html += "<span><strong>" + Spree.translations.on_hand + ":</strong>" + product['count_on_hand'] + "</span></div>";
22
22
  }else{
23
23
  // variant
24
24
  var variant = item.data['variant'];
@@ -37,8 +37,8 @@ format_product_autocomplete = function(item){
37
37
  }).join(", ")
38
38
 
39
39
  html += "<div><h4>" + name + "</h4>";
40
- html += "<span><strong><%= ::I18n.t(:sku) %>: </strong>" + variant['sku'] + "</span>";
41
- html += "<span><strong><%= ::I18n.t(:on_hand) %>: </strong>" + variant['count_on_hand'] + "</span></div>";
40
+ html += "<span><strong>" + Spree.translations.sku + ":</strong>" + variant['sku'] + "</span>";
41
+ html += "<span><strong>" + Spree.translations.on_hand + ":</strong>" + variant['count_on_hand'] + "</span></div>";
42
42
  }
43
43
 
44
44
  return html
@@ -0,0 +1,34 @@
1
+ function cleanTaxons(data) {
2
+ var taxons = $.map(data['taxons'], function(result) {
3
+ return result['taxon']
4
+ })
5
+ return taxons;
6
+ }
7
+
8
+ $(document).ready(function() {
9
+ $("#product_taxon_ids").select2({
10
+ placeholder: "Add a taxon",
11
+ multiple: true,
12
+ initSelection: function(element, callback) {
13
+ return $.getJSON(Spree.routes.taxon_search + "?ids=" + (element.val()), null, function(data) {
14
+ return callback(self.cleanTaxons(data));
15
+ })
16
+ },
17
+ ajax: {
18
+ url: Spree.routes.taxon_search,
19
+ datatype: 'json',
20
+ data: function(term, page) {
21
+ return { q: term }
22
+ },
23
+ results: function (data, page) {
24
+ return { results: self.cleanTaxons(data) }
25
+ }
26
+ },
27
+ formatResult: function(taxon) {
28
+ return taxon.pretty_name
29
+ },
30
+ formatSelection: function(taxon) {
31
+ return taxon.pretty_name
32
+ }
33
+ })
34
+ })
@@ -59,7 +59,7 @@ var handle_delete = function(e, data){
59
59
  last_rollback = data.rlbk;
60
60
  var node = data.rslt.obj;
61
61
 
62
- jConfirm('Are you sure you want to delete this taxon?', 'Confirm Taxon Deletion', function(r) {
62
+ jConfirm(Spree.translations.are_you_sure_delete, Spree.translations.confirm_delete, function(r) {
63
63
  if(r){
64
64
  $.ajax({
65
65
  type: "POST",
@@ -103,7 +103,7 @@ $(document).ready(function(){
103
103
  },
104
104
  "strings" : {
105
105
  "new_node" : new_taxon,
106
- "loading" : loading + "..."
106
+ "loading" : Spree.translations.loading + "..."
107
107
  },
108
108
  "crrm" : {
109
109
  "move" : {
@@ -131,48 +131,48 @@ $(document).ready(function(){
131
131
  if(type_of_node == "root") {
132
132
  menu = {
133
133
  "create" : {
134
- "label" : "Create",
134
+ "label" : Spree.translations.add,
135
135
  "action" : function (obj) { this.create(obj); }
136
136
  },
137
137
  "paste" : {
138
138
  "separator_before" : true,
139
- "label" : "Paste",
139
+ "label" : Spree.translations.paste,
140
140
  "action" : function (obj) { is_cut = false; this.paste(obj); },
141
141
  "_disabled" : is_cut == false
142
142
  },
143
143
  "edit" : {
144
144
  "separator_before" : true,
145
- "label" : "Edit",
145
+ "label" : Spree.translations.edit,
146
146
  "action" : function (obj) { window.location = base_url + obj.attr("id") + "/edit/"; }
147
147
  }
148
148
  }
149
149
  } else {
150
150
  menu = {
151
151
  "create" : {
152
- "label" : "Create",
152
+ "label" : Spree.translations.add,
153
153
  "action" : function (obj) { this.create(obj); }
154
154
  },
155
155
  "rename" : {
156
- "label" : "Rename",
156
+ "label" : Spree.translations.rename,
157
157
  "action" : function (obj) { this.rename(obj); }
158
158
  },
159
159
  "remove" : {
160
- "label" : "Remove",
160
+ "label" : Spree.translations.remove,
161
161
  "action" : function (obj) { this.remove(obj); }
162
162
  },
163
163
  "cut" : {
164
164
  "separator_before" : true,
165
- "label" : "Cut",
165
+ "label" : Spree.translations.cut,
166
166
  "action" : function (obj) { is_cut = true; this.cut(obj); }
167
167
  },
168
168
  "paste" : {
169
- "label" : "Paste",
169
+ "label" : Spree.translations.paste,
170
170
  "action" : function (obj) { is_cut = false; this.paste(obj); },
171
171
  "_disabled" : is_cut == false
172
172
  },
173
173
  "edit" : {
174
174
  "separator_before" : true,
175
- "label" : "Edit",
175
+ "label" : Spree.translations.edit,
176
176
  "action" : function (obj) { window.location = base_url + obj.attr("id") + "/edit/"; }
177
177
  }
178
178
  }
@@ -1,6 +1,9 @@
1
1
  $ ->
2
2
  if ($ 'form#update-cart').is('*')
3
- ($ 'form#update-cart a.delete').show().on 'click', ->
3
+ ($ 'form#update-cart a.delete').show().one 'click', ->
4
4
  ($ this).parents('.line-item').first().find('input.line_item_quantity').val 0
5
5
  ($ this).parents('form').first().submit()
6
- false
6
+ false
7
+
8
+ ($ 'form#update-cart').submit ->
9
+ ($ 'form#update-cart #update-button').attr('disabled', true)
@@ -1,5 +1,5 @@
1
- disableSaveOnClick = ->
2
- ($ 'form.edit_spree_order').submit ->
1
+ @disableSaveOnClick = ->
2
+ ($ 'form.edit_order').submit ->
3
3
  ($ this).find(':submit, :image').attr('disabled', true).removeClass('primary').addClass 'disabled'
4
4
 
5
5
  $ ->
@@ -14,7 +14,7 @@ $ ->
14
14
  state_select = ($ 'p#' + region + 'state select')
15
15
  state_input = ($ 'p#' + region + 'state input')
16
16
  if states
17
- selected = state_select.val()
17
+ selected = parseInt state_select.val()
18
18
  state_select.html ''
19
19
  states_with_blank = [ [ '', '' ] ].concat(states)
20
20
  $.each states_with_blank, (pos, id_nm) ->
@@ -51,7 +51,11 @@ $ ->
51
51
  ).triggerHandler 'click'
52
52
 
53
53
  if ($ '#checkout_form_payment').is('*')
54
+ # Activate already checked payment method if form is re-rendered
55
+ # i.e. if user enters invalid data
56
+ ($ 'input[type="radio"]:checked').click()
57
+
54
58
  ($ 'input[type="radio"][name="order[payments_attributes][][payment_method_id]"]').click(->
55
59
  ($ '#payment-methods li').hide()
56
60
  ($ '#payment_method_' + @value).show() if @checked
57
- ).triggerHandler 'click'
61
+ )
@@ -161,3 +161,7 @@ fieldset {
161
161
  -moz-border-radius-topright: 5px;
162
162
  -webkit-border-top-right-radius: 5px; }
163
163
 
164
+ /* make sure the select2 boxes on product#edit have some width to select. */
165
+ .select2-choices {
166
+ min-width: 150px;
167
+ }
@@ -1,4 +1,4 @@
1
- @import "store/variables";
1
+ @import "./variables.css.scss";
2
2
 
3
3
  /*--------------------------------------*/
4
4
  /* Basic styles
@@ -2,12 +2,12 @@ module Spree
2
2
  module Admin
3
3
  class BannersController < Spree::Admin::BaseController
4
4
  def dismiss
5
- if request.xhr? and params[:id]
5
+ if params[:id]
6
6
  if user = try_spree_current_user
7
7
  user.dismiss_banner(params[:id])
8
8
  end
9
- render :nothing => true
10
9
  end
10
+ render :nothing => true
11
11
  end
12
12
  end
13
13
  end
@@ -3,6 +3,13 @@ module Spree
3
3
  class MailMethodsController < ResourceController
4
4
  after_filter :initialize_mail_settings
5
5
 
6
+ def update
7
+ if params[:mail_method][:preferred_smtp_password].blank?
8
+ params[:mail_method].delete(:preferred_smtp_password)
9
+ end
10
+ super
11
+ end
12
+
6
13
  def testmail
7
14
  @mail_method = Spree::MailMethod.find(params[:id])
8
15
  if TestMailer.test_email(@mail_method, try_spree_current_user).deliver
@@ -36,7 +36,9 @@ module Spree
36
36
  end
37
37
 
38
38
  @search = Order.ransack(params[:q])
39
- @orders = @search.result(:distinct => true).includes([:user, :shipments, :payments]).page(params[:page]).per(Spree::Config[:orders_per_page])
39
+ @orders = @search.result.includes([:user, :shipments, :payments]).
40
+ page(params[:page]).
41
+ per(params[:per_page] || Spree::Config[:orders_per_page])
40
42
 
41
43
  # Restore dates
42
44
  params[:q][:created_at_gt] = created_at_gt
@@ -27,7 +27,13 @@ module Spree
27
27
  end
28
28
 
29
29
  payment_method_params = params[ActiveModel::Naming.param_key(@payment_method)] || {}
30
- if @payment_method.update_attributes(params[:payment_method].merge(payment_method_params))
30
+ attributes = params[:payment_method].merge(payment_method_params)
31
+ attributes.each do |k,v|
32
+ if k.include?("password") && attributes[k].blank?
33
+ attributes.delete(k)
34
+ end
35
+ end
36
+ if @payment_method.update_attributes(attributes)
31
37
  invoke_callbacks(:update, :after)
32
38
  flash.notice = I18n.t(:successfully_updated, :resource => I18n.t(:payment_method))
33
39
  respond_with(@payment_method, :location => edit_admin_payment_method_path(@payment_method))
@@ -19,6 +19,13 @@ module Spree
19
19
  end
20
20
  end
21
21
 
22
+ def update
23
+ if params[:product][:taxon_ids].present?
24
+ params[:product][:taxon_ids] = params[:product][:taxon_ids].split(',')
25
+ end
26
+ super
27
+ end
28
+
22
29
  def destroy
23
30
  @product = Product.where(:permalink => params[:id]).first!
24
31
  @product.delete
@@ -89,12 +96,10 @@ module Spree
89
96
  page(params[:page]).
90
97
  per(Spree::Config[:admin_products_per_page])
91
98
 
92
- if params[:q][:s].include?("master_price")
93
- # By applying the group in the main query we get an undefined method gsub for Arel::Nodes::Descending
94
- # It seems to only work when the price is actually being sorted in the query
95
- # To be investigated later.
96
- @collection = @collection.group("spree_variants.price")
97
- end
99
+ # PostgreSQL compatibility
100
+ if params[:q][:s].include?("master_price")
101
+ @collection = @collection.group("spree_variants.price")
102
+ end
98
103
  else
99
104
  includes = [{:variants => [:images, {:option_values => :option_type}]}, {:master => :images}]
100
105
 
@@ -29,7 +29,7 @@ module Spree
29
29
  private
30
30
 
31
31
  def set_habtm_associations
32
- @prototype.property_ids = params[:option_type].blank? ? [] : params[:property][:id]
32
+ @prototype.property_ids = params[:property].blank? ? [] : params[:property][:id]
33
33
  @prototype.option_type_ids = params[:option_type].blank? ? [] : params[:option_type][:id]
34
34
  end
35
35
  end
@@ -8,37 +8,17 @@ module Spree
8
8
  # TODO: Clean this up by moving searching out to user_class_extensions
9
9
  # And then JSON building with something like Active Model Serializers
10
10
  def users
11
- @users = Spree.user_class.ransack({
12
- :m => 'or',
13
- :email_start => params[:q],
14
- :ship_address_firstname_start => params[:q],
15
- :ship_address_lastname_start => params[:q],
16
- :bill_address_firstname_start => params[:q],
17
- :bill_address_lastname_start => params[:q]
18
- }).result.limit(params[:limit] || 100)
19
-
20
- respond_with(@users) do |format|
21
- format.json do
22
- address_fields = [:firstname, :lastname,
23
- :address1, :address2,
24
- :city, :zipcode,
25
- :phone, :state_name,
26
- :state_id, :country_id]
27
- includes = {
28
- :only => address_fields,
29
- :include => {
30
- :state => { :only => :name },
31
- :country => { :only => :name }
32
- }
33
- }
34
-
35
- json = @users.to_json({
36
- :only => [:id, :email],
37
- :include => { :bill_address => includes, :ship_address => includes }
38
- })
39
-
40
- render :json => json
41
- end
11
+ if params[:ids]
12
+ @users = Spree.user_class.where(:id => params[:ids].split(','))
13
+ else
14
+ @users = Spree.user_class.ransack({
15
+ :m => 'or',
16
+ :email_start => params[:q],
17
+ :ship_address_firstname_start => params[:q],
18
+ :ship_address_lastname_start => params[:q],
19
+ :bill_address_firstname_start => params[:q],
20
+ :bill_address_lastname_start => params[:q]
21
+ }).result.limit(10)
42
22
  end
43
23
  end
44
24
  end
@@ -4,6 +4,14 @@ module Spree
4
4
 
5
5
  respond_to :html, :json, :js
6
6
 
7
+ def search
8
+ if params[:ids]
9
+ @taxons = Spree::Taxon.where(:id => params[:ids].split(','))
10
+ else
11
+ @taxons = Spree::Taxon.limit(20).search(:name_cont => params[:q]).result
12
+ end
13
+ end
14
+
7
15
  def create
8
16
  @taxonomy = Taxonomy.find(params[:taxonomy_id])
9
17
  @taxon = @taxonomy.taxons.build(params[:taxon])
@@ -2,7 +2,12 @@ module Spree
2
2
  # Handles checkout logic. This is somewhat contrary to standard REST convention since there is not actually a
3
3
  # Checkout object. There's enough distinct logic specific to checkout which has nothing to do with updating an
4
4
  # order that this approach is waranted.
5
- class CheckoutController < BaseController
5
+ #
6
+ # Much of this file, especially the update action is overriden in the promo gem.
7
+ # This is to allow for the promo behavior but also allow the promo gem to be
8
+ # removed if the functionality is not needed.
9
+
10
+ class CheckoutController < Spree::BaseController
6
11
  ssl_required
7
12
 
8
13
  before_filter :load_order
@@ -13,6 +18,7 @@ module Spree
13
18
  respond_to :html
14
19
 
15
20
  # Updates the order and advances to the next state (when possible.)
21
+ # Overriden by the promo gem if it exists.
16
22
  def update
17
23
  if @order.update_attributes(object_params)
18
24
  fire_event('spree.checkout.update')