Skip to content

Tooltip picture elements#3111

Merged
balloob merged 6 commits intohome-assistant:devfrom
yosilevy:tooltip-picture-elements
Apr 27, 2019
Merged

Tooltip picture elements#3111
balloob merged 6 commits intohome-assistant:devfrom
yosilevy:tooltip-picture-elements

Conversation

@yosilevy
Copy link
Copy Markdown
Contributor

Added a way to suppress the UGLY tooltips in picture-elements.

Also added localization for the existing tooltips.

The docs on the current ability to specify a tooltip is lacking (only there for icon element).
I will fix this and also add docs on the new noTitle option.

After this PR is approved...

interface Config extends LovelaceElementConfig {
entity?: string;
title?: string;
noTitle?: boolean;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

camelcase is inconsistent with how we define all other configuration options. I think show_tooltip is a better descriptor.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooops.
show is the default behavior so I don't want to change that. I changed it to hide_title.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

show is the common phrase currently used for things like this. e.g. https://www.home-assistant.io/lovelace/picture-entity/#show_name

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should just allow setting title to null to indicate no title should be shown.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't think that was such good practice. Anyway it's easier so done.

tooltip += `Navigate to ${config.navigation_path}`;
tooltip += `${hass.localize(
"ui.panel.lovelace.cards.picture-elements.navigate_to"
)} ${config.navigation_path}`;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't concatenate strings. Instead the localization string should have a placeholder.

Comment thread src/translations/en.json Outdated
"picture-elements": {
"hold": "Hold:",
"tap": "Tap:",
"navigate_to": "Navigate to",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"navigate_to": "Navigate to",
"navigate_to": "Navigate to {location}",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@balloob balloob merged commit 8ca70ac into home-assistant:dev Apr 27, 2019
@balloob balloob mentioned this pull request Apr 28, 2019
@yosilevy yosilevy deleted the tooltip-picture-elements branch August 9, 2019 16:24
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants