Fix behavior of search field when no archive is set.

Fixes #49
This commit is contained in:
mossroy 2013-08-04 15:29:46 +02:00
parent 796d67880d
commit 14fedb04cf

View File

@ -26,7 +26,9 @@ define(function(require) {
return false; return false;
}); });
$('#prefix').on('keyup', function(e) { $('#prefix').on('keyup', function(e) {
if (localArchive !== null && localArchive.titleFile !== null) {
onKeyUpPrefix(e); onKeyUpPrefix(e);
}
}); });
// Bottome bar : // Bottome bar :
$('#btnBack').on('click', function(e) { $('#btnBack').on('click', function(e) {
@ -211,10 +213,11 @@ define(function(require) {
$('#searchingForTitles').show(); $('#searchingForTitles').show();
$('#configuration').hide(); $('#configuration').hide();
$('#articleContent').empty(); $('#articleContent').empty();
if (localArchive.titleFile) { if (localArchive !== null && localArchive.titleFile !== null) {
localArchive.findTitlesWithPrefix(prefix.trim(), MAX_SEARCH_RESULT_SIZE, populateListOfTitles); localArchive.findTitlesWithPrefix(prefix.trim(), MAX_SEARCH_RESULT_SIZE, populateListOfTitles);
} else { } else {
alert("Title file not set"); $('#searchingForTitles').hide();
alert("Archive not set : please select an archive in the 'Configure' section");
} }
} }