Sha256: 42e791af706f232bfd7642f4b236dd5fdd47ca4b6af1484b8711d42e424d95fa
Contents?: true
Size: 1.25 KB
Versions: 64
Compression:
Stored size: 1.25 KB
Contents
$(document).ready -> return unless $('#sc_memo_edit_form').length > 0 $('.js-edit-memo').on('click', (ev) => ev.preventDefault() originalValue = $('#memo-edit-row').data('original-value') $('#sc_memo_edit_form').find("[name='store_credit[memo]']").val(originalValue) $('#memo-display-row').addClass('hidden') $('#memo-edit-row').removeClass('hidden') ) $('.js-save-memo').on('click', (ev) -> ev.preventDefault() Spree.ajax( $('#sc_memo_edit_form').attr('url'), { data: $('#sc_memo_edit_form').serialize(), dataType: 'json', method: 'put', success: ( (response) => newValue = $('#sc_memo_edit_form').find("[name='store_credit[memo]']").val() $('#memo-edit-row').data('original-value', newValue) $('#memo-display-row').find('.js-memo-text').text(newValue) hideEditMemoForm() show_flash('success', response.message) ), error: ( (xhr, status) => show_flash('error', xhr.responseJSON.message) ) } ) ) $('.js-cancel-memo').on('click', (ev) => ev.preventDefault() hideEditMemoForm() ) hideEditMemoForm = -> $('#memo-edit-row').addClass('hidden') $('#memo-display-row').removeClass('hidden')
Version data entries
64 entries across 64 versions & 1 rubygems