Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toolbox: Add description to module templates #2788

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/Entity/ModuleTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/Factory/ModuleTemplateFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
6 changes: 6 additions & 0 deletions ui/src/editor-core/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1312,6 +1312,9 @@ Toolbar.prototype.createContent = function(
// Adapt card behaviour to current tab
self.handleCardsBehaviour();

// Reload tooltips
app.common.reloadTooltips(self.DOMObject);

return;
}

Expand Down Expand Up @@ -3285,6 +3288,9 @@ Toolbar.prototype.handleCardsBehaviour = function() {
}
});
}

// Reload tooltips
app.common.reloadTooltips(self.DOMObject);
};

/**
Expand Down
4 changes: 2 additions & 2 deletions ui/src/layout-editor/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down Expand Up @@ -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({
Expand Down
23 changes: 23 additions & 0 deletions ui/src/style/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
5 changes: 3 additions & 2 deletions ui/src/templates/toolbar-card-item.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<div class="toolbar-card toolbar-card-item {{#if thumbnail}}has-thumb{{/if}} {{#if isRequired}}required-element{{/if}}"
data-toggle="tooltip"
data-type="{{type}}"
data-sub-type="{{#if subType}}{{subType}}{{else}}{{dataType}}{{/if}}"
data-data-type="{{dataType}}"
Expand All @@ -8,6 +7,8 @@
data-template-id="{{templateId}}"
data-template-start-width="{{startWidth}}"
data-template-start-height="{{startHeight}}"
data-card-title="{{title}}"
data-toggle="tooltip" data-title="{{description}}"
{{#with extends as | extend |}}
data-extends-template="{{extend.template}}"
data-extends-override="{{extend.override}}"
Expand All @@ -28,7 +29,7 @@
data-toggle="tooltip" data-title="{{trans.isRequired}}"></i>
{{/if}}

<div class="toolbar-content tooltip-always-on" data-toggle="tooltip" data-title="{{title}}">
<div class="toolbar-content" title="{{title}}">
<span class="card-title">{{title}}</span>
</div>
</div>
7 changes: 4 additions & 3 deletions ui/src/templates/toolbar-card-layout-template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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}}">

<div class="toolbar-card-preview">
<img class="thumb" src="{{thumbnail}}" alt="{{title}}">
Expand All @@ -28,7 +29,7 @@
</div>
{{/if}}
</div>
<span class="media-title tooltip-always-on" data-toggle="tooltip" data-title="{{title}}" data-placement="right">{{title}}</span>
<span class="media-title" title="{{title}}">{{title}}</span>

<div class="badges">
{{#if orientation}}
Expand Down
4 changes: 2 additions & 2 deletions ui/src/templates/toolbar-card-media-placeholder.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<div class="toolbar-card toolbar-card-item placeholder-card"
data-toggle="tooltip"
data-type="element"
data-data-type="global"
data-sub-type="global"
Expand All @@ -13,7 +12,8 @@
data-extends-override="{{extend.override}}"
data-extends-with="{{extend.with}}"
{{/with}}
data-title="{{description}}">
data-card-title="{{title}}"
data-toggle="tooltip" data-title="{{description}}">

<div class="toolbar-card-preview">
<i class="fa fa-picture-o card-icon"></i>
Expand Down
4 changes: 2 additions & 2 deletions ui/src/templates/toolbar-card-media-upload.hbs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<div class="toolbar-card upload-card toolbar-card-special"
data-toggle="tooltip"
data-type="widget"
data-sub-type="{{type}}"
data-target="{{#if target}}{{target}}{{else}}layout playlist zone{{/if}}"
data-region-specific="{{regionSpecific}}"
data-valid-ext="{{ validExtensions }}"
data-max-size="{{ maxSize }}"
data-max-size-message="{{ maxSizeMessage }}"
data-title="{{description}}">
data-card-title="{{title}}"
data-toggle="tooltip" data-title="{{description}}">

<div class="toolbar-card-preview">
<div class="select-button select-upload">
Expand Down
7 changes: 4 additions & 3 deletions ui/src/templates/toolbar-card-media.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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}}">

<div class="toolbar-card-preview">
{{#neq thumbnail null}}
Expand Down Expand Up @@ -50,5 +51,5 @@
{{/if}}
</div>

<span class="media-title tooltip-always-on" data-toggle="tooltip" data-title="{{title}}" data-placement="right">{{title}}</span>
<span class="media-title" title="{{title}}" data-placement="right">{{title}}</span>
</div>
4 changes: 2 additions & 2 deletions ui/src/templates/toolbar-card-playlist-new-template.hbs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<div class="toolbar-card new-playlist-card toolbar-card-special"
data-toggle="tooltip"
data-type="widgets"
data-sub-type="{{#if editingPlaylist}}subplaylist{{else}}playlist{{/if}}"
data-target="{{#if target}}{{target}}{{else}}layout zone {{#if editingPlaylist}}playlist{{/if}}{{/if}}"
data-region-specific="1"
data-title="{{description}}">
data-card-title="{{title}}"
data-toggle="tooltip" data-title="{{description}}">

<div class="toolbar-card-preview">
<i class="fa fa-list-ol card-icon"></i>
Expand Down
8 changes: 5 additions & 3 deletions ui/src/templates/toolbar-card-playlist-template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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}}">

<div class="toolbar-card-preview">
<span class="media-title tooltip-always-on" data-toggle="tooltip" data-title="{{name}}" data-placement="right">{{name}}</span>
<span class="media-title" title="{{name}}">{{name}}</span>

{{#if playlistDuration}}
<div class="media-duration" data-title="{{trans.duration}}" data-toggle="tooltip" data-placement="top">
Expand All @@ -15,7 +17,7 @@
{{/if}}

{{#if isDynamic}}
<div class="dynamic-logo tooltip-always-on" data-title="{{trans.dynamicPlaylist}}" data-toggle="tooltip" data-placement="top">
<div class="dynamic-logo" data-title="{{trans.dynamicPlaylist}}" data-toggle="tooltip" data-placement="top">
<i class="fa fa-magic"></i>
</div>
{{/if}}
Expand Down
5 changes: 3 additions & 2 deletions ui/src/templates/toolbar-card-stencil.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<div class="toolbar-card toolbar-card-stencil {{#if thumbnail}}has-thumb{{/if}}"
data-toggle="tooltip"
data-type="{{type}}"
data-sub-type="{{#if subType}}{{subType}}{{else}}{{dataType}}{{/if}}"
data-data-type="{{dataType}}"
Expand All @@ -12,6 +11,8 @@
data-extends-override="{{extend.override}}"
data-extends-with="{{extend.with}}"
{{/with}}
data-card-title="{{title}}"
data-toggle="tooltip" data-title="{{description}}"
>

{{#if thumbnail}}
Expand All @@ -20,7 +21,7 @@
</div>
{{/if}}

<div class="toolbar-content tooltip-always-on" data-toggle="tooltip" data-title="{{title}}">
<div class="toolbar-content" title="{{title}}">
<span class="card-title">{{title}}</span>
</div>
</div>
4 changes: 3 additions & 1 deletion ui/src/templates/toolbar-card-template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
data-template-id="{{templateId}}"
data-start-width="{{startWidth}}"
data-start-height="{{startHeight}}"
data-card-title="{{title}}"
data-toggle="tooltip" data-title="{{description}}"
>

{{#if thumbnail}}
Expand All @@ -18,7 +20,7 @@
{{/if}}
{{/if}}

<div class="toolbar-content tooltip-always-on" data-toggle="tooltip" data-title="{{title}}">
<div class="toolbar-content" title="{{title}}">
<span class="card-title">{{title}}</span>
</div>
</div>
8 changes: 4 additions & 4 deletions ui/src/templates/toolbar-card.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<div class="toolbar-card tooltip-always-on {{#eq cardType "moduleGroup"}}toolbar-card-group{{/eq}} {{#neq dataType ""}}toolbar-card-menu{{/neq}} {{#if favourited}}favourited{{/if}} {{#if thumbnail}}has-thumb{{/if}}"
data-toggle="tooltip"
<div class="toolbar-card {{#eq cardType "moduleGroup"}}toolbar-card-group{{/eq}} {{#neq dataType ""}}toolbar-card-menu{{/neq}} {{#if favourited}}favourited{{/if}} {{#if thumbnail}}has-thumb{{/if}}"
data-type="{{contentType}}"
data-sub-type="{{type}}"
data-data-type="{{dataType}}"
Expand All @@ -8,10 +7,11 @@
data-valid-ext="{{ validExtensions }}"
data-max-size="{{ maxSize }}"
data-max-size-message="{{ maxSizeMessage }}"
data-title="{{name}}"
data-description="{{description}}"
data-start-width="{{startWidth}}"
data-start-height="{{startHeight}}"
data-card-title="{{name}}"
data-toggle="tooltip" data-title="{{description}}"
>

{{#eq contentType "widgets"}}
Expand All @@ -38,7 +38,7 @@
<i class="{{iconType}}-icon {{icon}} card-icon"></i>
{{/if}}

<div class="toolbar-content tooltip-always-on" data-toggle="tooltip" data-title="{{title}}">
<div class="toolbar-content">
<span class="card-title">{{name}}</span>
</div>
</div>
2 changes: 1 addition & 1 deletion ui/src/templates/toolbar-content-group.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</div>
<div class="content-title">
<i class="{{data.icon}} card-icon"></i>
<span>{{data.title}}</span>
<span>{{data.cardTitle}}</span>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion ui/src/templates/toolbar-content-submenu.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</div>
<div class="content-title">
<i class="{{data.icon}} card-icon"></i>
<span>{{data.title}}</span>
<span>{{data.cardTitle}}</span>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion ui/src/templates/toolbar-media-preview-info.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="mediaInfo">
<span>{{data.title}}</span>
<span>{{data.cardTitle}}</span>

{{#if data.width}}
<span>
Expand Down
Loading