aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2011-11-18 07:18:54 +0100
committerSem <sembrestels@riseup.net>2011-11-18 07:18:54 +0100
commitdc565af2c01c94e0b6c6510c59c77f660f3938be (patch)
treeef5bf12d43ee63212ef333e3e1cb3500679b2e27
parente4f0cbb222ee39a1d1d21f0d69c39bcc6df9d452 (diff)
downloadelgg-dc565af2c01c94e0b6c6510c59c77f660f3938be.tar.gz
elgg-dc565af2c01c94e0b6c6510c59c77f660f3938be.tar.bz2
Revert "Refs #2102. Autocomplete is working now."
This reverts commit e4f0cbb222ee39a1d1d21f0d69c39bcc6df9d452.
-rw-r--r--js/lib/autocomplete.js31
-rw-r--r--views/default/css/elements/forms.php5
2 files changed, 9 insertions, 27 deletions
diff --git a/js/lib/autocomplete.js b/js/lib/autocomplete.js
index 748070eaa..917326d4f 100644
--- a/js/lib/autocomplete.js
+++ b/js/lib/autocomplete.js
@@ -5,35 +5,18 @@ elgg.provide('elgg.autocomplete');
elgg.autocomplete.init = function() {
$('.elgg-input-autocomplete').autocomplete({
- source: function( request, response ) {
- $.ajax({
- url: elgg.autocomplete.url, //gets set by input/autocomplete
- dataType: "json",
- data: {
- q: request.term
- },
- success: function( data ) {
- response( $.map( data, function( item ) {
- item.value = item.name;
- return item;
- }));
- }
- })
- },
+ source: elgg.autocomplete.url, //gets set by input/autocomplete
minLength: 1,
select: function(event, ui) {
var item = ui.item;
- item.value = item.name;
-
- if($(this).next().attr('type') == "hidden"){
- var hidden = $(this).next();
- } else {
- var hidden = $(this).after('<input type="hidden" name="'+this.name+'[]" />').next();
- }
+ $(this).val(item.name);
+
+ var hidden = $(this).next();
hidden.val(item.guid);
}
})
+ //@todo This seems convoluted
.data("autocomplete")._renderItem = function(ul, item) {
switch (item.type) {
case 'user':
@@ -48,9 +31,9 @@ elgg.autocomplete.init = function() {
return $("<li/>")
.data("item.autocomplete", item)
- .append('<a>'+r+'</a>')
+ .append(r)
.appendTo(ul);
};
};
-elgg.register_hook_handler('init', 'system', elgg.autocomplete.init);
+elgg.register_hook_handler('init', 'system', elgg.autocomplete.init); \ No newline at end of file
diff --git a/views/default/css/elements/forms.php b/views/default/css/elements/forms.php
index 0b88c6bda..e5ffb8af2 100644
--- a/views/default/css/elements/forms.php
+++ b/views/default/css/elements/forms.php
@@ -352,7 +352,7 @@ input[type="radio"] {
margin: 0;
}
-.ui-autocomplete li a {
+.ui-autocomplete li {
margin: 0px;
padding: 2px 5px;
cursor: default;
@@ -380,10 +380,9 @@ input[type="radio"] {
background-color: #eee;
}
-.ui-autocomplete .ui-state-hover {
+.ui-autocomplete li:hover {
background-color: #4690D6;
color: white;
- text-decoration: none;
}
.ui-autocomplete strong {