mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-21 18:39:31 +00:00
Implement hoverpic using stimulus.
This commit is contained in:
parent
9519150fb9
commit
671e0944a2
6 changed files with 25 additions and 10 deletions
20
assets/controllers/elements/hoverpic_controller.js
Normal file
20
assets/controllers/elements/hoverpic_controller.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import {Controller} from "@hotwired/stimulus";
|
||||
import {Popover} from "bootstrap";
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
const thumbnail_url = this.element.dataset.thumbnail;
|
||||
|
||||
this._popover = Popover.getOrCreateInstance(this.element, {
|
||||
html: true,
|
||||
trigger: 'hover',
|
||||
placement: 'right',
|
||||
container: 'body',
|
||||
content: function () {
|
||||
return '<img class="img-fluid" src="' + thumbnail_url + '" />';
|
||||
}
|
||||
});
|
||||
|
||||
this._popover.hide();
|
||||
}
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@ import "bootstrap-fileinput/css/fileinput.css"
|
|||
|
||||
import "bootstrap-fileinput";
|
||||
|
||||
import {Popover} from "bootstrap";
|
||||
|
||||
|
||||
class RegisterEventHelper {
|
||||
|
|
@ -16,8 +17,6 @@ class RegisterEventHelper {
|
|||
this.registerFileInput();
|
||||
|
||||
this.registerSpecialCharInput();
|
||||
|
||||
this.registerHoverPics();
|
||||
}
|
||||
|
||||
registerLoadHandler(fn) {
|
||||
|
|
@ -34,10 +33,6 @@ class RegisterEventHelper {
|
|||
});
|
||||
}
|
||||
|
||||
registerHoverPics() {
|
||||
|
||||
}
|
||||
|
||||
registerFileInput() {
|
||||
this.registerLoadHandler(() => {
|
||||
$(".file").fileinput();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue