owner filter works with autocomplete awesomeness
This commit is contained in:
parent
95f51b61ce
commit
d995ec19d1
3 changed files with 107 additions and 2 deletions
|
|
@ -10,6 +10,13 @@ input.disabled {
|
|||
color: #555;
|
||||
}
|
||||
|
||||
.with_avatar {
|
||||
background-position: 0 0;
|
||||
background-repeat: no-repeat;
|
||||
padding-left: 50px;
|
||||
min-height: 50px;
|
||||
}
|
||||
|
||||
#wrapper {
|
||||
position: relative;
|
||||
margin-left: 165px; /* move out of the adminbar's way */
|
||||
|
|
@ -168,7 +175,9 @@ input.disabled {
|
|||
display: block;
|
||||
}
|
||||
|
||||
#searchFilters span {
|
||||
#searchFilters li { height: 28px; } /* autocomplete is position: absolute, so pretend some height */
|
||||
|
||||
#searchFilters span.name {
|
||||
display: block;
|
||||
float: left;
|
||||
width: 9%;
|
||||
|
|
@ -181,12 +190,25 @@ input.disabled {
|
|||
clear: both;
|
||||
}
|
||||
|
||||
.filter_title input {
|
||||
.filter_title input, .filter_ownerUserId div.autocomplete {
|
||||
display: block;
|
||||
float: left;
|
||||
width: 89%;
|
||||
}
|
||||
|
||||
#searchFilters .yui-ac-bd li {
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.autocomplete_value {
|
||||
font-size: larger;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.autocomplete_subtext {
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
#wrapper .yui-content {
|
||||
margin: 0; padding: 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1158,6 +1158,7 @@ WebGUI.Admin.LocationBar.prototype.addFilter
|
|||
|
||||
var name = menuitem.cfg.getProperty('text');
|
||||
var nameElem = document.createElement('span');
|
||||
nameElem.className = "name";
|
||||
nameElem.appendChild( document.createTextNode( name ) );
|
||||
li.appendChild( nameElem );
|
||||
|
||||
|
|
@ -1169,6 +1170,48 @@ WebGUI.Admin.LocationBar.prototype.addFilter
|
|||
YAHOO.util.Event.on( inputElem, 'keyup', this.updateLocationBarQuery, this, true );
|
||||
inputElem.focus();
|
||||
}
|
||||
else if ( filter.type == "ownerUserId" ) {
|
||||
var container = document.createElement( 'div' );
|
||||
container.className = "autocomplete";
|
||||
li.appendChild( container );
|
||||
|
||||
var inputElem = document.createElement('input');
|
||||
filter.inputElem = inputElem;
|
||||
inputElem.type = "text";
|
||||
container.appendChild( inputElem );
|
||||
filter.dataSource = new YAHOO.util.XHRDataSource( '?op=admin;method=findUser;' );
|
||||
filter.dataSource.responseType = YAHOO.util.XHRDataSource.TYPE_JSON;
|
||||
filter.dataSource.responseSchema = {
|
||||
resultsList : "results",
|
||||
fields : [ 'username', 'name', 'userId', 'avatar', 'email' ]
|
||||
};
|
||||
|
||||
// Auto-complete container
|
||||
var acDiv = document.createElement('div');
|
||||
filter.acDiv = acDiv;
|
||||
container.appendChild( acDiv );
|
||||
|
||||
filter.autocomplete = new YAHOO.widget.AutoComplete( inputElem, acDiv, filter.dataSource );
|
||||
filter.autocomplete.queryQuestionMark = false;
|
||||
filter.autocomplete.animVert = true;
|
||||
filter.autocomplete.animSpeed = 0.1;
|
||||
filter.autocomplete.minQueryLength = 1;
|
||||
filter.autocomplete.queryDelay = 0.2;
|
||||
filter.autocomplete.typeAhead = true;
|
||||
filter.autocomplete.resultTypeList = false;
|
||||
filter.autocomplete.applyLocalFilter = true;
|
||||
filter.autocomplete.formatResult = function ( result, query, match ) {
|
||||
var subtext = ( result.name ? result.name : "" )
|
||||
+ ( result.email ? " <" + result.email + ">" : "" )
|
||||
;
|
||||
return '<div style="float: left; width: 50px; height: 50px; background: url(' + result.avatar + ') no-repeat 50% 50%;"></div>'
|
||||
+ '<div class="autocomplete_value">' + result.username + "</div>"
|
||||
+ '<div class="autocomplete_subtext">' + subtext + '</div>';
|
||||
|
||||
};
|
||||
|
||||
inputElem.focus();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue