Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
f749b3c2
Commit
f749b3c2
authored
Mar 15, 2017
by
Carsten Rose
Browse files
Merge remote-tracking branch 'origin/raos_work' into crose_work
parents
393f1232
31a43028
Changes
2
Hide whitespace changes
Inline
Side-by-side
javascript/src/TypeAhead.js
View file @
f749b3c2
...
...
@@ -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
(
'
t
a
-min
-
length
'
)
||
2
;
return
$element
.
data
(
'
t
ypeahead
-minlength
'
)
||
2
;
};
n
.
TypeAhead
.
getHighlight
=
function
(
$element
)
{
return
$element
.
data
(
'
t
a
-higlight
'
)
||
true
;
return
$element
.
data
(
'
t
ypeahead
-hig
h
light
'
)
||
true
;
};
n
.
TypeAhead
.
getHint
=
function
(
$element
)
{
return
$element
.
data
(
'
t
a
-hint
'
)
||
true
;
return
$element
.
data
(
'
t
ypeahead
-hint
'
)
||
true
;
};
n
.
TypeAhead
.
htmlEncode
=
function
(
value
)
{
...
...
mockup/typeahead.html
View file @
f749b3c2
...
...
@@ -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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment