(contactMessageObject, modal)
| 8 | */ |
| 9 | module.exports = { |
| 10 | sendContactMessage (contactMessageObject, modal) { |
| 11 | // deprecated |
| 12 | if (modal != null) { |
| 13 | modal.find('.sending-indicator').show() |
| 14 | } |
| 15 | const jqxhr = $.post('/contact', contactMessageObject, function (response) { |
| 16 | if (!modal) { return } |
| 17 | modal.find('.sending-indicator').hide() |
| 18 | modal.find('#contact-message').val('Thanks!') |
| 19 | return _.delay(function () { |
| 20 | modal.find('#contact-message').val('') |
| 21 | return modal.modal('hide') |
| 22 | } |
| 23 | , 1000) |
| 24 | }) |
| 25 | jqxhr.fail(function () { |
| 26 | if (!modal) { return } |
| 27 | if (jqxhr.status === 500) { |
| 28 | return modal.find('.sending-indicator').text($.i18n.t('loading_error.server_error')) |
| 29 | } |
| 30 | }) |
| 31 | return jqxhr |
| 32 | }, |
| 33 | |
| 34 | send (options) { |
| 35 | if (options == null) { options = {} } |
no test coverage detected