Cleanup of client code
This commit is contained in:
parent
2d378e83c9
commit
c920a5ac70
@ -92,7 +92,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<script id="template" type="text/x-handlers-template">
|
<script id="template" type="text/x-handlers-template">
|
||||||
{{#if results}}
|
{{#if records}}
|
||||||
<table class="table table-striped table-condensed">
|
<table class="table table-striped table-condensed">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -104,7 +104,7 @@
|
|||||||
<th>Score</th>
|
<th>Score</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{{#each results}}
|
{{#each records}}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="javascript:accessReview({{id}});">{{name}}</a></td>
|
<td><a href="javascript:accessReview({{id}});">{{name}}</a></td>
|
||||||
<td>{{distanceToUser}} km</td>
|
<td>{{distanceToUser}} km</td>
|
||||||
@ -117,7 +117,7 @@
|
|||||||
</table>
|
</table>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</script>
|
</script>
|
||||||
<div id="results"></div>
|
<div id="records"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@
|
|||||||
var _canvas = params.canvas;
|
var _canvas = params.canvas;
|
||||||
var _columns = {};
|
var _columns = {};
|
||||||
var _data = {};
|
var _data = {};
|
||||||
var _range = new Range(params.range.min || -1.0, params.range.max || 1.0);
|
var _range = new Range(-1.0, 1.0);
|
||||||
var _steps = params.steps || 20;
|
var _steps = params.steps || 20;
|
||||||
var _useLocalScale = params.useLocalScale || false;
|
var _useLocalScale = params.useLocalScale || false;
|
||||||
var _displayType = params.displayType || 'density';
|
var _displayType = params.displayType || 'density';
|
||||||
@ -320,7 +320,7 @@
|
|||||||
for (var name in columns) {
|
for (var name in columns) {
|
||||||
var column = columns[name];
|
var column = columns[name];
|
||||||
for (var i = 0, count = column.hints.length; i < count; ++i) {
|
for (var i = 0, count = column.hints.length; i < count; ++i) {
|
||||||
column.hints[i].rating = column.hints[i].stats[statKey];
|
column.hints[i].rating = column.hints[i][statKey];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,6 @@
|
|||||||
function onSearch() {
|
function onSearch() {
|
||||||
_ctx.query = {
|
_ctx.query = {
|
||||||
features: _ctx.query.features || {},
|
features: _ctx.query.features || {},
|
||||||
range: {min: -1.0, max: 1.0},
|
|
||||||
profile: getProfile(),
|
profile: getProfile(),
|
||||||
walkingDist: parseFloat($('#walkingDist').val()),
|
walkingDist: parseFloat($('#walkingDist').val()),
|
||||||
minScore: parseFloat($('#minScore').val()),
|
minScore: parseFloat($('#minScore').val()),
|
||||||
@ -83,7 +82,6 @@
|
|||||||
_ctx.grapher = new grapher.Grapher({
|
_ctx.grapher = new grapher.Grapher({
|
||||||
canvas: new Snap('#svg'),
|
canvas: new Snap('#svg'),
|
||||||
steps: _ctx.query.hintSteps,
|
steps: _ctx.query.hintSteps,
|
||||||
range: _ctx.query.range,
|
|
||||||
onValueChanged: onAdjust,
|
onValueChanged: onAdjust,
|
||||||
displayType: $('#displayType').val(),
|
displayType: $('#displayType').val(),
|
||||||
useLocalScale: $('#useLocalScale').is(':checked')
|
useLocalScale: $('#useLocalScale').is(':checked')
|
||||||
@ -132,21 +130,21 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
_ctx.grapher.setColumns(columns);
|
_ctx.grapher.setColumns(columns);
|
||||||
outputMatches(results.items, results.count);
|
outputMatches(results.records, results.count);
|
||||||
}
|
}
|
||||||
|
|
||||||
function outputMatches(results, count) {
|
function outputMatches(records, count) {
|
||||||
var searchResultCnt = String(results.length);
|
var searchResultCnt = String(records.length);
|
||||||
if (results.length < count) {
|
if (records.length < count) {
|
||||||
searchResultCnt += ' of ' + count;
|
searchResultCnt += ' of ' + count;
|
||||||
}
|
}
|
||||||
$('#resultCount').text(searchResultCnt);
|
$('#resultCount').text(searchResultCnt);
|
||||||
|
|
||||||
var template = Handlebars.compile($('#template').html());
|
var template = Handlebars.compile($('#template').html());
|
||||||
$('#results').empty();
|
$('#records').empty();
|
||||||
$('#results').append(template({results: results}));
|
$('#records').append(template({records: records}));
|
||||||
|
|
||||||
if (results.length === 0) {
|
if (records.length === 0) {
|
||||||
$('#resultPanel').slideUp();
|
$('#resultPanel').slideUp();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user