You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.3 KiB
Plaintext
48 lines
1.3 KiB
Plaintext
app
|
|
window(each="{windowItem in windows}", router="{parent.router}", window-title="{windowItem.title}", width=640, height=480, x="{windowItem.x}", y="{windowItem.y}", z=0, resizable="true", url="{windowItem.url}")
|
|
notification-box
|
|
|
|
style(type="scss").
|
|
notification-box {
|
|
position: absolute;
|
|
right: 0px;
|
|
bottom: 32px;
|
|
z-index: 2147483640;
|
|
}
|
|
|
|
script.
|
|
let createRouter = require("../../lib/frontend/router");
|
|
|
|
this.mixin(require("../../lib/riot/mixins/on-child"));
|
|
this.mixin(require("riot-query").mixin);
|
|
|
|
this.windows = [
|
|
{ title: "test one", x: 10, y: 10, url: "/?target=Foo" },
|
|
{ title: "test two", x: 200, y: 200, url: "/" },
|
|
{ title: "", x: 390, y: 390, url: "/nodes/create" }
|
|
]
|
|
|
|
let currentZIndex = 0;
|
|
|
|
this.router = createRouter();
|
|
|
|
this.onChild("create:window", (window) => {
|
|
window.on("focused", () => {
|
|
this.query("window").filter((otherWindow) => {
|
|
return otherWindow !== window;
|
|
}).forEach((otherWindow) => {
|
|
otherWindow.defocus();
|
|
});
|
|
|
|
window.setZIndex(currentZIndex++);
|
|
});
|
|
|
|
window.on("requestClose", () => {
|
|
window.reportClose();
|
|
this.windows = this.windows.filter((windowItem) => windowItem !== window._item);
|
|
this.update();
|
|
});
|
|
|
|
window.focus();
|
|
});
|