Sha256: 8b8bd35354efe7d4022a15eac4316d74fc05a4ed2596e634a3051a707210ceb5
Contents?: true
Size: 1.24 KB
Versions: 60
Compression:
Stored size: 1.24 KB
Contents
class NumberFieldUpdater @hideReadOnly: (id) -> toggleReadOnly(id, false) resetInput(id) @showReadOnly: (id) -> toggleReadOnly(id, true) @showForm: (id) -> toggleForm(id, true) @hideForm: (id) -> toggleForm(id, false) @successHandler: (id, newNumber) -> $("#number-update-#{id} span").text(newNumber) @hideForm(id) @showReadOnly(id) toggleReadOnly = (id, show) -> toggleButtonVisibility('edit', id, show) toggleButtonVisibility('trash', id, show) cssDisplay = if show then 'block' else 'none' $("#number-update-#{id} span").css('display', cssDisplay) toggleForm = (id, show) -> toggleButtonVisibility('void', id, show) toggleButtonVisibility('check', id, show) cssDisplay = if show then 'block' else 'none' $("#number-update-#{id} input[type='number']").css('display', cssDisplay) toggleButtonVisibility = (buttonIcon, id, show) -> cssDisplay = if show then 'inline-block' else 'none' $(".fa-#{buttonIcon}[data-id='#{id}']").css('display', cssDisplay) resetInput = (id) -> tableCell = $("#number-update-#{id}") countText = tableCell.find('span').text().trim() tableCell.find("input[type='number']").val(countText) Spree.NumberFieldUpdater = NumberFieldUpdater
Version data entries
60 entries across 60 versions & 1 rubygems