From e6467850c3c568d2971ef6fc1b401dc9de336c36 Mon Sep 17 00:00:00 2001 From: maurofmferrao Date: Mon, 4 Nov 2024 11:07:41 +0000 Subject: [PATCH] Toolbox: Add description to module templates relates to xibosignageltd/xibo-private#851 --- lib/Entity/ModuleTemplate.php | 6 +++++ lib/Factory/ModuleTemplateFactory.php | 1 + ui/src/editor-core/toolbar.js | 6 +++++ ui/src/layout-editor/main.js | 4 ++-- ui/src/style/common.scss | 23 +++++++++++++++++++ ui/src/templates/toolbar-card-item.hbs | 5 ++-- .../toolbar-card-layout-template.hbs | 7 +++--- .../toolbar-card-media-placeholder.hbs | 4 ++-- .../templates/toolbar-card-media-upload.hbs | 4 ++-- ui/src/templates/toolbar-card-media.hbs | 7 +++--- .../toolbar-card-playlist-new-template.hbs | 4 ++-- .../toolbar-card-playlist-template.hbs | 8 ++++--- ui/src/templates/toolbar-card-stencil.hbs | 5 ++-- ui/src/templates/toolbar-card-template.hbs | 4 +++- ui/src/templates/toolbar-card.hbs | 8 +++---- ui/src/templates/toolbar-content-group.hbs | 2 +- ui/src/templates/toolbar-content-submenu.hbs | 2 +- .../templates/toolbar-media-preview-info.hbs | 2 +- 18 files changed, 73 insertions(+), 29 deletions(-) diff --git a/lib/Entity/ModuleTemplate.php b/lib/Entity/ModuleTemplate.php index 30f3975c1a..bc1df3c9bb 100644 --- a/lib/Entity/ModuleTemplate.php +++ b/lib/Entity/ModuleTemplate.php @@ -70,6 +70,12 @@ class ModuleTemplate implements \JsonSerializable */ public $title; + /** + * @SWG\Property(description="Description of the Module Template") + * @var string + */ + public $description; + /** * @SWG\Property() * @var string Icon diff --git a/lib/Factory/ModuleTemplateFactory.php b/lib/Factory/ModuleTemplateFactory.php index 6f18beda0e..6a6e967300 100644 --- a/lib/Factory/ModuleTemplateFactory.php +++ b/lib/Factory/ModuleTemplateFactory.php @@ -414,6 +414,7 @@ private function createFromXml(\DOMElement $xml, string $ownership, string $file $template->type = $this->getFirstValueOrDefaultFromXmlNode($xml, 'type'); $template->dataType = $this->getFirstValueOrDefaultFromXmlNode($xml, 'dataType'); $template->title = __($this->getFirstValueOrDefaultFromXmlNode($xml, 'title')); + $template->description = __($this->getFirstValueOrDefaultFromXmlNode($xml, 'description')); $template->thumbnail = $this->getFirstValueOrDefaultFromXmlNode($xml, 'thumbnail'); $template->icon = $this->getFirstValueOrDefaultFromXmlNode($xml, 'icon'); $template->isVisible = $this->getFirstValueOrDefaultFromXmlNode($xml, 'isVisible') !== 'false'; diff --git a/ui/src/editor-core/toolbar.js b/ui/src/editor-core/toolbar.js index 6d6968d5c8..53fb5911d5 100644 --- a/ui/src/editor-core/toolbar.js +++ b/ui/src/editor-core/toolbar.js @@ -1312,6 +1312,9 @@ Toolbar.prototype.createContent = function( // Adapt card behaviour to current tab self.handleCardsBehaviour(); + // Reload tooltips + app.common.reloadTooltips(self.DOMObject); + return; } @@ -3285,6 +3288,9 @@ Toolbar.prototype.handleCardsBehaviour = function() { } }); } + + // Reload tooltips + app.common.reloadTooltips(self.DOMObject); }; /** diff --git a/ui/src/layout-editor/main.js b/ui/src/layout-editor/main.js index 26a7dd6535..b5d681c727 100644 --- a/ui/src/layout-editor/main.js +++ b/ui/src/layout-editor/main.js @@ -2316,7 +2316,7 @@ lD.dropItemAdd = function(droppable, draggable, dropPosition) { extendsOverride: draggableData.extendsOverride, extendsOverrideId: draggableData.extendsOverrideId, mediaId: draggableData.mediaId, - mediaName: draggableData.title, + mediaName: draggableData.cardTitle, isVisible: draggableData.isVisible, }; @@ -2511,7 +2511,7 @@ lD.dropItemAdd = function(droppable, draggable, dropPosition) { const onUploadDone = function(data) { // Add media id to data draggableData.mediaId = data.response().result.files[0].mediaId; - draggableData.title = data.response().result.files[0].name; + draggableData.cardTitle = data.response().result.files[0].name; }; lD.openUploadForm({ diff --git a/ui/src/style/common.scss b/ui/src/style/common.scss index 72b4d9fc4a..9e39bf6b07 100644 --- a/ui/src/style/common.scss +++ b/ui/src/style/common.scss @@ -83,6 +83,29 @@ $fa-font-path: "~font-awesome/fonts"; } } +/* Tooltip colour */ +div.tooltip.bs-tooltip-auto { + .tooltip-inner { + background-color: darken($xibo-color-secondary, 10%); + } + + &[x-placement^=right] .arrow::before { + border-right-color: darken($xibo-color-secondary, 10%); + } + + &[x-placement^=left] .arrow::before { + border-left-color: darken($xibo-color-secondary, 10%); + } + + &[x-placement^=top] .arrow::before { + border-top-color: darken($xibo-color-secondary, 10%); + } + + &[x-placement^=bottom] .arrow::before { + border-bottom-color: darken($xibo-color-secondary, 10%); + } +} + .no-user-select { @include user-select-none(); } diff --git a/ui/src/templates/toolbar-card-item.hbs b/ui/src/templates/toolbar-card-item.hbs index 46ba53443d..e38661c394 100644 --- a/ui/src/templates/toolbar-card-item.hbs +++ b/ui/src/templates/toolbar-card-item.hbs @@ -1,5 +1,4 @@
{{/if}} -
+
{{title}}
\ No newline at end of file diff --git a/ui/src/templates/toolbar-card-layout-template.hbs b/ui/src/templates/toolbar-card-layout-template.hbs index 482f22f95c..7fd87c5c36 100644 --- a/ui/src/templates/toolbar-card-layout-template.hbs +++ b/ui/src/templates/toolbar-card-layout-template.hbs @@ -3,9 +3,10 @@ data-target="layout" data-template-id="{{id}}" data-data-type="{{dataType}}" - data-title="{{title}}" data-source="{{#if provider}}remote{{else}}local{{/if}}" - data-download="{{download}}"> + data-download="{{download}}" + data-card-title="{{title}}" + data-toggle="tooltip" data-title="{{description}}">
{{title}} @@ -28,7 +29,7 @@
{{/if}}
- {{title}} + {{title}}
{{#if orientation}} diff --git a/ui/src/templates/toolbar-card-media-placeholder.hbs b/ui/src/templates/toolbar-card-media-placeholder.hbs index a1a1f8cb51..23fb2abfd1 100644 --- a/ui/src/templates/toolbar-card-media-placeholder.hbs +++ b/ui/src/templates/toolbar-card-media-placeholder.hbs @@ -1,5 +1,4 @@
+ data-card-title="{{title}}" + data-toggle="tooltip" data-title="{{description}}">
diff --git a/ui/src/templates/toolbar-card-media-upload.hbs b/ui/src/templates/toolbar-card-media-upload.hbs index 906cb80527..d52078cfe8 100644 --- a/ui/src/templates/toolbar-card-media-upload.hbs +++ b/ui/src/templates/toolbar-card-media-upload.hbs @@ -1,5 +1,4 @@
+ data-card-title="{{title}}" + data-toggle="tooltip" data-title="{{description}}">
diff --git a/ui/src/templates/toolbar-card-media.hbs b/ui/src/templates/toolbar-card-media.hbs index 2d1e483f38..62b4395b2e 100644 --- a/ui/src/templates/toolbar-card-media.hbs +++ b/ui/src/templates/toolbar-card-media.hbs @@ -4,8 +4,9 @@ data-sub-type="{{type}}" data-target="{{#if target}}{{target}}{{else}}layout playlist drawer zone{{/if}}" data-data-type="{{dataType}}" - data-title="{{title}}" - data-download="{{download}}"> + data-download="{{download}}" + data-card-title="{{title}}" + data-toggle="tooltip" data-title="{{description}}">
{{#neq thumbnail null}} @@ -50,5 +51,5 @@ {{/if}}
- {{title}} + {{title}}
\ No newline at end of file diff --git a/ui/src/templates/toolbar-card-playlist-new-template.hbs b/ui/src/templates/toolbar-card-playlist-new-template.hbs index d03d0d6edc..ca9b779e47 100644 --- a/ui/src/templates/toolbar-card-playlist-new-template.hbs +++ b/ui/src/templates/toolbar-card-playlist-new-template.hbs @@ -1,10 +1,10 @@
+ data-card-title="{{title}}" + data-toggle="tooltip" data-title="{{description}}">
diff --git a/ui/src/templates/toolbar-card-playlist-template.hbs b/ui/src/templates/toolbar-card-playlist-template.hbs index 8a1abe1ad0..0c7fa1dffa 100644 --- a/ui/src/templates/toolbar-card-playlist-template.hbs +++ b/ui/src/templates/toolbar-card-playlist-template.hbs @@ -3,10 +3,12 @@ data-target="layout zone {{#if editingPlaylist}}playlist{{/if}}" data-sub-type="{{#if editingPlaylist}}subplaylist{{else}}playlist{{/if}}" data-sub-playlist-id="{{playlistId}}" - data-name="{{name}}"> + data-name="{{name}}" + data-card-title="{{title}}" + data-toggle="tooltip" data-title="{{description}}">
- {{name}} + {{name}} {{#if playlistDuration}}
@@ -15,7 +17,7 @@ {{/if}} {{#if isDynamic}} - diff --git a/ui/src/templates/toolbar-content-submenu.hbs b/ui/src/templates/toolbar-content-submenu.hbs index e884390a25..534e435ffe 100644 --- a/ui/src/templates/toolbar-content-submenu.hbs +++ b/ui/src/templates/toolbar-content-submenu.hbs @@ -4,7 +4,7 @@
- {{data.title}} + {{data.cardTitle}}
diff --git a/ui/src/templates/toolbar-media-preview-info.hbs b/ui/src/templates/toolbar-media-preview-info.hbs index ae49992615..afbffa0725 100644 --- a/ui/src/templates/toolbar-media-preview-info.hbs +++ b/ui/src/templates/toolbar-media-preview-info.hbs @@ -1,5 +1,5 @@
- {{data.title}} + {{data.cardTitle}} {{#if data.width}}