Better errors from podcast 'Add' dialog

This commit is contained in:
Duncan Sommerville 2015-11-10 19:26:25 -05:00
parent de380369ed
commit c5a5839eff
10 changed files with 44 additions and 14 deletions

View file

@ -304,6 +304,20 @@ function getUsabilityHint() {
});
}
// TODO: build this out so we can use it as a fallback in fail cases
function buildErrorDialog(message) {
var el = $("<div id='error_dialog'></div>");
el.text(message);
$(document.body).append(el);
$("#error_dialog").dialog({
title: $.i18n._("Something went wrong!"),
resizable: false,
modal: true,
width: "auto",
height: "auto"
});
}
/**
* Add title attributes (whose values are their inner text) to all elements in the calling parent matching selector
*

View file

@ -524,6 +524,12 @@ var AIRTIME = (function (AIRTIME) {
AIRTIME.library.podcastTableWidget.clearSelection();
AIRTIME.library.setCurrentTable(AIRTIME.library.DataTableTypeEnum.PODCAST_EPISODES);
$("#podcast_url_dialog").dialog("close");
}).fail(function (e) {
var errors = $("#podcast_url_dialog").find(".errors");
errors.show(200).text(e.responseText);
setTimeout(function () {
errors.hide(200);
}, 3000);
});
};
@ -679,3 +685,10 @@ var AIRTIME = (function (AIRTIME) {
return AIRTIME;
}(AIRTIME || {}));
$(document).ready(function() {
$(document).on("submit", "#podcast_url_form", function (e) {
e.preventDefault();
AIRTIME.podcast.addPodcast();
});
});

View file

@ -303,7 +303,7 @@ var AIRTIME = (function(AIRTIME) {
var foundAtIdx = $.inArray(aData, self._selectedRows);
console.log('checkbox mouse', iVisualRowIdx, foundAtIdx);
//console.log('checkbox mouse', iVisualRowIdx, foundAtIdx);
//If the clicked row is already selected, deselect it.
if (foundAtIdx >= 0 && self._selectedRows.length >= 1) {