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

Text flashes on-screen once and then disappears when a weather widget is also present #2176

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
29 changes: 15 additions & 14 deletions modules/src/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ $(function() {
templateId,
widgetId,
url,
meta,
} = widget;

if (Object.keys(elements.groups).length > 0 ||
Expand Down Expand Up @@ -485,7 +486,7 @@ $(function() {
$itemContainer.find(`.${itemID}--item`),
$content.find(`.${itemID}--item`),
{item, ...item.templateData, data: dataItem},
widget?.meta,
meta,
);
} else {
if ($groupContent &&
Expand Down Expand Up @@ -746,21 +747,21 @@ $(function() {

const $content = $('#content');

initStaticTemplates(
$template,
$content,
moduleTemplate,
hbs,
widget,
widget.data,
widget.showError,
widget.data,
);

// Get widget with templateId = elements
if ((widget.templateId === 'elements' ||
if (widget.templateId !== 'elements' && widget.templateId !== null) {
initStaticTemplates(
$template,
$content,
moduleTemplate,
hbs,
widget,
widget.data,
widget.showError,
widget.data,
);
} else if ((widget.templateId === 'elements' ||
widget.templateId === null) &&
typeof widget.elements !== 'undefined') {
// Get widget with templateId = elements
initPlayerElements(widget);
}
});
Expand Down
3 changes: 2 additions & 1 deletion modules/templates/forecast-elements.xml
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ return value + '%';
<startHeight>100</startHeight>
<onTemplateRender><![CDATA[
if (meta && meta.hasOwnProperty('Attribution')) {
$(target).find('.global-elements-text > div:first-child').html(meta.Attribution);
var $childElem = $(target).is('.' + id + '--item') ? '> div:first-child' : '.global-elements-text > div:first-child';
$(target).find($childElem).html(meta.Attribution);
}
]]></onTemplateRender>
</template>
Expand Down
9 changes: 3 additions & 6 deletions ui/src/helpers/player-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ const PlayerHelper = function() {
this.init = (widgetData, elements) => new Promise((resolve) => {
if (Array.isArray(widgetData)) {
const _widgetData = [...widgetData];
const _widgetPromises = [];

_widgetData.forEach((widget) => {
_widgetPromises.push(this.getWidgetData(widget));
});

Promise.all(_widgetPromises).then((values) => {
Promise.all(_widgetData.map(function(widget) {
return _self.getWidgetData(widget);
})).then((values) => {
const widgets = {};
values.forEach((value, widgetIndex) => {
let _elements = {standalone: {}, groups: {}};
Expand Down
Loading