Sha256: 7c38cc96aa2500e198341b65571e8d77dacf11d9ba23f5c5addd15faa9f03750

Contents?: true

Size: 756 Bytes

Versions: 153

Compression:

Stored size: 756 Bytes

Contents

Spree.Views.NumberWithCurrency = Backbone.View.extend({
  events: {
    'change input,select': "render"
  },

  initialize: function() {
    this.$currencySelector = this.$('.number-with-currency-select');
  },

  getCurrency: function() {
    if (this.$currencySelector.length) {
      return this.$currencySelector.find('option:selected').val();
    } else {
      return this.$('[data-currency]').data("currency");
    }
  },

  getCurrencySymbol: function() {
    var currency = this.getCurrency();
    if (currency) {
      var currencyInfo = Spree.currencyInfo[currency];
      return currencyInfo[0];
    } else {
      return '';
    }
  },

  render: function() {
    this.$('.number-with-currency-symbol').text(this.getCurrencySymbol());
  }
});

Version data entries

153 entries across 153 versions & 2 rubygems

Version Path
solidus_backend-3.2.5 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-3.2.4 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-3.2.3 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-3.1.8 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-3.0.8 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-3.2.2 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-3.2.1 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-3.2.0 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-3.2.0.alpha app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-3.0.7 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-2.11.17 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-3.1.7 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-2.11.16 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-3.0.6 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-3.1.6 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-2.11.15 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-2.11.14 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-3.0.5 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-3.1.5 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-2.11.13 app/assets/javascripts/spree/backend/views/number_with_currency.js