Sha256: 1c2cf572e4b5ec0fb465fb8a65f07861c7f61f8b67e2740571265a911b8415c4

Contents?: true

Size: 826 Bytes

Versions: 32

Compression:

Stored size: 826 Bytes

Contents

Spree.ready(function() {
  $('.store-credit-memo-row').each(function() {
    var row = this;
    var field = row.querySelector('[name="store_credit[memo]"]')
    var textDisplay = row.querySelector('.store-credit-memo-text')

    $(row).on('ajax:success', function(event, data) {
      row.classList.remove('editing');
      field.defaultValue = field.value;
      textDisplay.textContent = field.value;

      show_flash('success', data.message);
    }).on('ajax:error', function(event, xhr, status, error) {
      show_flash('error', xhr.responseJSON.message);
    });

    row.querySelector('.edit-memo').addEventListener('click', function() {
      row.classList.add('editing');
    });

    row.querySelector('.cancel-memo').addEventListener('click', function() {
      row.classList.remove('editing');
    });
  });
});

Version data entries

32 entries across 32 versions & 2 rubygems

Version Path
solidus_backend-2.6.6 app/assets/javascripts/spree/backend/store_credits.js
solidus_backend-2.7.4 app/assets/javascripts/spree/backend/store_credits.js
solidus_backend-2.7.3 app/assets/javascripts/spree/backend/store_credits.js
solidus_backend-2.6.5 app/assets/javascripts/spree/backend/store_credits.js
solidus_backend-2.5.2 app/assets/javascripts/spree/backend/store_credits.js
solidus_backend-2.7.2 app/assets/javascripts/spree/backend/store_credits.js
solidus_backend-2.6.4 app/assets/javascripts/spree/backend/store_credits.js
solidus_backend-2.5.1 app/assets/javascripts/spree/backend/store_credits.js
solidus_backend-2.6.3 app/assets/javascripts/spree/backend/store_credits.js
solidus_backend-2.7.1 app/assets/javascripts/spree/backend/store_credits.js
solidus_backend-2.6.2 app/assets/javascripts/spree/backend/store_credits.js
solidus_backend_devise_token_auth-2.8.0.alpha.14 app/assets/javascripts/spree/backend/store_credits.js
solidus_backend_devise_token_auth-2.8.0.alpha.13 app/assets/javascripts/spree/backend/store_credits.js
solidus_backend_devise_token_auth-2.8.0.alpha.12 app/assets/javascripts/spree/backend/store_credits.js
solidus_backend_devise_token_auth-2.8.0.alpha.11 app/assets/javascripts/spree/backend/store_credits.js
solidus_backend_devise_token_auth-2.8.0.alpha.10 app/assets/javascripts/spree/backend/store_credits.js
solidus_backend_devise_token_auth-2.8.0.alpha.9 app/assets/javascripts/spree/backend/store_credits.js
solidus_backend_devise_token_auth-2.8.0.alpha.8 app/assets/javascripts/spree/backend/store_credits.js
solidus_backend_devise_token_auth-2.8.0.alpha.7 app/assets/javascripts/spree/backend/store_credits.js
solidus_backend_devise_token_auth-2.8.0.alpha.6 app/assets/javascripts/spree/backend/store_credits.js