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

Editor Toolbar: Exchange tab #2471

Merged
merged 1 commit into from
Apr 8, 2024
Merged
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
Editor Toolbar: Exchange tab
maurofmferrao committed Apr 4, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 7408ad75e940eedc92bdfc8140c6fd0d7529a7c8
42 changes: 36 additions & 6 deletions ui/src/editor-core/toolbar.js
Original file line number Diff line number Diff line change
@@ -555,7 +555,28 @@ Toolbar.prototype.init = function({isPlaylist = false} = {}) {
key: 'template',
},
provider: {
value: 'both',
value: 'local',
locked: true,
},
},
state: '',
itemCount: 0,
},
{
name: 'layout_exchange',
disabled: isPlaylist,
itemName: toolbarTrans.menuItems.layoutExchangeName,
itemIcon: 'exchange-alt', // TODO: Change icon!
itemTitle: toolbarTrans.menuItems.layoutExchangeTitle,
contentType: 'layout_exchange',
filters: {
name: {
value: '',
key: 'template',
},
provider: {
value: 'remote',
locked: true,
},
},
state: '',
@@ -1226,7 +1247,10 @@ Toolbar.prototype.createContent = function(
this.mediaContentCreateWindow(menu);
} else if (content.contentType == 'elements') {
this.elementsContentCreateWindow(menu, savePrefs);
} else if (content.contentType === 'layout_templates') {
} else if (
content.contentType === 'layout_templates' ||
content.contentType === 'layout_exchange'
) {
this.layoutTemplatesContentCreateWindow(menu);
} else if (content.contentType === 'playlists') {
this.playlistsContentCreateWindow(menu);
@@ -2213,6 +2237,7 @@ Toolbar.prototype.elementsContentCreateWindow = function(
Toolbar.prototype.layoutTemplatesContentCreateWindow = function(menu) {
const self = this;
const app = this.parent;
const tabContentName = this.menuItems[menu].name;

// Deselect previous selections
self.deselectCardsAndDropZones();
@@ -2223,16 +2248,18 @@ Toolbar.prototype.layoutTemplatesContentCreateWindow = function(menu) {
filters: this.menuItems[menu].filters,
trans: toolbarTrans,
formClass: 'layout_tempates-search-form',
headerMessage: toolbarTrans.layoutTemplatesMessage,
headerMessage: (tabContentName == 'layout_exchange') ?
toolbarTrans.layoutExchangeTemplatesMessage :
toolbarTrans.layoutTemplatesMessage,
});

// Clear temp data
app.common.clearContainer(
self.DOMObject.find('#layout_templates-container-' + menu),
self.DOMObject.find('#' + tabContentName + '-container-' + menu),
);

// Append template to the search main div
self.DOMObject.find('#layout_templates-container-' + menu).html(html);
self.DOMObject.find('#' + tabContentName + '-container-' + menu).html(html);

// Load content
this.layoutTemplatesContentPopulate(menu);
@@ -2270,7 +2297,10 @@ Toolbar.prototype.playlistsContentCreateWindow = function(menu) {
Toolbar.prototype.layoutTemplatesContentPopulate = function(menu) {
const app = this.parent;
const self = this;
const $container = self.DOMObject.find('#layout_templates-container-' + menu);
const tabContentName = this.menuItems[menu].name;
const $container = self.DOMObject.find(
'#' + tabContentName + '-container-' + menu,
);
const $content = self.DOMObject.find('#media-content-' + menu);
const $searchForm = $container.parent().find('.toolbar-search-form');

11 changes: 1 addition & 10 deletions ui/src/style/toolbar.scss
Original file line number Diff line number Diff line change
@@ -68,15 +68,6 @@
&.media-search-form, &.layout_tempates-search-form {
padding: 0;
padding-bottom: 1rem;
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;

.form-group {
width: calc(50% - 4px);
}
}
}
}
@@ -621,7 +612,7 @@
}
}

&.toolbar-layout_templates-pane {
&.toolbar-layout_templates-pane, &.toolbar-layout_exchange-pane {
.toolbar-card:not(.has-thumb):hover .media-title {
overflow: visible;
white-space: normal;
2 changes: 1 addition & 1 deletion ui/src/templates/toolbar-content.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div id="content-{{menuIndex}}"
class="toolbar-pane toolbar-{{name}}-pane {{state}} {{#eq contentType 'media'}}toolbar-library-pane{{/eq}} {{#eq contentType 'layout_templates'}}toolbar-library-pane{{/eq}} {{#eq contentType 'playlists'}}toolbar-library-pane{{/eq}}"
class="toolbar-pane toolbar-{{name}}-pane {{state}} {{#eq contentType 'media'}}toolbar-library-pane{{/eq}} {{#eq contentType 'layout_templates'}}toolbar-library-pane{{/eq}} {{#eq contentType 'layout_exchange'}}toolbar-library-pane{{/eq}} {{#eq contentType 'playlists'}}toolbar-library-pane{{/eq}}"
data-menu-index="{{menuIndex}}"
>

38 changes: 26 additions & 12 deletions ui/src/templates/toolbar-search-form.hbs
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
</select>
</div>
{{else eq @key "owner"}}
<div class="form-group">
<div class="form-group {{#if this.locked}}hidden{{/if}}">
<label for="input-owner" class="mb-0">{{../trans.searchFilters.owner}}</label>
<select id="input-owner" name="ownerId" class="form-control mr-1 input-owner"
{{#if searchUrl}}data-search-url="{{searchUrl}}"{{/if}}
@@ -28,10 +28,13 @@
data-placeholder--id= "null"
data-placeholder--value= ""
data-text-property="userName">
{{#if this.locked}}
<option value="{{this.value}}" selected>{{this.value}}</option>
{{/if}}
</select>
</div>
{{else eq @key "user"}}
<div class="form-group">
<div class="form-group {{#if this.locked}}hidden{{/if}}">
<label for="input-user" class="mb-0">{{../trans.searchFilters.user}}</label>
<select id="input-user" name="userId" class="form-control mr-1 input-user"
{{#if searchUrl}}data-search-url="{{searchUrl}}"{{/if}}
@@ -41,28 +44,39 @@
data-placeholder--id= "null"
data-placeholder--value= ""
data-text-property="userName">
{{#if this.locked}}
<option value="{{this.value}}" selected>{{this.value}}</option>
{{/if}}
</select>
</div>
{{else eq @key "orientation"}}
<div class="form-group">
<div class="form-group {{#if this.locked}}hidden{{/if}}">
<label for="input-orientation" class="mb-0">{{../trans.searchFilters.orientation}}</label>
<select id="input-orientation" name="orientation" class="form-control mr-1 input-orientation">
<option value="" {{#eq this.value ""}}selected{{/eq}}>{{ ../trans.orientationValues.all}}</option>
<option value="landscape" {{#eq this.value "landscape"}}selected{{/eq}}>{{ ../trans.orientationValues.landscape}}</option>
<option value="portrait" {{#eq this.value "portrait"}}selected{{/eq}}>{{ ../trans.orientationValues.portrait}}</option>
{{#if this.locked}}
<option value="{{this.value}}" selected>{{this.value}}</option>
{{else}}
<option value="" {{#eq this.value ""}}selected{{/eq}}>{{ ../trans.orientationValues.all}}</option>
<option value="landscape" {{#eq this.value "landscape"}}selected{{/eq}}>{{ ../trans.orientationValues.landscape}}</option>
<option value="portrait" {{#eq this.value "portrait"}}selected{{/eq}}>{{ ../trans.orientationValues.portrait}}</option>
{{/if}}
</select>
</div>
{{else eq @key "provider"}}
<div class="form-group">
<div class="form-group {{#if this.locked}}hidden{{/if}}">
<label for="input-provider" class="mb-0">{{../trans.searchFilters.provider}}</label>
<select id="input-provider" name="provider" class="form-control mr-1 input-provider">
<option value="both" {{#eq this.value "both"}}selected{{/eq}}>{{ ../trans.providerValues.both}}</option>
<option value="local" {{#eq this.value "local"}}selected{{/eq}}>{{ ../trans.providerValues.local}}</option>
<option value="remote" {{#eq this.value "remote"}}selected{{/eq}}>{{ ../trans.providerValues.remote}}</option>
{{#if this.locked}}
<option value="{{this.value}}" selected>{{this.value}}</option>
{{else}}
<option value="both" {{#eq this.value "both"}}selected{{/eq}}>{{ ../trans.providerValues.both}}</option>
<option value="local" {{#eq this.value "local"}}selected{{/eq}}>{{ ../trans.providerValues.local}}</option>
<option value="remote" {{#eq this.value "remote"}}selected{{/eq}}>{{ ../trans.providerValues.remote}}</option>
{{/if}}
</select>
</div>
{{else}}
<div class="form-group">
<div class="form-group {{#if this.locked}}hidden{{/if}}">
<label for="input-{{@key}}" class="mb-0">{{#if title}}{{title}}{{else}}{{lookup ../trans.searchFilters @key}}{{/if}}</label>
<input id="input-{{@key}}" name="{{#if key}}{{key}}{{else}}{{@key}}{{/if}}" type="text"
value="{{this.value}}" class="form-control mr-1 input-{{@key}}"
@@ -74,7 +88,7 @@
{{/each}}

{{#if showSort}}
<div class="form-group sort-form-group">
<div class="form-group sort-form-group {{#if this.locked}}hidden{{/if}}">
<label for="input-sort" class="mb-0">{{trans.searchSortBy}}</label>
<div class="{{#if sortCol}}input-group{{/if}} input-group-toggle">
<select id="input-sort" class="form-control input-sort">
3 changes: 3 additions & 0 deletions views/common.twig
Original file line number Diff line number Diff line change
@@ -712,6 +712,8 @@
actionsTitle: "{{ "Interactive actions"|trans }}",
layoutTemplateName: "{{ "Layout Templates" |trans }}",
layoutTemplateTitle: "{{ "Search for Layout Templates"|trans }}",
layoutExchangeName: "{{ "Xibo Layout Exchange" |trans }}",
layoutExchangeTitle: "{{ "Search for templates available from the Xibo Exchange."|trans }}",
playlistsName: "{{ "Playlists" |trans }}",
playlistsTitle: "{{ "Add Playlists"|trans }}",
providerTitle: "{{ "Provider: %obj%"|trans }}",
@@ -760,6 +762,7 @@
layout: "{{ "Layout"|trans }}",
region: "{{ "Zone"|trans }}",
layoutTemplatesMessage: "{{ "Replace your Layout with a template?"|trans }}",
layoutExchangeTemplatesMessage: "{{ "Replace your Layout with a Xibo Exchange template?"|trans }}",
isRequired: "{{ "Required"|trans }}",
libraryTypes: {
image: "{{ "Image" |trans }}",