Commit 5fd9effa authored by S Anand's avatar S Anand
Browse files

BUG: FormHandler notification works without template. Fixes #98

parent ce251efd
Pipeline #64974 passed with stage
in 2 minutes and 6 seconds
......@@ -343,9 +343,7 @@ function actionHandler($this, options, template) {
var arg = {
row: $(this).closest('[data-val]').data('val'),
index: $(this).closest('[data-row]').data('row'),
notify: function (message) {
$('.note', $this).html(template['error']({ message: message }))
}
notify: notify.bind(this, $this, template)
}
var action = $(this).data('action')
......@@ -368,12 +366,18 @@ String.prototype.remove_quotes = function () {
return this.toString().replace(/["']/g, '')
}
function notify($this, template, message) {
var $note = $('.note', $this)
if (!$note.length)
$note = $('<div class="note"></div>').appendTo($this)
$note.html(template['error']({ message: message }))
}
function failHandler($this, template, xhr, status, message) {
var error = status + ': ' + message
if (xhr.readyState == 0)
error += ' (cannot connect to server)'
$('.note', $this).html(template['error']({message: error}))
notify($this, template, error)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment