Tweak the suggest dialog to display suggestions

This commit is contained in:
Antonin Delpeuch 2018-03-12 15:30:01 +00:00
parent bce7f097dd
commit 6b34af5042
4 changed files with 24 additions and 4 deletions

View File

@ -302,13 +302,17 @@ a.fbs-more-link {
margin: 2px 2px -2px 2px; margin: 2px 2px -2px 2px;
} }
.fbs-item-name label { .fbs-item-name label, .fbs-item-name span {
font-size: 0.9em; font-size: 0.9em;
} }
.fbs-item-name label {
color: black;
}
.fbs-item-type, .fbs-item-type,
.fbs-item-name label { .fbs-item-name label,
.fbs-item-name span {
display: block; display: block;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;

File diff suppressed because one or more lines are too long

View File

@ -725,7 +725,11 @@
var css = this.options.css; var css = this.options.css;
var li = $("<li>").addClass(css.item); var li = $("<li>").addClass(css.item);
var label = $("<label>").text(data.name); var label = $("<label>").text(data.name);
li.append($("<div>").addClass(css.item_name).append(label)); var div = $("<div>").addClass(css.item_name).append(label);
if(data.description) {
div.append($('<span></span>').text(data.description));
}
li.append(div);
return li; return li;
}, },
@ -1291,6 +1295,9 @@
type.text(data.id); type.text(data.id);
} }
name.prepend(type); name.prepend(type);
if(data.description) {
name.append($("<span></span>").text(data.description));
}
//console.log("create_item", li); //console.log("create_item", li);
return li; return li;

View File

@ -74,6 +74,10 @@ var CustomSuggest = {};
); );
data.name = name.text(); // this converts html escaped strings like "&amp;" back to "&" data.name = name.text(); // this converts html escaped strings like "&amp;" back to "&"
if (data.description) {
var descriptionSpan = $("<span></span>").text(data.description);
name.append(descriptionSpan);
}
li.append(name); li.append(name);
name.prepend($("<div>").addClass(css.item_type).text(data.id)); name.prepend($("<div>").addClass(css.item_type).text(data.id));
@ -134,6 +138,11 @@ var CustomSuggest = {};
.append($.suggest.strongify(data.name || data.guid, response_data.prefix))); .append($.suggest.strongify(data.name || data.guid, response_data.prefix)));
data.name = name.text(); // this converts html escaped strings like "&amp;" back to "&" data.name = name.text(); // this converts html escaped strings like "&amp;" back to "&"
if (data.description) {
var descriptionSpan = $("<span></span>").text(data.description);
name.append(descriptionSpan);
}
li.append(name); li.append(name);
name.prepend($("<div>").addClass(css.item_type).text(data.id)); name.prepend($("<div>").addClass(css.item_type).text(data.id));