spree_frontend 3.3.0.rc3 → 3.3.0.rc4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3cae9b2ff3fcd6fa11abcfdc743477e2dcd4eea4
4
- data.tar.gz: b5de683c69681772147d7750bca160981dd7a8c0
3
+ metadata.gz: 4c7c9088d939b3b6aa4dae8ccd04f573a4ad118a
4
+ data.tar.gz: 567cdb222d2de2cfa619941144124733e761de7c
5
5
  SHA512:
6
- metadata.gz: 4e397ef7b99b29e88e684acaa543715f0e19a2b66403e602ae031ae26a0601beb44afbaa76bfd32742c1320313821e61e15bfde54cfd9019102af9243fd2f49f
7
- data.tar.gz: 72123bbdc4164fd371dd3fc867b346895fa0a68cce0b826938220a7aae61ae93bebf1a3e48eeb53ef6b9496c4aa76b23dacb5cd1c38fff5f0645c875ff1108e9
6
+ metadata.gz: e5363906ac5e584ad1170a308886428c5fbcd72397330aa7fd8f7d21da068e3946c073360ed76470f21bba0629c400e8d45fffc114d49f6c7750e1dc0e5cc3db
7
+ data.tar.gz: 4469e1eaa28d9a96ffcf7e4368f830949d8e9aaf374e2eaebf9e435de58c4ef75140c70c4c3c6a73b57c1bc278ac0e38b687dfb15510fcea275912982c643060
@@ -1,10 +1,13 @@
1
1
  class @ShippingTotalManager
2
- REGEX_FOR_REMOVING_SPECIAL_CHARS = /[^0-9\.]+/g
3
-
4
2
  constructor: (@input) ->
5
3
  @shippingMethods = @input.shippingMethods
6
4
  @shipmentTotal = @input.shipmentTotal
7
5
  @orderTotal = @input.orderTotal
6
+ @formatOptions = {
7
+ symbol : @shipmentTotal.data('currency'),
8
+ decimal : @shipmentTotal.attr('decimal-mark'),
9
+ thousand: @shipmentTotal.attr('thousands-separator'),
10
+ precision : 2 }
8
11
 
9
12
  calculateShipmentTotal: ->
10
13
  @sum = 0
@@ -18,12 +21,12 @@ class @ShippingTotalManager
18
21
  )
19
22
 
20
23
  parseCurrencyToFloat: (input) ->
21
- parseFloat(input.replace(REGEX_FOR_REMOVING_SPECIAL_CHARS, ""))
24
+ accounting.unformat(input, @formatOptions.decimal)
22
25
 
23
26
  readjustSummarySection: (orderTotal, newShipmentTotal, oldShipmentTotal) ->
24
27
  newOrderTotal = orderTotal + (newShipmentTotal - oldShipmentTotal)
25
- @shipmentTotal.html(@shipmentTotal.data('currency') + newShipmentTotal.toFixed(2))
26
- @orderTotal.html(@orderTotal.data('currency') + newOrderTotal.toFixed(2))
28
+ @shipmentTotal.html(accounting.formatMoney(newShipmentTotal, @formatOptions))
29
+ @orderTotal.html(accounting.formatMoney(newOrderTotal, @formatOptions))
27
30
 
28
31
  bindEvent: ->
29
32
  @shippingMethods.change =>
@@ -23,7 +23,7 @@ module Spree
23
23
  def checkout_progress(numbers: false)
24
24
  states = @order.checkout_steps
25
25
  items = states.each_with_index.map do |state, i|
26
- text = Spree.t("order_states.#{state}").titleize
26
+ text = Spree.t("order_state.#{state}").titleize
27
27
  text.prepend("#{i.succ}. ") if numbers
28
28
 
29
29
  css_classes = []
@@ -30,7 +30,8 @@
30
30
  <% if order.passed_checkout_step?("address") && order.shipments.any? %>
31
31
  <tr data-hook="shipping_total">
32
32
  <td><%= Spree.t(:shipping_total) %>:</td>
33
- <td data-hook='shipping-total' data-currency=<%= Money::Currency.find(order.currency).symbol %>><%= Spree::Money.new(order.shipments.to_a.sum(&:cost), currency: order.currency).to_html %></td>
33
+ <% shipping_total = Spree::Money.new(order.shipments.to_a.sum(&:cost), currency: order.currency) %>
34
+ <td data-hook='shipping-total' data-currency='<%= Money::Currency.find(order.currency).symbol %>' thousands-separator='<%= shipping_total.thousands_separator %>' decimal-mark='<%= shipping_total.decimal_mark %>'><%= shipping_total.to_html %></td>
34
35
  </tr>
35
36
 
36
37
  <% if order.shipment_adjustments.nonzero.exists? %>
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * accounting.js v0.4.2, copyright 2014 Open Exchange Rates, MIT license, http://openexchangerates.github.io/accounting.js
3
+ */
4
+ (function(p,z){function q(a){return!!(""===a||a&&a.charCodeAt&&a.substr)}function m(a){return u?u(a):"[object Array]"===v.call(a)}function r(a){return"[object Object]"===v.call(a)}function s(a,b){var d,a=a||{},b=b||{};for(d in b)b.hasOwnProperty(d)&&null==a[d]&&(a[d]=b[d]);return a}function j(a,b,d){var c=[],e,h;if(!a)return c;if(w&&a.map===w)return a.map(b,d);for(e=0,h=a.length;e<h;e++)c[e]=b.call(d,a[e],e,a);return c}function n(a,b){a=Math.round(Math.abs(a));return isNaN(a)?b:a}function x(a){var b=c.settings.currency.format;"function"===typeof a&&(a=a());return q(a)&&a.match("%v")?{pos:a,neg:a.replace("-","").replace("%v","-%v"),zero:a}:!a||!a.pos||!a.pos.match("%v")?!q(b)?b:c.settings.currency.format={pos:b,neg:b.replace("%v","-%v"),zero:b}:a}var c={version:"0.4.1",settings:{currency:{symbol:"$",format:"%s%v",decimal:".",thousand:",",precision:2,grouping:3},number:{precision:0,grouping:3,thousand:",",decimal:"."}}},w=Array.prototype.map,u=Array.isArray,v=Object.prototype.toString,o=c.unformat=c.parse=function(a,b){if(m(a))return j(a,function(a){return o(a,b)});a=a||0;if("number"===typeof a)return a;var b=b||".",c=RegExp("[^0-9-"+b+"]",["g"]),c=parseFloat((""+a).replace(/\((.*)\)/,"-$1").replace(c,"").replace(b,"."));return!isNaN(c)?c:0},y=c.toFixed=function(a,b){var b=n(b,c.settings.number.precision),d=Math.pow(10,b);return(Math.round(c.unformat(a)*d)/d).toFixed(b)},t=c.formatNumber=c.format=function(a,b,d,i){if(m(a))return j(a,function(a){return t(a,b,d,i)});var a=o(a),e=s(r(b)?b:{precision:b,thousand:d,decimal:i},c.settings.number),h=n(e.precision),f=0>a?"-":"",g=parseInt(y(Math.abs(a||0),h),10)+"",l=3<g.length?g.length%3:0;return f+(l?g.substr(0,l)+e.thousand:"")+g.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+e.thousand)+(h?e.decimal+y(Math.abs(a),h).split(".")[1]:"")},A=c.formatMoney=function(a,b,d,i,e,h){if(m(a))return j(a,function(a){return A(a,b,d,i,e,h)});var a=o(a),f=s(r(b)?b:{symbol:b,precision:d,thousand:i,decimal:e,format:h},c.settings.currency),g=x(f.format);return(0<a?g.pos:0>a?g.neg:g.zero).replace("%s",f.symbol).replace("%v",t(Math.abs(a),n(f.precision),f.thousand,f.decimal))};c.formatColumn=function(a,b,d,i,e,h){if(!a)return[];var f=s(r(b)?b:{symbol:b,precision:d,thousand:i,decimal:e,format:h},c.settings.currency),g=x(f.format),l=g.pos.indexOf("%s")<g.pos.indexOf("%v")?!0:!1,k=0,a=j(a,function(a){if(m(a))return c.formatColumn(a,f);a=o(a);a=(0<a?g.pos:0>a?g.neg:g.zero).replace("%s",f.symbol).replace("%v",t(Math.abs(a),n(f.precision),f.thousand,f.decimal));if(a.length>k)k=a.length;return a});return j(a,function(a){return q(a)&&a.length<k?l?a.replace(f.symbol,f.symbol+Array(k-a.length+1).join(" ")):Array(k-a.length+1).join(" ")+a:a})};if("undefined"!==typeof exports){if("undefined"!==typeof module&&module.exports)exports=module.exports=c;exports.accounting=c}else"function"===typeof define&&define.amd?define([],function(){return c}):(c.noConflict=function(a){return function(){p.accounting=a;c.noConflict=z;return c}}(p.accounting),p.accounting=c)})(this);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_frontend
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0.rc3
4
+ version: 3.3.0.rc4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-03 00:00:00.000000000 Z
11
+ date: 2017-08-18 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.3.0.rc3
19
+ version: 3.3.0.rc4
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.3.0.rc3
26
+ version: 3.3.0.rc4
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.3.0.rc3
33
+ version: 3.3.0.rc4
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.3.0.rc3
40
+ version: 3.3.0.rc4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bootstrap-sass
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -230,6 +230,7 @@ files:
230
230
  - lib/spree_frontend.rb
231
231
  - script/rails
232
232
  - spree_frontend.gemspec
233
+ - vendor/assets/javascripts/accounting.min.js
233
234
  homepage: https://spreecommerce.com
234
235
  licenses:
235
236
  - BSD-3-Clause
@@ -251,7 +252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
252
  requirements:
252
253
  - none
253
254
  rubyforge_project:
254
- rubygems_version: 2.6.10
255
+ rubygems_version: 2.6.12
255
256
  signing_key:
256
257
  specification_version: 4
257
258
  summary: Frontend e-commerce functionality for the Spree project.