Commit 90e76b2b authored by Ryan Herbert's avatar Ryan Herbert

app.js autocomplete.js and views, add autocompletion to views

autocomplete.js contains a binding function to bind the autocomplete
library to a DOM element.

The views then call this function when they are focused
parent 6bb77b76
......@@ -61,6 +61,7 @@ function loadAfterConf() {
"../similarity",
"../tools",
"../url",
"../autocomplete",
// Speed test
"../speed_test",
"../../test/QUnit/testFiles/data_test",
......
/* This file is part of Vidjil <http://www.vidjil.org>,
* High-throughput Analysis of V(D)J Immune Repertoire.
* Copyright (C) 2013-2017 by Bonsai bioinformatics
* at CRIStAL (UMR CNRS 9189, Université Lille) and Inria Lille
* Contributors:
* Marc Duez <marc.duez@vidjil.org>
* The Vidjil Team <contact@vidjil.org>
*
* "Vidjil" is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* "Vidjil" is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with "Vidjil". If not, see <http://www.gnu.org/licenses/>
*/
function init_autocomplete(elem) {
var service = 'tag/auto_complete';
var address = db.db_address + service;
$(elem).autocomplete({'serviceUrl': address,
'dataType': 'json',
'params': {'group_id': 10},
'delimiter': /[,\.-_=+()$%^&*!@\[\]\{\}\"|'?\\\/><\s]/
});
}
......@@ -32,7 +32,7 @@
</tr>
<tr>
<td><label for="patient_info" id="patient_info__label">Info: </label></td>
<td><textarea class="text" cols="40" id="patient_info" name="info" rows="10"></textarea></td>
<td><textarea onfocus="init_autocomplete(this);" class="text" cols="40" id="patient_info" name="info" rows="10"></textarea></td>
<td></td>
</tr>
<tr>
......
......@@ -30,7 +30,7 @@ info = db.patient[request.vars["id"]]
</tr>
<tr>
<td> <label for="patient_info" id="patient_info__label">Info: </label> </td>
<td> <textarea class="text" cols="40" id="patient_info" name="info" rows="10">{{=info.info}}</textarea> </td>
<td> <textarea onfocus="init_autocomplete(this);" class="text" cols="40" id="patient_info" name="info" rows="10">{{=info.info}}</textarea> </td>
<td></td>
</tr>
<tr>
......
......@@ -27,7 +27,7 @@
</tr>
<tr>
<td><label for="run_info" id="run_info__label">Info: </label></td>
<td><textarea class="text" cols="60" id="run_info" name="info" rows="10"></textarea></td>
<td><textarea onfocus="init_autocomplete(this);" class="text" cols="60" id="run_info" name="info" rows="10"></textarea></td>
<td></td>
</tr>
<tr>
......
......@@ -25,7 +25,7 @@ info = db.run[request.vars["id"]]
</tr>
<tr>
<td> <label for="run_info" id="run_info__label">Info: </label> </td>
<td> <textarea class="text" cols="60" id="run_info" name="info" rows="10">{{=info.info}}</textarea> </td>
<td> <textarea onfocus="init_autocomplete(this);" class="text" cols="60" id="run_info" name="info" rows="10">{{=info.info}}</textarea> </td>
<td></td>
</tr>
<tr>
......
......@@ -17,7 +17,7 @@
</tr>
<tr>
<td><label for="sample_set_info" id="sample_set_info__label">Info: </label></td>
<td><textarea class="text" cols="60" id="sample_set_info" name="info" rows="10"></textarea></td>
<td><textarea onfocus="init_autocomplete(this);" class="text" cols="60" id="sample_set_info" name="info" rows="10"></textarea></td>
<td></td>
</tr>
<tr>
......
......@@ -15,7 +15,7 @@ info = db.generic[request.vars["id"]]
</tr>
<tr>
<td> <label for="sample_set_info" id="sample_set_info__label">Info: </label> </td>
<td> <textarea class="text" cols="60" id="sample_set_info" name="info" rows="10">{{=info.info}}</textarea> </td>
<td> <textarea onfocus="init_autocomplete(this);" class="text" cols="60" id="sample_set_info" name="info" rows="10">{{=info.info}}</textarea> </td>
<td></td>
</tr>
<tr>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment