diff --git a/api/js/etemplate/Et2Portlet/Et2Portlet.ts b/api/js/etemplate/Et2Portlet/Et2Portlet.ts index 5410457b41..a79422769b 100644 --- a/api/js/etemplate/Et2Portlet/Et2Portlet.ts +++ b/api/js/etemplate/Et2Portlet/Et2Portlet.ts @@ -21,6 +21,7 @@ import shoelace from "../Styles/shoelace"; import {Et2Dialog} from "../Et2Dialog/Et2Dialog"; import {et2_IResizeable} from "../et2_core_interfaces"; import {HomeApp} from "../../../../home/js/app"; +import {etemplate2} from "../etemplate2"; /** * Participate in Home @@ -181,13 +182,14 @@ export class Et2Portlet extends Et2Widget(SlCard) this.settings = typeof attrs.settings == "string" ? data.value || data.settings || {} : attrs.settings; // Set size & position, if available - if(data && (data.row || data.height)) + // NB: initial load can't find them by entry in array mgr, we check the data directly + if(attrs.row || attrs.height || data.row || data.height) { - this.style.gridRow = (data.row || "auto") + " / span " + (data.height || 1); + this.style.gridRow = (attrs.row || data.row || "auto") + " / span " + (attrs.height || data.height || 1); } - if(data && (data.col || data.width)) + if(attrs.col || attrs.width || data.col || data.width) { - this.style.gridColumn = (data.col || "auto") + " / span " + (data.width || 1); + this.style.gridColumn = (attrs.col || data.col || "auto") + " / span " + (attrs.width || data.width || 1); } } @@ -345,6 +347,9 @@ export class Et2Portlet extends Et2Widget(SlCard) // Update position settings this.update_settings({row: row, col: col, width: width, height: height}); + + // If there's a full etemplate living inside, make it resize + etemplate2.getById(this.id).resize(); } @@ -469,9 +474,6 @@ export class Et2Portlet extends Et2Widget(SlCard) // Only resize once, and only if needed if(data.attributes.width || data.attributes.height) { - this.style.columnSpan = data.attributes.width; - this.style.rowSpan = data.attributes.height; - // Tell children try { diff --git a/calendar/inc/class.calendar_favorite_portlet.inc.php b/calendar/inc/class.calendar_favorite_portlet.inc.php index c945b059b3..44a32fd4f5 100644 --- a/calendar/inc/class.calendar_favorite_portlet.inc.php +++ b/calendar/inc/class.calendar_favorite_portlet.inc.php @@ -15,8 +15,8 @@ use EGroupware\Api\Framework; use EGroupware\Api\Etemplate; /** - * The addressbook_list_portlet uses a nextmatch / favorite - * to display a list of entries. + * The list uses a nextmatch / favorite + * to display a list of entries, but other views do their own things */ class calendar_favorite_portlet extends home_favorite_portlet { @@ -246,7 +246,8 @@ class calendar_favorite_portlet extends home_favorite_portlet return $properties; } - public function get_actions() { + public function get_actions() + { if($this->favorite['state']['view'] == 'listview' || !$this->actions) { return array(); @@ -256,4 +257,9 @@ class calendar_favorite_portlet extends home_favorite_portlet return $this->actions; } } + + public function get_type() + { + return 'et2-portlet-calendar'; + } } diff --git a/calendar/js/Et2PortletCalendar.ts b/calendar/js/Et2PortletCalendar.ts new file mode 100644 index 0000000000..6c16c060a4 --- /dev/null +++ b/calendar/js/Et2PortletCalendar.ts @@ -0,0 +1,26 @@ +import shoelace from "../../api/js/etemplate/Styles/shoelace"; +import {css} from "@lion/core"; +import {Et2PortletFavorite} from "../../home/js/Et2PortletFavorite"; + +/** + * Home portlet to show a note + */ +export class Et2PortletCalendar extends Et2PortletFavorite +{ + static get styles() + { + return [ + ...shoelace, + ...(super.styles || []), + css` + + ` + ] + } + +} + +if(!customElements.get("et2-portlet-calendar")) +{ + customElements.define("et2-portlet-calendar", Et2PortletCalendar); +} \ No newline at end of file diff --git a/calendar/js/et2_widget_timegrid.ts b/calendar/js/et2_widget_timegrid.ts index 59cb08c56c..ff1138bba1 100644 --- a/calendar/js/et2_widget_timegrid.ts +++ b/calendar/js/et2_widget_timegrid.ts @@ -2296,10 +2296,7 @@ export class et2_calendar_timegrid extends et2_calendar_view implements et2_IDet // Take the whole tab height, or home portlet if(this.getInstanceManager().app === 'home') { - var height = jQuery(this.getParent().getDOMNode(this)).parentsUntil('.et2_portlet').last().parent().innerHeight(); - - // Allow for portlet header - height -= jQuery('.ui-widget-header',this.div.parents('.egw_fw_ui_tab_content')).outerHeight(true); + var height = jQuery(this.getParent().getDOMNode(this)).parentsUntil('et2-portlet-calendar').last().innerHeight(); } else { @@ -2324,7 +2321,7 @@ export class et2_calendar_timegrid extends et2_calendar_view implements et2_IDet if(this.getInstanceManager().app === 'home') { - var modify_node = jQuery(this.getParent().getDOMNode(this)).parentsUntil('.et2_portlet').last(); + var modify_node = jQuery(this.getParent().getDOMNode(this)).parentsUntil('et2-portlet-calendar').last(); } else { diff --git a/home/js/app.ts b/home/js/app.ts index 80d5c973b6..a9e8245419 100644 --- a/home/js/app.ts +++ b/home/js/app.ts @@ -16,6 +16,7 @@ import {Et2PortletFavorite} from "./Et2PortletFavorite"; import {loadWebComponent} from "../../api/js/etemplate/Et2Widget/Et2Widget"; import "./Et2PortletList"; import "./Et2PortletNote"; +import "../../calendar/js/Et2PortletCalendar" import Sortable from "sortablejs/modular/sortable.complete.esm.js"; /**