spree_backend 2.0.4 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/admin/address_states.js +19 -15
  3. data/app/assets/javascripts/admin/admin.js.erb +1 -5
  4. data/app/assets/javascripts/admin/nested-attribute.js +15 -11
  5. data/app/assets/javascripts/admin/option_type_autocomplete.js.erb +20 -16
  6. data/app/assets/javascripts/admin/orders/edit.js +17 -12
  7. data/app/assets/javascripts/admin/orders/edit_form.js +16 -12
  8. data/app/assets/javascripts/admin/product_picker.js +22 -16
  9. data/app/assets/javascripts/admin/promotions.js +34 -35
  10. data/app/assets/javascripts/admin/shipments.js.erb +35 -27
  11. data/app/assets/javascripts/admin/spree-select2.js.erb +2 -1
  12. data/app/assets/javascripts/admin/spree_backend.js +0 -1
  13. data/app/assets/javascripts/admin/states.js +10 -8
  14. data/app/assets/javascripts/admin/stock_management.js.coffee +2 -2
  15. data/app/assets/javascripts/admin/taxon_autocomplete.js.erb +32 -19
  16. data/app/assets/javascripts/admin/user_picker.js +21 -13
  17. data/app/assets/javascripts/admin/variant_autocomplete.js.erb +16 -4
  18. data/app/assets/stylesheets/admin/plugins/_select2.scss +5 -3
  19. data/app/assets/stylesheets/admin/sections/_alerts.scss +27 -0
  20. data/app/assets/stylesheets/admin/spree_admin.scss +1 -0
  21. data/app/controllers/spree/admin/base_controller.rb +11 -13
  22. data/app/controllers/spree/admin/images_controller.rb +4 -5
  23. data/app/controllers/spree/admin/mail_methods_controller.rb +1 -1
  24. data/app/controllers/spree/admin/orders/customer_details_controller.rb +1 -1
  25. data/app/controllers/spree/admin/orders_controller.rb +3 -7
  26. data/app/controllers/spree/admin/payments_controller.rb +1 -1
  27. data/app/controllers/spree/admin/resource_controller.rb +6 -2
  28. data/app/helpers/spree/admin/navigation_helper.rb +4 -2
  29. data/app/helpers/spree/admin/stock_locations_helper.rb +15 -0
  30. data/app/views/spree/admin/countries/index.html.erb +2 -2
  31. data/app/views/spree/admin/general_settings/edit.html.erb +3 -3
  32. data/app/views/spree/admin/option_types/index.html.erb +15 -5
  33. data/app/views/spree/admin/orders/_shipment.html.erb +2 -2
  34. data/app/views/spree/admin/orders/customer_details/_form.html.erb +8 -8
  35. data/app/views/spree/admin/orders/index.html.erb +4 -3
  36. data/app/views/spree/admin/payment_methods/index.html.erb +7 -4
  37. data/app/views/spree/admin/payments/_form.html.erb +1 -1
  38. data/app/views/spree/admin/payments/show.html.erb +2 -2
  39. data/app/views/spree/admin/product_properties/_product_property_fields.html.erb +1 -1
  40. data/app/views/spree/admin/product_properties/index.html.erb +9 -13
  41. data/app/views/spree/admin/products/index.html.erb +3 -3
  42. data/app/views/spree/admin/products/stock.html.erb +10 -8
  43. data/app/views/spree/admin/promotions/index.html.erb +6 -6
  44. data/app/views/spree/admin/properties/index.html.erb +12 -5
  45. data/app/views/spree/admin/prototypes/_form.html.erb +1 -1
  46. data/app/views/spree/admin/prototypes/index.html.erb +9 -2
  47. data/app/views/spree/admin/reports/index.html.erb +2 -3
  48. data/app/views/spree/admin/shared/_address_form.html.erb +11 -11
  49. data/app/views/spree/admin/shared/_alert.html.erb +3 -3
  50. data/app/views/spree/admin/shared/_routes.html.erb +1 -0
  51. data/app/views/spree/admin/shared/_tabs.html.erb +2 -2
  52. data/app/views/spree/admin/shared/_translations.html.erb +3 -0
  53. data/app/views/spree/admin/shipping_categories/index.html.erb +9 -2
  54. data/app/views/spree/admin/shipping_methods/_form.html.erb +10 -0
  55. data/app/views/spree/admin/shipping_methods/index.html.erb +9 -5
  56. data/app/views/spree/admin/stock_locations/_form.html.erb +15 -11
  57. data/app/views/spree/admin/stock_locations/index.html.erb +9 -6
  58. data/app/views/spree/admin/stock_movements/index.html.erb +7 -0
  59. data/app/views/spree/admin/stock_transfers/index.html.erb +19 -18
  60. data/app/views/spree/admin/stock_transfers/new.html.erb +24 -21
  61. data/app/views/spree/admin/stock_transfers/show.html.erb +13 -9
  62. data/app/views/spree/admin/tax_categories/index.html.erb +12 -8
  63. data/app/views/spree/admin/tax_rates/_form.html.erb +8 -8
  64. data/app/views/spree/admin/tax_rates/index.html.erb +12 -11
  65. data/app/views/spree/admin/taxonomies/_list.html.erb +5 -5
  66. data/app/views/spree/admin/taxonomies/index.html.erb +11 -4
  67. data/app/views/spree/admin/taxons/_form.html.erb +6 -5
  68. data/app/views/spree/admin/taxons/edit.html.erb +17 -2
  69. data/app/views/spree/admin/trackers/index.html.erb +10 -10
  70. data/app/views/spree/admin/variants/_autocomplete.js.erb +3 -3
  71. data/app/views/spree/admin/variants/index.html.erb +9 -7
  72. data/app/views/spree/admin/zones/_country_members.html.erb +10 -0
  73. data/app/views/spree/admin/zones/_form.html.erb +4 -1
  74. data/app/views/spree/admin/zones/_state_members.html.erb +10 -0
  75. data/app/views/spree/admin/zones/edit.html.erb +3 -7
  76. data/app/views/spree/admin/zones/index.html.erb +11 -10
  77. data/vendor/assets/javascripts/trunk8.js +362 -226
  78. metadata +11 -11
  79. data/app/views/spree/admin/zones/_country_member.html.erb +0 -5
  80. data/app/views/spree/admin/zones/_member_type.html.erb +0 -19
  81. data/app/views/spree/admin/zones/_state_member.html.erb +0 -5
  82. data/vendor/assets/javascripts/jquery.horizontalNav.js +0 -141
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eea403d8dc1a1a649cab2e0ee1f8536155504623
4
- data.tar.gz: edae6e9b6e61d665ec40de4416d2dd97148a79c4
3
+ metadata.gz: 2d5d1d087b80b4d4ccb804eb2282ee51a8abdb20
4
+ data.tar.gz: 821bef1778e272492e163c1e983fcddbd9fec6fe
5
5
  SHA512:
6
- metadata.gz: fe3cb526c9276e7f0cdd1fe8e9b975f175f43e9beb9a767ba4a6ff6e87d6f85e5efc1f70cb0988652cfcc518d03b4faf7d7b2819cc40c84c3b838015f54b33f9
7
- data.tar.gz: f986b8f5a62b5fec1db0540b321336e7c9e8e9a898cd6f0e070dbf55d5762d14f34020962fe297552cd45ee689ba32fcfac62b9a3a7975c0c3267f0b8d8988a9
6
+ metadata.gz: a2a653988067c0e6dc42a69ebfe7f95074f93caa8217a32fc0684c2dc79406d546961743b17e6fa1365325d5d79b3a322f498d951e18b3e15e2c839a2cefc11b
7
+ data.tar.gz: 72f6eec30e2ab2bcd16718c65fc91d71d0e820e7e9120e3a9a26c46983e584746b238e7a239b0f0316459c4e5daadcdf2a366944107863bd70c1ba7e4757865b
@@ -1,27 +1,31 @@
1
- var update_state = function(region) {
2
- var country = $('span#' + region + 'country .select2').select2('val');
1
+ var update_state = function (region) {
2
+ 'use strict';
3
3
 
4
- var state_select = $('span#' + region + 'state select.select2');
5
- var state_input = $('span#' + region + 'state input.state_name');
4
+ var country = $('span#' + region + 'country .select2').select2('val');
5
+ var state_select = $('span#' + region + 'state select.select2');
6
+ var state_input = $('span#' + region + 'state input.state_name');
6
7
 
7
- $.get(Spree.routes.states_search + "?country_id=" + country, function(data) {
8
- var states = data["states"]
8
+ $.get(Spree.routes.states_search + '?country_id=' + country, function (data) {
9
+ var states = data.states;
9
10
  if (states.length > 0) {
10
11
  state_select.html('');
11
- var states_with_blank = [{name: '', id: ''}].concat(states);
12
- $.each(states_with_blank, function(pos,state) {
12
+ var states_with_blank = [{
13
+ name: '',
14
+ id: ''
15
+ }].concat(states);
16
+ $.each(states_with_blank, function (pos, state) {
13
17
  var opt = $(document.createElement('option'))
14
- .attr('value', state.id)
15
- .html(state.name);
18
+ .attr('value', state.id)
19
+ .html(state.name);
16
20
  state_select.append(opt);
17
21
  });
18
- state_select.prop("disabled", false).show();
22
+ state_select.prop('disabled', false).show();
19
23
  state_select.select2();
20
- state_input.hide().prop("disabled", true);
24
+ state_input.hide().prop('disabled', true);
21
25
 
22
26
  } else {
23
- state_input.prop("disabled", false).show();
27
+ state_input.prop('disabled', false).show();
24
28
  state_select.select2('destroy').hide();
25
29
  }
26
- })
27
- };
30
+ });
31
+ };
@@ -13,11 +13,6 @@ Hopefully, this will evolve into a propper class.
13
13
  **/
14
14
 
15
15
  jQuery(function($) {
16
- // Make main menu use full width
17
- $('.fullwidth-menu').horizontalNav({
18
- tableDisplay: false,
19
- responsiveDelay: 0
20
- });
21
16
 
22
17
  // Vertical align of checkbox fields
23
18
  $('.field.checkbox label').vAlign()
@@ -117,6 +112,7 @@ handle_date_picker_fields = function(){
117
112
  dateFormat: Spree.translations.date_picker,
118
113
  dayNames: Spree.translations.abbr_day_names,
119
114
  dayNamesMin: Spree.translations.abbr_day_names,
115
+ firstDay: Spree.translations.first_day,
120
116
  monthNames: Spree.translations.month_names,
121
117
  prevText: Spree.translations.previous,
122
118
  nextText: Spree.translations.next,
@@ -1,23 +1,27 @@
1
- //On page load
2
- replace_ids = function(s){
1
+ // On page load
2
+ var replace_ids = function (s) {
3
3
  var new_id = new Date().getTime();
4
4
  return s.replace(/NEW_RECORD/g, new_id);
5
- }
5
+ };
6
+
7
+ $(function () {
8
+ 'use strict';
6
9
 
7
- $(function() {
8
- $('a[id*=nested]').click(function() {
10
+ $('a[id*=nested]').on('click', function () {
9
11
  var template = $(this).attr('href').replace(/.*#/, '');
10
- html = replace_ids(eval(template));
12
+ var html = replace_ids(eval(template));
11
13
  $('#ul-' + $(this).attr('id')).append(html);
12
14
  update_remove_links();
13
- });
15
+ });
14
16
  update_remove_links();
15
- })
17
+ });
16
18
 
17
- var update_remove_links = function() {
18
- $('.remove').click(function() {
19
+ var update_remove_links = function () {
20
+ 'use strict';
21
+
22
+ $('.remove').on('click', function () {
19
23
  $(this).prevAll(':first').val(1);
20
24
  $(this).parent().hide();
21
25
  return false;
22
26
  });
23
- };
27
+ };
@@ -1,34 +1,38 @@
1
- $(document).ready(function() {
2
- if ($("#product_option_type_ids").length > 0) {
3
- $("#product_option_type_ids").select2({
1
+ $(document).ready(function () {
2
+ 'use strict';
3
+
4
+ if ($('#product_option_type_ids').length > 0) {
5
+ $('#product_option_type_ids').select2({
4
6
  placeholder: Spree.translations.option_type_placeholder,
5
7
  multiple: true,
6
- initSelection: function(element, callback) {
7
- return $.getJSON(Spree.routes.option_type_search + "?ids=" + (element.val()), null, function(data) {
8
+ initSelection: function (element, callback) {
9
+ return $.getJSON(Spree.routes.option_type_search + '?ids=' + (element.val()), null, function (data) {
8
10
  return callback(data);
9
- })
11
+ });
10
12
  },
11
13
  ajax: {
12
14
  url: Spree.routes.option_type_search,
13
15
  quietMillis: 200,
14
16
  datatype: 'json',
15
- data: function(term, page) {
17
+ data: function (term) {
16
18
  return {
17
19
  q: {
18
20
  name_cont: term
19
21
  }
20
- }
22
+ };
21
23
  },
22
- results: function (data, page) {
23
- return { results: data }
24
+ results: function (data) {
25
+ return {
26
+ results: data
27
+ };
24
28
  }
25
29
  },
26
- formatResult: function(option_type) {
27
- return option_type.presentation + " (" + option_type.name + ")"
30
+ formatResult: function (option_type) {
31
+ return option_type.presentation + ' (' + option_type.name + ')';
28
32
  },
29
- formatSelection: function(option_type) {
30
- return option_type.presentation + " (" + option_type.name + ")"
33
+ formatSelection: function (option_type) {
34
+ return option_type.presentation + ' (' + option_type.name + ')';
31
35
  }
32
- })
36
+ });
33
37
  }
34
- })
38
+ });
@@ -1,17 +1,22 @@
1
- $(document).ready(function() {
1
+ $(document).ready(function () {
2
+ 'use strict';
2
3
 
3
- $("#add_line_item_to_order").on("click", function() {
4
- if($('#add_variant_id').val() == ''){ return false; }
4
+ $('#add_line_item_to_order').on('click', function () {
5
+ if ($('#add_variant_id').val() === '') {
6
+ return false;
7
+ }
5
8
 
6
- update_target = '#' + $(this).attr("data-update");
7
- $.post(this.href,
8
- { "line_item[variant_id]": $('#add_variant_id').val(),
9
- "line_item[quantity]": $('#add_quantity').val() },
10
- function(data) {
11
- $(update_target).html(data);
12
- });
9
+ var update_target = '#' + $(this).attr('data-update');
10
+ $.post(this.href, {
11
+ 'line_item[variant_id]': $('#add_variant_id').val(),
12
+ 'line_item[quantity]': $('#add_quantity').val()
13
+ },
14
+
15
+ function (data) {
16
+ $(update_target).html(data);
17
+ });
13
18
  return false;
14
19
  });
15
20
 
16
- $('[data-hook="add_product_name"]').find(".variant_autocomplete").variantAutocomplete();
17
- });
21
+ $('[data-hook="add_product_name"]').find('.variant_autocomplete').variantAutocomplete();
22
+ });
@@ -1,16 +1,20 @@
1
- $(document).ready(function() {
2
- $.each($('td.qty input'), function(i, input) {
1
+ $(document).ready(function () {
2
+ 'use strict';
3
3
 
4
- $(input).on('change', function() {
4
+ $.each($('td.qty input'), function (i, input) {
5
5
 
6
- var id = "#" + $(this).attr('id').replace("_quantity", "_id");
6
+ $(input).on('change', function () {
7
7
 
8
- jQuery.post("/admin/orders/" + $('input#order_number').val() + "/line_items/" + $(id).val(),
9
- { _method: "put", "line_item[quantity]": $(this).val()},
10
- function(resp) {
11
- $('#order-form-wrapper').html(resp.responseText);
12
- })
13
- })
14
- })
15
- });
8
+ var id = '#' + $(this).attr('id').replace('_quantity', '_id');
9
+
10
+ $.post('/admin/orders/' + $('input#order_number').val() + '/line_items/' + $(id).val(), {
11
+ _method: 'put',
12
+ 'line_item[quantity]': $(this).val()
13
+ },
16
14
 
15
+ function (resp) {
16
+ $('#order-form-wrapper').html(resp.responseText);
17
+ });
18
+ });
19
+ });
20
+ });
@@ -1,37 +1,43 @@
1
- $.fn.productAutocomplete = function() {
1
+ $.fn.productAutocomplete = function () {
2
+ 'use strict';
3
+
2
4
  this.select2({
3
5
  minimumInputLength: 1,
4
6
  multiple: true,
5
- initSelection: function(element, callback) {
6
- $.get(Spree.routes.product_search, { ids: element.val().split(',') }, function(data) {
7
- callback(data['products'])
8
- })
7
+ initSelection: function (element, callback) {
8
+ $.get(Spree.routes.product_search, {
9
+ ids: element.val().split(',')
10
+ }, function (data) {
11
+ callback(data.products);
12
+ });
9
13
  },
10
14
  ajax: {
11
15
  url: Spree.routes.product_search,
12
16
  datatype: 'json',
13
- data: function(term, page) {
14
- return {
17
+ data: function (term, page) {
18
+ return {
15
19
  q: {
16
20
  name_cont: term,
17
- sku_cont: term,
21
+ sku_cont: term
18
22
  },
19
- m: "OR"
20
- }
23
+ m: 'OR'
24
+ };
21
25
  },
22
- results: function(data, page) {
23
- return { results: data['products'] }
26
+ results: function (data, page) {
27
+ return {
28
+ results: data.products
29
+ };
24
30
  }
25
31
  },
26
- formatResult: function(product) {
32
+ formatResult: function (product) {
27
33
  return product.name;
28
34
  },
29
- formatSelection: function(product) {
35
+ formatSelection: function (product) {
30
36
  return product.name;
31
37
  }
32
38
  });
33
- }
39
+ };
34
40
 
35
41
  $(document).ready(function () {
36
42
  $('.product_picker').productAutocomplete();
37
- })
43
+ });
@@ -1,17 +1,18 @@
1
- var initProductActions = function(){
1
+ var initProductActions = function () {
2
+ 'use strict';
2
3
 
3
4
  // Add classes on promotion items for design
4
- $(document).on('mouseover mouseout', 'a.delete', function(event) {
5
- if (event.type == 'mouseover') {
5
+ $(document).on('mouseover mouseout', 'a.delete', function (event) {
6
+ if (event.type === 'mouseover') {
6
7
  $(this).parent().addClass('action-remove');
7
8
  } else {
8
9
  $(this).parent().removeClass('action-remove');
9
10
  }
10
11
  });
11
12
 
12
- $('#promotion-filters').find(".variant_autocomplete").variantAutocomplete();
13
+ $('#promotion-filters').find('.variant_autocomplete').variantAutocomplete();
13
14
 
14
- $('.calculator-fields').each(function(){
15
+ $('.calculator-fields').each(function () {
15
16
  var $fields_container = $(this);
16
17
  var $type_select = $fields_container.find('.type-select');
17
18
  var $settings = $fields_container.find('.settings');
@@ -19,15 +20,15 @@ var initProductActions = function(){
19
20
  var originalType = $type_select.val();
20
21
 
21
22
  $warning.hide();
22
- $type_select.change(function(){
23
- if( $(this).val() == originalType ){
23
+ $type_select.change(function () {
24
+ if ($(this).val() === originalType) {
24
25
  $warning.hide();
25
26
  $settings.show();
26
27
  $settings.find('input').removeAttr('disabled');
27
28
  } else {
28
29
  $warning.show();
29
30
  $settings.hide();
30
- $settings.find('input').attr('disabled', 'disabled');
31
+ $settings.find('input').prop('disabled', 'disabled');
31
32
  }
32
33
  });
33
34
  });
@@ -35,10 +36,10 @@ var initProductActions = function(){
35
36
  //
36
37
  // CreateLineItems Promotion Action
37
38
  //
38
- ( function(){
39
- var hideOrShowItemTables = function(){
40
- $('.promotion_action table').each(function(){
41
- if($(this).find('td').length == 0){
39
+ (function () {
40
+ var hideOrShowItemTables = function () {
41
+ $('.promotion_action table').each(function () {
42
+ if ($(this).find('td').length === 0) {
42
43
  $(this).hide();
43
44
  } else {
44
45
  $(this).show();
@@ -48,11 +49,11 @@ var initProductActions = function(){
48
49
  hideOrShowItemTables();
49
50
 
50
51
  // Remove line item
51
- var setupRemoveLineItems = function(){
52
- $(".remove_promotion_line_item").click(function(){
53
- line_items_el = $($('.line_items_string')[0])
54
- finder = RegExp($(this).data("variant-id") + "x\\d+")
55
- line_items_el.val(line_items_el.val().replace(finder, ""))
52
+ var setupRemoveLineItems = function () {
53
+ $('.remove_promotion_line_item').on('click', function () {
54
+ var line_items_el = $($('.line_items_string')[0]);
55
+ var finder = new RegExp($(this).data('variant-id') + "x\\d+");
56
+ line_items_el.val(line_items_el.val().replace(finder, ''));
56
57
  $(this).parents('tr').remove();
57
58
  hideOrShowItemTables();
58
59
  });
@@ -60,39 +61,37 @@ var initProductActions = function(){
60
61
 
61
62
  setupRemoveLineItems();
62
63
  // Add line item to list
63
- $(".promotion_action.create_line_items button.add").unbind('click').click(function(e){
64
+ $('.promotion_action.create_line_items button.add').unbind('click').click(function () {
64
65
  var $container = $(this).parents('.promotion_action');
65
- var product_name = $container.find("input[name='add_product_name']").val();
66
- var variant_id = $container.find("input[name='add_variant_id']").val();
67
- var quantity = $container.find("input[name='add_quantity']").val();
68
- if(variant_id){
66
+ var product_name = $container.find('input[name="add_product_name"]').val();
67
+ var variant_id = $container.find('input[name="add_variant_id"]').val();
68
+ var quantity = $container.find('input[name="add_quantity"]').val();
69
+ if (variant_id) {
69
70
  // Add to the table
70
- var newRow = "<tr><td>" + product_name + "</td><td>" + quantity + "</td><td><img src='/assets/admin/icons/cross.png' /></td></tr>";
71
+ var newRow = '<tr><td>' + product_name + '</td><td>' + quantity + '</td><td><img src="/assets/admin/icons/cross.png"/></td></tr>';
71
72
  $container.find('table').append(newRow);
72
73
  // Add to serialized string in hidden text field
73
- var $hiddenField = $container.find(".line_items_string");
74
- $hiddenField.val($hiddenField.val() + "," + variant_id + "x" + quantity);
74
+ var $hiddenField = $container.find('.line_items_string');
75
+ $hiddenField.val($hiddenField.val() + ',' + variant_id + 'x' + quantity);
75
76
  setupRemoveLineItems();
76
77
  hideOrShowItemTables();
77
78
  }
78
79
  return false;
79
80
  });
80
81
 
81
- } )();
82
+ })();
82
83
 
83
- }
84
+ };
85
+
86
+ $(document).ready(function () {
84
87
 
85
- $(document).ready(function() {
86
88
  initProductActions();
87
89
 
88
90
  // toggle fields for specific events
89
- $('#promotion_event_name').change(function() {
90
- $('#promotion_code_field').toggle($('#promotion_event_name').val() == 'spree.checkout.coupon_code_added');
91
- $('#promotion_path_field').toggle($('#promotion_event_name').val() == 'spree.content.visited');
91
+ $('#promotion_event_name').on('change', function () {
92
+ $('#promotion_code_field').toggle($('#promotion_event_name').val() === 'spree.checkout.coupon_code_added');
93
+ $('#promotion_path_field').toggle($('#promotion_event_name').val() === 'spree.content.visited');
92
94
  });
93
95
  $('#promotion_event_name').change();
94
96
 
95
- });
96
-
97
-
98
-
97
+ });
@@ -1,64 +1,72 @@
1
- <%#encoding: UTF-8%>
2
1
  // Shipments AJAX API
2
+ $(document).ready(function () {
3
+ 'use strict';
3
4
 
4
- $(document).ready(function() {
5
-
6
- //handle ship click
7
- $('[data-hook=admin_order_edit_form] a.ship').click(function(){
5
+ // handle ship click
6
+ $('[data-hook=admin_order_edit_form] a.ship').on('click', function () {
8
7
  var link = $(this);
9
8
  var shipment_number = link.data('shipment-number');
10
- var url = Spree.url( Spree.routes.orders_api + "/" + order_number + "/shipments/" + shipment_number + "/ship.json");
9
+ var url = Spree.url(Spree.routes.orders_api + '/' + order_number + '/shipments/' + shipment_number + '/ship.json');
11
10
  $.ajax({
12
- type: "PUT",
11
+ type: 'PUT',
13
12
  url: url
14
- }).done(function( msg ) {
13
+ }).done(function () {
15
14
  window.location.reload();
16
- }).error(function( msg ) {
15
+ }).error(function (msg) {
17
16
  console.log(msg);
18
17
  });
19
18
  });
20
19
 
21
- //handle shipping method edit click
20
+ // handle shipping method edit click
22
21
  $('a.edit-method').click(toggleMethodEdit);
23
22
  $('a.cancel-method').click(toggleMethodEdit);
24
23
 
25
- //handle shipping method save
26
- $('[data-hook=admin_order_edit_form] a.save-method').click(function(){
24
+ // handle shipping method save
25
+ $('[data-hook=admin_order_edit_form] a.save-method').on('click', function () {
27
26
  var link = $(this);
28
27
  var shipment_number = link.data('shipment-number');
29
28
  var selected_shipping_rate_id = link.parents('tbody').find("select#selected_shipping_rate_id[data-shipment-number='" + shipment_number + "']").val();
30
29
  var unlock = link.parents('tbody').find("input[name='open_adjustment'][data-shipment-number='" + shipment_number + "']:checked").val();
31
- var url = Spree.url( Spree.routes.orders_api + "/" + order_number + "/shipments/" + shipment_number + ".json");
30
+ var url = Spree.url(Spree.routes.orders_api + '/' + order_number + '/shipments/' + shipment_number + '.json');
32
31
 
33
32
  $.ajax({
34
- type: "PUT",
33
+ type: 'PUT',
35
34
  url: url,
36
- data: { shipment: { selected_shipping_rate_id: selected_shipping_rate_id, unlock: unlock } }
37
- }).done(function( msg ) {
35
+ data: {
36
+ shipment: {
37
+ selected_shipping_rate_id: selected_shipping_rate_id,
38
+ unlock: unlock
39
+ }
40
+ }
41
+ }).done(function () {
38
42
  window.location.reload();
39
- }).error(function( msg ) {
43
+ }).error(function (msg) {
40
44
  console.log(msg);
41
45
  });
42
46
  });
43
47
 
44
- //handle tracking edit click
45
- $('a.edit-tracking').click(toggleTrackingEdit);
46
- $('a.cancel-tracking').click(toggleTrackingEdit);
48
+ // handle tracking edit click
49
+ $('a.edit-tracking').on('click', toggleTrackingEdit);
50
+ $('a.cancel-tracking').on('click', toggleTrackingEdit);
47
51
 
48
- //handle tracking save
49
- $('[data-hook=admin_order_edit_form] a.save-tracking').click(function(){
52
+ // handle tracking save
53
+ $('[data-hook=admin_order_edit_form] a.save-tracking').on('click', function () {
50
54
  var link = $(this);
51
55
  var shipment_number = link.data('shipment-number');
52
56
  var tracking = link.parents('tbody').find('input#tracking').val();
53
- var url = Spree.url( Spree.routes.orders_api + "/" + order_number + "/shipments/" + shipment_number + ".json");
57
+ var url = Spree.url(Spree.routes.orders_api + '/' + order_number + '/shipments/' + shipment_number + '.json');
54
58
 
55
59
  $.ajax({
56
- type: "PUT",
60
+ type: 'PUT',
57
61
  url: url,
58
- data: { shipment: { tracking: tracking } }
59
- }).done(function( msg ) {
62
+ data: {
63
+ shipment: {
64
+ tracking: tracking
65
+ }
66
+ }
67
+ }).done(function () {
60
68
  window.location.reload();
61
- }).error(function( msg ) {
69
+ }).error(function (msg) {
62
70
  console.log(msg);
63
71
  });
64
72
  });
@@ -2,7 +2,8 @@
2
2
  jQuery(function($) {
3
3
  // Make select beautiful
4
4
  $('select.select2').select2({
5
- allowClear: true
5
+ allowClear: true,
6
+ dropdownAutoWidth: true
6
7
  });
7
8
 
8
9
  function format_taxons(taxon) {
@@ -13,7 +13,6 @@
13
13
  //= require jquery.adaptivemenu
14
14
  //= require equalize
15
15
  //= require responsive-tables
16
- //= require jquery.horizontalNav
17
16
  //= require spree
18
17
  //= require admin/spree-select2
19
18
  //= require_tree .
@@ -1,9 +1,11 @@
1
- $(document).ready(function() {
2
- $("#country").change(function() {
3
- var new_state_link_href = $('#new_state_link a').attr('href');
4
- var selected_country_id = $('#country option:selected').attr('value');
5
- var new_link = new_state_link_href.replace(/countries\/(\d+)/,
6
- 'countries/'+selected_country_id);
7
- $('#new_state_link a').attr('href', new_link);
8
- });
1
+ $(document).ready(function () {
2
+ 'use strict';
3
+
4
+ $('#country').on('change', function () {
5
+ var new_state_link_href = $('#new_state_link a').attr('href');
6
+ var selected_country_id = $('#country option:selected').attr('value');
7
+ var new_link = new_state_link_href.replace(/countries\/(\d+)/,
8
+ 'countries/' + selected_country_id);
9
+ $('#new_state_link a').attr('href', new_link);
10
+ });
9
11
  });
@@ -1,7 +1,7 @@
1
1
  jQuery ->
2
- $('.stock_item_backorderable').live 'click', ->
2
+ $('.stock_item_backorderable').on 'click', ->
3
3
  $(@).parent('form').submit()
4
- $('.toggle_stock_item_backorderable').submit ->
4
+ $('.toggle_stock_item_backorderable').on 'submit', ->
5
5
  $.ajax
6
6
  type: @method
7
7
  url: @action