1
This commit is contained in:
Alex Yatskov 2014-09-19 20:15:34 +09:00
parent 4632ca02d4
commit bf3725bcb8
2 changed files with 32 additions and 35 deletions

View File

@ -71,21 +71,19 @@
} }
function onLearn() { function onLearn() {
$('#learn').prop('disabled', true); $('#learnKeyword').prop('disabled', true);
$('#learnError').slideUp(function() { $('#learnError').slideUp(function() {
var query = { var query = {
keyword: $('#keyword').val(), keyword: $('#keywordToLearn').val(),
params: ctx.searchParams params: ctx.searchParams
}; };
$.getJSON('/node/addKeyword', query, function(results) { $.getJSON('/node/addKeyword', query, function(results) {
if (results.success) { if (results.success) {
$('#learnDlg').modal('hide'); $('#learnDialog').modal('hide');
} }
else { else {
$('#learnError').slideDown(function() { $('#learnError').slideDown(function() {
$('#learn').prop('disabled', false); $('#learnKeyword').prop('disabled', false);
}); });
} }
}); });
@ -127,15 +125,15 @@
$('#search').click(onSearch); $('#search').click(onSearch);
$('#learnDlg').on('show.bs.modal', function() { $('#learnDialog').on('show.bs.modal', function() {
$('#learn').prop('disabled', true); $('#learnKeyword').prop('disabled', true);
$('#keyword').val(''); $('#keywordToLearn').val('');
$('#learnError').hide(); $('#learnError').hide();
}); });
$('#learn').click(onLearn); $('#learnKeyword').click(onLearn);
$('#keyword').bind('input', function() { $('#keywordToLearn').bind('input', function() {
$('#learn').prop('disabled', !$(this).val()); $('#learnKeyword').prop('disabled', !$(this).val());
}); });
$('#keywords').selectpicker('refresh'); $('#keywords').selectpicker('refresh');

View File

@ -50,7 +50,7 @@
</div> </div>
<!-- Options Dialog --> <!-- Options Dialog -->
<div class="modal fade" id="optionsDlg" tabindex="-1"> <div class="modal fade" id="optionsDialog" tabindex="-1">
<div class="modal-dialog modal-sm"> <div class="modal-dialog modal-sm">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"><big>Visualization Options</big></div> <div class="modal-header"><big>Visualization Options</big></div>
@ -70,21 +70,21 @@
</div> </div>
<!-- Learn Dialog --> <!-- Learn Dialog -->
<div class="modal fade" id="learnDlg" tabindex="-1"> <div class="modal fade" id="learnDialog" tabindex="-1">
<div class="modal-dialog modal-sm"> <div class="modal-dialog modal-sm">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"><big>Learn Keyword</big></div> <div class="modal-header"><big>Learn Keyword</big></div>
<div class="modal-body"> <div class="modal-body">
<div class="form-group"> <div class="form-group">
<label for="keyword" class="control-label">Learn keyword as</label> <label for="keyword" class="control-label">Learn keyword as</label>
<input class="form-control" type="text" id="keyword" name="keyword"> <input class="form-control" type="text" id="keywordToLearn" name="keyword">
</div> </div>
<div class="alert alert-danger" id="learnError" style="display: none;">Error writing keyword to database</div> <div class="alert alert-danger" id="learnError" style="display: none;">Error writing keyword to database</div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-success" id="learn" disabled="disabled">Learn</button> <button type="button" class="btn btn-success" id="learnKeyword" disabled="disabled">Learn</button>
</div> </div>
</div> </div>
</div> </div>
@ -92,20 +92,20 @@
</div> </div>
<!-- Forget Dialog --> <!-- Forget Dialog -->
<div class="modal fade" id="forgetDlg" tabindex="-1"> <div class="modal fade" id="forgetDialog" tabindex="-1">
<div class="modal-dialog modal-sm"> <div class="modal-dialog modal-sm">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"><big>Forget Keyword</big></div> <div class="modal-header"><big>Forget Keyword</big></div>
<div class="modal-body"> <div class="modal-body">
<div class="form-group"> <div class="form-group">
<label for="keywordToDelete">Keyword to delete</label> <label for="keywordToForget">Keyword to forget</label>
<select class="form-control" id="keywordToDelete"></select> <select class="form-control" id="keywordToForget"></select>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-danger" id="forget" disabled="disabled">Forget</button> <button type="button" class="btn btn-danger" id="forgetKeyword" disabled="disabled">Forget</button>
</div> </div>
</div> </div>
</div> </div>
@ -118,16 +118,15 @@
<div class="panel-heading"> <div class="panel-heading">
<big>Semantic tweaks to <span id="query" class="text-primary"></span></big> <big>Semantic tweaks to <span id="query" class="text-primary"></span></big>
<div class="btn-group pull-right"> <div class="btn-group pull-right">
<button class="btn btn-xs btn-success" data-toggle="modal" data-target="#learnDlg">Learn...</button> <button class="btn btn-xs btn-success" data-toggle="modal" data-target="#learnDialog">Learn...</button>
<button class="btn btn-xs btn-danger" data-toggle="modal" data-target="#forgetDlg">Forget...</button> <button class="btn btn-xs btn-danger" data-toggle="modal" data-target="#forgetDialog">Forget...</button>
<button class="btn btn-xs btn-default" data-toggle="modal" data-target="#optionsDlg">Options...</button> <button class="btn btn-xs btn-default" data-toggle="modal" data-target="#optionsDialog">Options...</button>
</div> </div>
</div> </div>
<div style="padding: 10px;" class="unselectable"> <div style="padding: 10px;" class="unselectable">
<canvas id="grapher" width="800" height="550"></canvas> <canvas id="grapher" width="800" height="550"></canvas>
</div> </div>
</div> </div>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"><big>Query results (<span id="count" class="text-primary"></span>)</big></div> <div class="panel-heading"><big>Query results (<span id="count" class="text-primary"></span>)</big></div>
<div style="padding: 10px;"> <div style="padding: 10px;">