From 82215f292dbe79fe4a68961f4e6167e836f66a36 Mon Sep 17 00:00:00 2001 From: nathangray Date: Fri, 22 May 2020 10:50:36 -0600 Subject: [PATCH] Api: Fix some favorite widget bugs - Infolog preferred favorite was not loaded - Fixed vertical alignment of widget 'Add current' icon --- api/js/etemplate/et2_extension_nextmatch.js | 5 ++--- api/js/etemplate/et2_extension_nextmatch.ts | 5 ++--- api/js/etemplate/et2_widget_favorites.js | 2 +- api/js/etemplate/et2_widget_favorites.ts | 2 +- api/templates/default/etemplate2.css | 7 +++++++ infolog/inc/class.infolog_hooks.inc.php | 2 +- 6 files changed, 14 insertions(+), 9 deletions(-) diff --git a/api/js/etemplate/et2_extension_nextmatch.js b/api/js/etemplate/et2_extension_nextmatch.js index 786d55d327..4f4cc04ead 100644 --- a/api/js/etemplate/et2_extension_nextmatch.js +++ b/api/js/etemplate/et2_extension_nextmatch.js @@ -2435,12 +2435,11 @@ var et2_nextmatch_header_bar = /** @class */ (function (_super) { // No favorites configured return; } - var list = et2_csvSplit(this.options.get_rows, 2, "."); var widget_options = { default_pref: "nextmatch-" + this.nextmatch.options.settings.columnselection_pref + "-favorite", - app: list[0], + app: this.getInstanceManager().app, filters: filters, - sidebox_target: 'favorite_sidebox_' + list[0] + sidebox_target: 'favorite_sidebox_' + this.getInstanceManager().app }; this.favorites = et2_createWidget('favorites', widget_options, this); // Add into header diff --git a/api/js/etemplate/et2_extension_nextmatch.ts b/api/js/etemplate/et2_extension_nextmatch.ts index 4158dd5566..1f7b21c5cf 100644 --- a/api/js/etemplate/et2_extension_nextmatch.ts +++ b/api/js/etemplate/et2_extension_nextmatch.ts @@ -3140,12 +3140,11 @@ class et2_nextmatch_header_bar extends et2_DOMWidget implements et2_INextmatchHe return; } - const list = et2_csvSplit(this.options.get_rows, 2, "."); const widget_options = { default_pref: "nextmatch-" + this.nextmatch.options.settings.columnselection_pref + "-favorite", - app: list[0], + app: this.getInstanceManager().app, filters: filters, - sidebox_target: 'favorite_sidebox_' + list[0] + sidebox_target: 'favorite_sidebox_' + this.getInstanceManager().app }; this.favorites = et2_createWidget('favorites', widget_options, this); diff --git a/api/js/etemplate/et2_widget_favorites.js b/api/js/etemplate/et2_widget_favorites.js index 3c893f5804..3ae3c33e07 100644 --- a/api/js/etemplate/et2_widget_favorites.js +++ b/api/js/etemplate/et2_widget_favorites.js @@ -107,7 +107,7 @@ var et2_favorites = /** @class */ (function (_super) { self.preferred = jQuery(this).val(); // Update sidebox, if there if (self.sidebox_target.length) { - self.sidebox_target.find("div.ui-icon-heart") + jQuery("div.ui-icon-heart", self.sidebox_target) .replaceWith("
"); jQuery("li[data-id='" + self.preferred + "'] div.sideboxstar", self.sidebox_target) .replaceWith("
"); diff --git a/api/js/etemplate/et2_widget_favorites.ts b/api/js/etemplate/et2_widget_favorites.ts index 49b302bcfe..89336232c8 100644 --- a/api/js/etemplate/et2_widget_favorites.ts +++ b/api/js/etemplate/et2_widget_favorites.ts @@ -151,7 +151,7 @@ class et2_favorites extends et2_dropdown_button implements et2_INextmatchHeader // Update sidebox, if there if(self.sidebox_target.length) { - self.sidebox_target.find("div.ui-icon-heart") + jQuery("div.ui-icon-heart", self.sidebox_target) .replaceWith("
"); jQuery("li[data-id='"+self.preferred+"'] div.sideboxstar",self.sidebox_target) .replaceWith("
"); diff --git a/api/templates/default/etemplate2.css b/api/templates/default/etemplate2.css index 2e8e6edc0b..e0eaddbe21 100644 --- a/api/templates/default/etemplate2.css +++ b/api/templates/default/etemplate2.css @@ -1814,6 +1814,13 @@ div.message.floating { .favorites img { margin-right: 1ex; } +.favorites li.ui-menu-item img { + width: 12px; + height: 12px; + margin-top: -3px; + margin-left: 2px; + vertical-align: middle; +} .favorites div.ui-icon-trash { position: relative; float: right; diff --git a/infolog/inc/class.infolog_hooks.inc.php b/infolog/inc/class.infolog_hooks.inc.php index e73c428a11..ad86507066 100644 --- a/infolog/inc/class.infolog_hooks.inc.php +++ b/infolog/inc/class.infolog_hooks.inc.php @@ -90,7 +90,7 @@ class infolog_hooks if ($location == 'sidebox_menu') { // Magic etemplate2 favorites menu (from nextmatch widget) - display_sidebox($appname, lang('Favorites'), Framework\Favorites::list_favorites($appname)); + display_sidebox($appname, lang('Favorites'), Framework\Favorites::list_favorites($appname, 'nextmatch-nextmatch-infolog.index.rows-favorite')); $file = array( 'infolog list' => Egw::link('/index.php',array(