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) { ...@@ -343,9 +343,7 @@ function actionHandler($this, options, template) {
var arg = { var arg = {
row: $(this).closest('[data-val]').data('val'), row: $(this).closest('[data-val]').data('val'),
index: $(this).closest('[data-row]').data('row'), index: $(this).closest('[data-row]').data('row'),
notify: function (message) { notify: notify.bind(this, $this, template)
$('.note', $this).html(template['error']({ message: message }))
}
} }
var action = $(this).data('action') var action = $(this).data('action')
...@@ -368,12 +366,18 @@ String.prototype.remove_quotes = function () { ...@@ -368,12 +366,18 @@ String.prototype.remove_quotes = function () {
return this.toString().replace(/["']/g, '') 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) { function failHandler($this, template, xhr, status, message) {
var error = status + ': ' + message var error = status + ': ' + message
if (xhr.readyState == 0) if (xhr.readyState == 0)
error += ' (cannot connect to server)' 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