Commit f749b3c2 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge remote-tracking branch 'origin/raos_work' into crose_work

parents 393f1232 31a43028
......@@ -24,7 +24,7 @@ var QfqNS = QfqNS || {};
*/
n.TypeAhead.install = function (typeahead_endpoint) {
$('.qfq-type-ahead').each(function () {
$('.qfq-typeahead').each(function () {
var $element = $(this);
var suggestions = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('key', 'value'),
......@@ -48,6 +48,7 @@ var QfqNS = QfqNS || {};
{
display: 'value',
source: suggestions,
limit: n.TypeAhead.getLimit($element),
templates: {
suggestion: function (obj) {
return "<div>" + n.TypeAhead.htmlEncode(obj.value) + "</div>";
......@@ -69,8 +70,12 @@ var QfqNS = QfqNS || {};
return endpoint + "?query=%QUERY" + "&sip=" + n.TypeAhead.getSip(element);
};
n.TypeAhead.getLimit = function ($element) {
return $element.data('typeahead-limit');
};
n.TypeAhead.getSip = function ($element) {
return $element.data('sip');
return $element.data('typeahead-sip');
};
n.TypeAhead.getName = function ($element) {
......@@ -82,15 +87,15 @@ var QfqNS = QfqNS || {};
};
n.TypeAhead.getMinLength = function ($element) {
return $element.data('ta-min-length') || 2;
return $element.data('typeahead-minlength') || 2;
};
n.TypeAhead.getHighlight = function ($element) {
return $element.data('ta-higlight') || true;
return $element.data('typeahead-highlight') || true;
};
n.TypeAhead.getHint = function ($element) {
return $element.data('ta-hint') || true;
return $element.data('typeahead-hint') || true;
};
n.TypeAhead.htmlEncode = function (value) {
......
......@@ -88,8 +88,8 @@
</div>
<div class="col-md-6">
<input id="dropdown1" type="text" class="form-control qfq-type-ahead" name="dropdown1"
data-sip="abcde" data-template="template1">
<input id="dropdown1" type="text" class="form-control qfq-typeahead" name="dropdown1"
data-typeahead-sip="abcde" data-template="template1">
</div>
</div>
......@@ -100,8 +100,8 @@
</div>
<div class="col-md-6">
<input id="dropdown2" type="text" class="form-control qfq-type-ahead" name="dropdown2"
data-sip="abcdef">
<input id="dropdown2" type="text" class="form-control qfq-typeahead" name="dropdown2"
data-typeahead-sip="abcdef">
</div>
</div>
......
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