use simple markup to highlight groups in share autocomplete

This commit is contained in:
Morris Jobke 2013-03-22 09:59:19 +01:00
parent 8871629db5
commit 79d99b9c96
2 changed files with 4 additions and 10 deletions

View File

@ -97,7 +97,3 @@
overflow-y:auto; overflow-y:auto;
overflow-x:hidden; overflow-x:hidden;
} }
.ui-menu-item a.ocGroup {
font-weight: bold;
}

View File

@ -238,15 +238,13 @@ OC.Share={
}) })
// customize internal _renderItem function to display groups and users differently // customize internal _renderItem function to display groups and users differently
.data("ui-autocomplete")._renderItem = function( ul, item ) { .data("ui-autocomplete")._renderItem = function( ul, item ) {
var insert = ''; var insert = $( "<a>" ).text( item.label );
if(item.label.length > 8 && item.label.substr(item.label.length-8) === ' (group)') { if(item.label.length > 8 && item.label.substr(item.label.length-8) === ' (group)') {
// current label is group // current label is group - wrap "strong" element
insert = ' class="ocGroup"'; // attribute to insert insert = insert.wrapInner('<strong>');
// remove "(group)"
item.label = item.label.substring(0, item.label.length-8)
} }
return $( "<li>" ) return $( "<li>" )
.append( $( "<a" + insert + ">" ).text( item.label ) ) .append( insert )
.appendTo( ul ); .appendTo( ul );
}; };
} else { } else {