Home: Change single entry to have its own portlet to immediately reflect change of selected entry.

This commit is contained in:
nathan 2023-03-16 13:39:01 -06:00
parent 7c229e1df3
commit 9f2481e90c
3 changed files with 45 additions and 1 deletions

View File

@ -214,6 +214,7 @@ class home_link_portlet extends home_portlet
return $actions;
}
/**
* This portlet accepts files and links
*
@ -221,6 +222,11 @@ class home_link_portlet extends home_portlet
*/
public function accept_drop()
{
return array('file','link');
return array('file', 'link');
}
public function get_type()
{
return "et2-portlet-link";
}
}

37
home/js/Et2PortletLink.ts Normal file
View File

@ -0,0 +1,37 @@
import {Et2Portlet} from "../../api/js/etemplate/Et2Portlet/Et2Portlet";
import shoelace from "../../api/js/etemplate/Styles/shoelace";
import {css} from "@lion/core";
import {SelectOption} from "../../api/js/etemplate/Et2Select/FindSelectOptions";
/**
* Home portlet to show a list of entries
*/
export class Et2PortletLink extends Et2Portlet
{
static get styles()
{
return [
...shoelace,
...(super.styles || []),
css`
`
]
}
/**
* Get a list of user-configurable properties
* @returns {[{name : string, type : string, select_options? : [SelectOption]}]}
*/
get portletProperties() : { name : string, type : string, label : string, select_options? : SelectOption[] }[]
{
return [
...super.portletProperties,
{name: "entry", type: "et2-link-entry", label: "Entry"}
]
}
}
if(!customElements.get("et2-portlet-link"))
{
customElements.define("et2-portlet-link", Et2PortletLink);
}

View File

@ -14,6 +14,7 @@ import {etemplate2} from "../../api/js/etemplate/etemplate2";
import {Et2Portlet} from "../../api/js/etemplate/Et2Portlet/Et2Portlet";
import {Et2PortletFavorite} from "./Et2PortletFavorite";
import {loadWebComponent} from "../../api/js/etemplate/Et2Widget/Et2Widget";
import "./Et2PortletLink";
import "./Et2PortletList";
import "./Et2PortletNote";
import './Et2PortletWeather';