spree_backend 3.0.6.1 → 3.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6159f897facb5cec41999c468ce1bd5e25a31647
4
- data.tar.gz: 438dd8f6e50b5f03db44b7d85d1865920cf53bef
3
+ metadata.gz: d13f9d0f8ce88f502cc8ee55faa2af5fd98b3dc6
4
+ data.tar.gz: 4236a33d9301e30a573c0bbbe704492c9e41de01
5
5
  SHA512:
6
- metadata.gz: d8dd0d9f4c09418031f5c02b607c5e815e801d7a03e77dea2c2ad089dcc4da77a01a4f23960228696341aba93707885db8588888f73a10a8b438d817682779a3
7
- data.tar.gz: 6ffcd65e07c3191f4b49fb328dd123494aa981b320c13e7109b0b0f6bf98a7e3fc7122359986bedcef291deaa1cfa0cad2af7b54c006768e096d6331981e2f4e
6
+ metadata.gz: 50b5936d9b443716bfa26296c5a1b5e36c56d46300ebb0c7344f43afefe571f5d7d3601221e43eb0651674869463db774917b000b3d6906d82cb517be8e82475
7
+ data.tar.gz: d3234fde967703238bcd74fbcf30d8e81a304ba50000c110ec63f7a5c9cbd89f38094f9af9e974814af8fc13903b9af3e44cc9c4f396e864515cfa61bb3a98e0
@@ -25,7 +25,7 @@ $(document).ready(function() {
25
25
  }
26
26
  },
27
27
  results: function(data, page) {
28
- return { results: data }
28
+ return { results: data.users }
29
29
  }
30
30
  },
31
31
  dropdownCssClass: 'customer_search',
@@ -53,7 +53,7 @@ $(document).ready(function() {
53
53
  });
54
54
  });
55
55
  }
56
- return customer.email;
56
+ return Select2.util.escapeMarkup(customer.email);
57
57
  }
58
58
  })
59
59
  }
@@ -1,6 +1,10 @@
1
1
  $(document).ready(function () {
2
2
  'use strict';
3
3
 
4
+ function formatOptionType(option_type) {
5
+ return Select2.util.escapeMarkup(option_type.presentation + ' (' + option_type.name + ')');
6
+ }
7
+
4
8
  if ($('#product_option_type_ids').length > 0) {
5
9
  $('#product_option_type_ids').select2({
6
10
  placeholder: Spree.translations.option_type_placeholder,
@@ -32,12 +36,8 @@ $(document).ready(function () {
32
36
  };
33
37
  }
34
38
  },
35
- formatResult: function (option_type) {
36
- return option_type.presentation + ' (' + option_type.name + ')';
37
- },
38
- formatSelection: function (option_type) {
39
- return option_type.presentation + ' (' + option_type.name + ')';
40
- }
39
+ formatResult: formatOptionType,
40
+ formatSelection: formatOptionType
41
41
  });
42
42
  }
43
43
  });
@@ -5,6 +5,10 @@ $.fn.productAutocomplete = function (options) {
5
5
  options = options || {};
6
6
  var multiple = typeof(options.multiple) !== 'undefined' ? options.multiple : true;
7
7
 
8
+ function formatProduct(product) {
9
+ return Select2.util.escapeMarkup(product.name);
10
+ }
11
+
8
12
  this.select2({
9
13
  minimumInputLength: 3,
10
14
  multiple: multiple,
@@ -36,12 +40,8 @@ $.fn.productAutocomplete = function (options) {
36
40
  };
37
41
  }
38
42
  },
39
- formatResult: function (product) {
40
- return product.name;
41
- },
42
- formatSelection: function (product) {
43
- return product.name;
44
- }
43
+ formatResult: formatProduct,
44
+ formatSelection: formatProduct
45
45
  });
46
46
  };
47
47
 
@@ -15,5 +15,5 @@ jQuery ->
15
15
  return { results: data.stock_items, more: more }
16
16
  formatResult: (stock_item) ->
17
17
  variantTemplate({ variant: stock_item.variant })
18
- formatSelection: (stock_item) ->
19
- "#{stock_item.variant.name} (#{stock_item.variant.options_text})"
18
+ formatSelection: (stock_item, container, excapeMarkup) ->
19
+ Select2.util.escapeMarkup("#{stock_item.variant.name} (#{stock_item.variant.options_text})")
@@ -1,6 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var set_taxon_select = function(selector){
4
+ function formatTaxon(taxon) {
5
+ return Select2.util.escapeMarkup(taxon.pretty_name);
6
+ }
7
+
4
8
  if ($(selector).length > 0) {
5
9
  $(selector).select2({
6
10
  placeholder: Spree.translations.taxon_placeholder,
@@ -36,12 +40,8 @@ var set_taxon_select = function(selector){
36
40
  };
37
41
  }
38
42
  },
39
- formatResult: function (taxon) {
40
- return taxon.pretty_name;
41
- },
42
- formatSelection: function (taxon) {
43
- return taxon.pretty_name;
44
- }
43
+ formatResult: formatTaxon,
44
+ formatSelection: formatTaxon
45
45
  });
46
46
  }
47
47
  }
@@ -1,8 +1,10 @@
1
1
  $(document).ready ->
2
2
  window.productTemplate = Handlebars.compile($('#product_template').text());
3
3
  $('#taxon_products').sortable({
4
- handle: ".js-sort-handle"
5
- });
4
+ handle: ".js-sort-handle"
5
+ });
6
+ formatTaxon = (taxon) ->
7
+ Select2.util.escapeMarkup(taxon.pretty_name)
6
8
  $('#taxon_products').on "sortstop", (event, ui) ->
7
9
  $.ajax
8
10
  url: Spree.routes.classifications_api,
@@ -32,10 +34,8 @@ $(document).ready ->
32
34
  more = page < data.pages;
33
35
  results: data['taxons'],
34
36
  more: more
35
- formatResult: (taxon) ->
36
- taxon.pretty_name;
37
- formatSelection: (taxon) ->
38
- taxon.pretty_name;
37
+ formatResult: formatTaxon,
38
+ formatSelection: formatTaxon
39
39
 
40
40
  $('#taxon_id').on "change", (e) ->
41
41
  el = $('#taxon_products')
@@ -1,6 +1,10 @@
1
1
  $.fn.userAutocomplete = function () {
2
2
  'use strict';
3
3
 
4
+ function formatUser(user) {
5
+ return Select2.util.escapeMarkup(user.email);
6
+ }
7
+
4
8
  this.select2({
5
9
  minimumInputLength: 1,
6
10
  multiple: true,
@@ -8,7 +12,7 @@ $.fn.userAutocomplete = function () {
8
12
  $.get(Spree.routes.user_search, {
9
13
  ids: element.val()
10
14
  }, function (data) {
11
- callback(data);
15
+ callback(data.users);
12
16
  });
13
17
  },
14
18
  ajax: {
@@ -22,16 +26,12 @@ $.fn.userAutocomplete = function () {
22
26
  },
23
27
  results: function (data) {
24
28
  return {
25
- results: data
29
+ results: data.users
26
30
  };
27
31
  }
28
32
  },
29
- formatResult: function (user) {
30
- return user.email;
31
- },
32
- formatSelection: function (user) {
33
- return user.email;
34
- }
33
+ formatResult: formatUser,
34
+ formatSelection: formatUser
35
35
  });
36
36
  };
37
37
 
@@ -31,8 +31,8 @@ $.fn.variantAutocomplete = ->
31
31
  results: data["variants"]
32
32
 
33
33
  formatResult: formatVariantResult
34
- formatSelection: (variant) ->
34
+ formatSelection: (variant, container, escapeMarkup) ->
35
35
  if !!variant.options_text
36
- variant.name + " (#{variant.options_text})"
36
+ Select2.util.escapeMarkup("#{variant.name} (#{variant.options_text})")
37
37
  else
38
- variant.name
38
+ Select2.util.escapeMarkup(variant.name)
@@ -22,7 +22,7 @@ module Spree
22
22
  parts << variant.product.name
23
23
  parts << "(#{variant.options_text})" if variant.options_text.present?
24
24
  parts << line_item.display_total
25
- parts.join("<br>").html_safe
25
+ safe_join(parts, "<br />".html_safe)
26
26
  end
27
27
 
28
28
  def display_shipment(shipment)
@@ -7,8 +7,8 @@ module Spree
7
7
  flash_class = "danger" if flash[:error]
8
8
  flash_class = "info" if flash[:notice]
9
9
  flash_class = "success" if flash[:success]
10
- flash_div = content_tag(:div, message, class: "alert alert-#{flash_class} alert-auto-dissapear")
11
- content_tag(:div, flash_div, class: 'col-md-12')
10
+ flash_div = content_tag(:div, message, class: "alert alert-#{flash_class} alert-auto-disappear")
11
+ content_tag(:div, flash_div, class: 'col-md-12')
12
12
  end
13
13
  end
14
14
 
@@ -26,7 +26,7 @@ module Spree
26
26
  obj = object.respond_to?(:errors) ? object : instance_variable_get("@#{object}")
27
27
 
28
28
  if obj && obj.errors[method].present?
29
- errors = obj.errors[method].map { |err| h(err) }.join('<br />').html_safe
29
+ errors = safe_join(obj.errors[method], '<br />'.html_safe)
30
30
  content_tag(:span, errors, class: 'formError')
31
31
  else
32
32
  ''
@@ -117,12 +117,13 @@ module Spree
117
117
 
118
118
  def preference_fields(object, form)
119
119
  return unless object.respond_to?(:preferences)
120
- object.preferences.keys.map{ |key|
121
- if object.has_preference?(key)
122
- form.label("preferred_#{key}", Spree.t(key) + ": ") +
123
- preference_field_for(form, "preferred_#{key}", type: object.preference_type(key))
124
- end
125
- }.join("<br />").html_safe
120
+ fields = object.preferences.keys.map { |key|
121
+ if object.has_preference?(key)
122
+ form.label("preferred_#{key}", Spree.t(key) + ": ") +
123
+ preference_field_for(form, "preferred_#{key}", type: object.preference_type(key))
124
+ end
125
+ }
126
+ safe_join(fields, '<br />'.html_safe)
126
127
  end
127
128
 
128
129
  # renders hidden field and link to remove record using nested_attributes
@@ -152,7 +152,7 @@ module Spree
152
152
  options[:class] = (options[:class].to_s + " icon-link with-tip action-#{icon_name}").strip
153
153
  options[:class] += ' no-text' if options[:no_text]
154
154
  options[:title] = text if options[:no_text]
155
- text = options[:no_text] ? '' : raw("<span class='text'>#{text}</span>")
155
+ text = options[:no_text] ? '' : content_tag(:span, text, class: 'text')
156
156
  options.delete(:no_text)
157
157
  if icon_name
158
158
  icon = content_tag(:span, '', class: "icon icon-#{icon_name}")
@@ -12,7 +12,7 @@ module Spree
12
12
  :data => { :confirm => Spree.t(:order_sure_want_to, :event => Spree.t(event)) })
13
13
  end
14
14
  end
15
- links.join(' ').html_safe
15
+ safe_join(links, '&nbsp;'.html_safe)
16
16
  end
17
17
 
18
18
  def line_item_shipment_price(line_item, quantity)
@@ -9,7 +9,8 @@ module Spree
9
9
  :selected => ('selected' if selected)) do
10
10
  (taxon.ancestors.pluck(:name) + [taxon.name]).join(" -> ")
11
11
  end
12
- end.join("").html_safe
12
+ end
13
+ safe_join(options)
13
14
  end
14
15
 
15
16
  def option_types_options_for(product)
@@ -20,7 +21,8 @@ module Spree
20
21
  :selected => ('selected' if selected)) do
21
22
  option_type.name
22
23
  end
23
- end.join("").html_safe
24
+ end
25
+ safe_join(options)
24
26
  end
25
27
  end
26
28
  end
@@ -15,9 +15,9 @@ module Spree
15
15
 
16
16
  def display_variant(stock_movement)
17
17
  variant = stock_movement.stock_item.variant
18
- output = variant.name
19
- output += "<br>(#{variant.options_text})" unless variant.options_text.blank?
20
- output.html_safe
18
+ output = [variant.name]
19
+ output << variant.options_text unless variant.options_text.blank?
20
+ safe_join(output, '<br />'.html_safe)
21
21
  end
22
22
  end
23
23
  end
@@ -1,4 +1,4 @@
1
- collection(@users)
1
+ collection(@users => :users)
2
2
  attributes :email, :id
3
3
  address_fields = [:firstname, :lastname,
4
4
  :address1, :address2,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_backend
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.6.1
4
+ version: 3.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-18 00:00:00.000000000 Z
11
+ date: 2016-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_api
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.0.6.1
19
+ version: 3.0.7
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 3.0.6.1
26
+ version: 3.0.7
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: spree_core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 3.0.6.1
33
+ version: 3.0.7
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 3.0.6.1
40
+ version: 3.0.7
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bootstrap-sass
43
43
  requirement: !ruby/object:Gem::Requirement