mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-28 22:08:17 +02:00
Show a preview image in builtin attachment select autocomplete.
This commit is contained in:
parent
aa95f130db
commit
f0d0a78f65
6 changed files with 65 additions and 6 deletions
|
@ -772,6 +772,9 @@ div.dataTables_wrapper div.dataTables_info {
|
|||
-webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2);
|
||||
-moz-box-shadow: 0 5px 10px rgba(0,0,0,.2);
|
||||
box-shadow: 0 5px 10px rgba(0,0,0,.2);
|
||||
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.tt-suggestion {
|
||||
|
@ -874,4 +877,11 @@ div.dataTables_wrapper div.dataTables_info {
|
|||
|
||||
.carousel:hover .carousel-control {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
/***********************************************
|
||||
* Typeahead image
|
||||
***********************************************/
|
||||
.typeahead-image {
|
||||
width: 100%;
|
||||
}
|
|
@ -432,6 +432,7 @@ $(document).on("ajaxUI:reload ajaxUI:start attachment:create", function () {
|
|||
}
|
||||
});
|
||||
|
||||
//@ts-ignore
|
||||
$(this).typeahead({
|
||||
hint: true,
|
||||
highlight: true,
|
||||
|
@ -439,7 +440,18 @@ $(document).on("ajaxUI:reload ajaxUI:start attachment:create", function () {
|
|||
},
|
||||
{
|
||||
name: 'states',
|
||||
source: engine
|
||||
source: engine,
|
||||
limit: 250,
|
||||
templates: {
|
||||
suggestion: function(data) {
|
||||
if (typeof data === "string") {
|
||||
return "<div>" + data + "</div>";
|
||||
} else if(typeof data === "object" && typeof data.image === "string") {
|
||||
return "<div class='row m-0'><div class='col-2 pl-0 pr-1'><img class='typeahead-image' src='" + data.image + "'/></div><div class='col-10'>" + data.name + "</div></div>"
|
||||
}
|
||||
},
|
||||
},
|
||||
display: 'name',
|
||||
});
|
||||
|
||||
//Make the typeahead input fill the container (remove block-inline attr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue