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-4.4.1 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-4.4.0 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-4.3.4 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-4.2.4 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-4.1.5 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-4.3.3 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-4.3.2 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-4.1.4 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-4.3.1 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-4.3.0 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-4.2.3 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-4.1.3 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-4.0.4 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-3.4.6 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-4.0.3 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-4.1.2 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-4.2.2 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-3.4.5 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-4.2.1 app/assets/javascripts/spree/backend/views/number_with_currency.js
solidus_backend-4.2.0 app/assets/javascripts/spree/backend/views/number_with_currency.js