1
This commit is contained in:
Alex Yatskov 2014-09-30 17:40:31 +09:00
parent 88c9cdf4b6
commit 1ac46a15ea
4 changed files with 369 additions and 15 deletions

177
client/dist/index.html vendored Normal file
View File

@ -0,0 +1,177 @@
<!DOCTYPE html>
<html>
<head>
<title>Reactive Search</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<!-- inject:css -->
<link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="/bower_components/bootstrap-select/dist/css/bootstrap-select.min.css">
<link rel="stylesheet" href="/css/style.css">
<!-- endinject -->
</head>
<body>
<div class="container">
<!-- busy spinner -->
<div class="page-header">
<h1><img id="spinner" class="pull-right" src="images/spinner.gif" style="display: none;" width="32" height="32">Reactive Search</h1>
</div>
<!-- query input -->
<div id="input" class="form-horizontal">
<div class="form-group">
<label for="keywordsToSearch" class="col-md-2 control-label">Keywords</label>
<div class="col-md-10">
<select id="keywordsToSearch" class="form-control" multiple="multiple" data-max-options="4" data-live-search="data-live-search"></select>
</div>
</div>
<div class="form-group">
<label for="minScore" class="col-md-2 control-label">Minimum score</label>
<div class="col-md-10">
<input class="form-control" type="number" step="any" value="0.25" id="minScore">
</div>
</div>
<div class="form-group">
<label for="hintSteps" class="col-md-2 control-label">Hint steps</label>
<div class="col-md-10">
<input class="form-control" type="number" value="20" id="hintSteps">
</div>
</div>
<div class="form-group">
<label for="maxResults" class="col-md-2 control-label">Max results</label>
<div class="col-md-10">
<input class="form-control" type="number" value="100" id="maxResults">
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button class="btn btn-primary" id="searchKeywords" type="button" disabled="disabled">
<span class="glyphicon glyphicon-search"></span> Search
</button>
</div>
</div>
</div>
<!-- options dialog -->
<div class="modal fade" id="optionsDialog" tabindex="-1">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header"><big>Visualization Options</big></div>
<div class="modal-body">
<div class="checkbox">
<label><input type="checkbox" id="useLocalScale" checked="checked">Use local scale</label>
</div>
<div class="checkbox">
<label><input type="checkbox" id="useRelativeScale" checked="checked">Use relative scale</label>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- learn keyword dialog -->
<div class="modal fade" id="learnDialog" tabindex="-1">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header"><big>Learn Keyword</big></div>
<div class="modal-body">
<div class="form-group">
<label for="keyword" class="control-label">Learn keyword as</label>
<input class="form-control" type="text" id="keywordToLearn">
</div>
<div class="alert alert-danger" id="learnError" style="display: none;">Unable to learn keyword</div>
</div>
<div class="modal-footer">
<div class="btn-group">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-success" id="learnKeyword" disabled="disabled">Learn</button>
</div>
</div>
</div>
</div>
</div>
<!-- forget keyword dialog -->
<div class="modal fade" id="forgetDialog" tabindex="-1">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header"><big>Forget Keyword</big></div>
<div class="modal-body">
<div class="form-group">
<label for="keywordToForget">Keyword to forget</label>
<select id="keywordToForget" class="form-control"></select>
</div>
<div class="alert alert-danger" id="forgetError" style="display: none;">Unable to forget keyword</div>
</div>
<div class="modal-footer">
<div class="btn-group">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-danger" id="forgetKeyword" disabled="disabled">Forget</button>
</div>
</div>
</div>
</div>
</div>
<!-- query output -->
<div id="output" style="display: none;">
<!-- semantic tweaker -->
<div class="panel panel-default unselectable">
<div class="panel-heading">
<big>Semantic tweaks to <span id="query" class="text-primary"></span></big>
<div class="btn-group pull-right">
<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="#forgetDialog">Forget</button>
<button class="btn btn-xs btn-default" data-toggle="modal" data-target="#optionsDialog">Options</button>
</div>
</div>
<div style="padding: 10px;">
<canvas id="grapher" width="800" height="550"></canvas>
</div>
</div>
<!-- result listing -->
<div class="panel panel-default">
<div class="panel-heading"><big>Query results (<span id="count" class="text-primary"></span>)</big></div>
<div style="padding: 10px;">
<script id="template" type="text/x-handlers-template">
{{#if results}}
<table class="table table-striped table-condensed">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>Score</th>
</tr>
</thead>
{{#each results}}
<tr>
<td>{{@index}}</td>
<td><a href="{{url}}">{{name}}</a></td>
<td>{{score}}</td>
</tr>
{{/each}}
</table>
{{/if}}
</script>
<div id="results"></div>
</div>
</div>
</div>
</div>
<!-- inject:js -->
<script src="/bower_components/underscore/underscore.js"></script>
<script src="/bower_components/handlebars/handlebars.min.js"></script>
<script src="/bower_components/jquery/dist/jquery.min.js"></script>
<script src="/bower_components/fabric/dist/fabric.min.js"></script>
<script src="/bower_components/tinycolor/tinycolor.js"></script>
<script src="/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="/bower_components/bootstrap-select/dist/js/bootstrap-select.min.js"></script>
<script src="/js/application.js"></script>
<script src="/js/grapher.js"></script>
<!-- endinject -->
</body>
</html>

View File

@ -8,28 +8,28 @@ var uglify = require('gulp-uglify');
var paths = { var paths = {
js: [ js: [
'bower_components/underscore/underscore.js', './bower_components/underscore/underscore.js',
'bower_components/handlebars/handlebars.min.js', './bower_components/handlebars/handlebars.min.js',
'bower_components/jquery/dist/jquery.min.js', './bower_components/jquery/dist/jquery.min.js',
'bower_components/fabric/dist/fabric.min.js', './bower_components/fabric/dist/fabric.min.js',
'bower_components/tinycolor/tinycolor.js', './bower_components/tinycolor/tinycolor.js',
'bower_components/bootstrap/dist/js/bootstrap.min.js', './bower_components/bootstrap/dist/js/bootstrap.min.js',
'bower_components/bootstrap-select/dist/js/bootstrap-select.min.js', './bower_components/bootstrap-select/dist/js/bootstrap-select.min.js',
'js/*.js' './js/*.js'
], ],
css: [ css: [
'bower_components/bootstrap/dist/css/bootstrap.min.css', './bower_components/bootstrap/dist/css/bootstrap.min.css',
'bower_components/bootstrap/dist/css/bootstrap-theme.min.css', './bower_components/bootstrap/dist/css/bootstrap-theme.min.css',
'bower_components/bootstrap-select/dist/css/bootstrap-select.min.css', './bower_components/bootstrap-select/dist/css/bootstrap-select.min.css',
'css/*.css' './css/*.css'
], ],
html: [ html: [
'index.html' './html/*.html'
] ]
}; };
gulp.task('lint', function() { gulp.task('lint', function() {
return gulp.src('js/*.js') return gulp.src('./js/*.js')
.pipe(jshint()) .pipe(jshint())
.pipe(jshint.reporter('default')); .pipe(jshint.reporter('default'));
}); });
@ -52,7 +52,7 @@ gulp.task('pages', function() {
var sources = gulp.src(paths.js.concat(paths.css), { read: false }); var sources = gulp.src(paths.js.concat(paths.css), { read: false });
return gulp.src(paths.html) return gulp.src(paths.html)
.pipe(inject(sources)) .pipe(inject(sources))
.pipe(gulp.dest('dist')); .pipe(gulp.dest('./'));
}); });
gulp.task('default', ['lint', 'scripts', 'styles', 'pages']); gulp.task('default', ['lint', 'scripts', 'styles', 'pages']);

164
client/html/index.html Normal file
View File

@ -0,0 +1,164 @@
<!DOCTYPE html>
<html>
<head>
<title>Reactive Search</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<!-- inject:css -->
<!-- endinject -->
</head>
<body>
<div class="container">
<!-- busy spinner -->
<div class="page-header">
<h1><img id="spinner" class="pull-right" src="images/spinner.gif" style="display: none;" width="32" height="32">Reactive Search</h1>
</div>
<!-- query input -->
<div id="input" class="form-horizontal">
<div class="form-group">
<label for="keywordsToSearch" class="col-md-2 control-label">Keywords</label>
<div class="col-md-10">
<select id="keywordsToSearch" class="form-control" multiple="multiple" data-max-options="4" data-live-search="data-live-search"></select>
</div>
</div>
<div class="form-group">
<label for="minScore" class="col-md-2 control-label">Minimum score</label>
<div class="col-md-10">
<input class="form-control" type="number" step="any" value="0.25" id="minScore">
</div>
</div>
<div class="form-group">
<label for="hintSteps" class="col-md-2 control-label">Hint steps</label>
<div class="col-md-10">
<input class="form-control" type="number" value="20" id="hintSteps">
</div>
</div>
<div class="form-group">
<label for="maxResults" class="col-md-2 control-label">Max results</label>
<div class="col-md-10">
<input class="form-control" type="number" value="100" id="maxResults">
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button class="btn btn-primary" id="searchKeywords" type="button" disabled="disabled">
<span class="glyphicon glyphicon-search"></span> Search
</button>
</div>
</div>
</div>
<!-- options dialog -->
<div class="modal fade" id="optionsDialog" tabindex="-1">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header"><big>Visualization Options</big></div>
<div class="modal-body">
<div class="checkbox">
<label><input type="checkbox" id="useLocalScale" checked="checked">Use local scale</label>
</div>
<div class="checkbox">
<label><input type="checkbox" id="useRelativeScale" checked="checked">Use relative scale</label>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- learn keyword dialog -->
<div class="modal fade" id="learnDialog" tabindex="-1">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header"><big>Learn Keyword</big></div>
<div class="modal-body">
<div class="form-group">
<label for="keyword" class="control-label">Learn keyword as</label>
<input class="form-control" type="text" id="keywordToLearn">
</div>
<div class="alert alert-danger" id="learnError" style="display: none;">Unable to learn keyword</div>
</div>
<div class="modal-footer">
<div class="btn-group">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-success" id="learnKeyword" disabled="disabled">Learn</button>
</div>
</div>
</div>
</div>
</div>
<!-- forget keyword dialog -->
<div class="modal fade" id="forgetDialog" tabindex="-1">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header"><big>Forget Keyword</big></div>
<div class="modal-body">
<div class="form-group">
<label for="keywordToForget">Keyword to forget</label>
<select id="keywordToForget" class="form-control"></select>
</div>
<div class="alert alert-danger" id="forgetError" style="display: none;">Unable to forget keyword</div>
</div>
<div class="modal-footer">
<div class="btn-group">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-danger" id="forgetKeyword" disabled="disabled">Forget</button>
</div>
</div>
</div>
</div>
</div>
<!-- query output -->
<div id="output" style="display: none;">
<!-- semantic tweaker -->
<div class="panel panel-default unselectable">
<div class="panel-heading">
<big>Semantic tweaks to <span id="query" class="text-primary"></span></big>
<div class="btn-group pull-right">
<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="#forgetDialog">Forget</button>
<button class="btn btn-xs btn-default" data-toggle="modal" data-target="#optionsDialog">Options</button>
</div>
</div>
<div style="padding: 10px;">
<canvas id="grapher" width="800" height="550"></canvas>
</div>
</div>
<!-- result listing -->
<div class="panel panel-default">
<div class="panel-heading"><big>Query results (<span id="count" class="text-primary"></span>)</big></div>
<div style="padding: 10px;">
<script id="template" type="text/x-handlers-template">
{{#if results}}
<table class="table table-striped table-condensed">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>Score</th>
</tr>
</thead>
{{#each results}}
<tr>
<td>{{@index}}</td>
<td><a href="{{url}}">{{name}}</a></td>
<td>{{score}}</td>
</tr>
{{/each}}
</table>
{{/if}}
</script>
<div id="results"></div>
</div>
</div>
</div>
</div>
<!-- inject:js -->
<!-- endinject -->
</body>
</html>

View File

@ -4,6 +4,10 @@
<title>Reactive Search</title> <title>Reactive Search</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8">
<!-- inject:css --> <!-- inject:css -->
<link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="/bower_components/bootstrap-select/dist/css/bootstrap-select.min.css">
<link rel="stylesheet" href="/css/style.css">
<!-- endinject --> <!-- endinject -->
</head> </head>
<body> <body>
@ -159,6 +163,15 @@
</div> </div>
</div> </div>
<!-- inject:js --> <!-- inject:js -->
<script src="/bower_components/underscore/underscore.js"></script>
<script src="/bower_components/handlebars/handlebars.min.js"></script>
<script src="/bower_components/jquery/dist/jquery.min.js"></script>
<script src="/bower_components/fabric/dist/fabric.min.js"></script>
<script src="/bower_components/tinycolor/tinycolor.js"></script>
<script src="/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="/bower_components/bootstrap-select/dist/js/bootstrap-select.min.js"></script>
<script src="/js/application.js"></script>
<script src="/js/grapher.js"></script>
<!-- endinject --> <!-- endinject -->
</body> </body>
</html> </html>