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

Add max-width, theme parameter to #info #4586

Merged
merged 1 commit into from Feb 22, 2020
Merged

Conversation

mwjames
Copy link
Contributor

@mwjames mwjames commented Feb 22, 2020

This PR is made in reference to: https://www.semantic-mediawiki.org/wiki/Thread:Help_talk:Special_characters_in_tooltips/Adding_a_tooltip

This PR addresses or contains:

  • This doesn't answer the question of "what if I would like to add a custom tooltip (i.e. hacking SMW)" (which I don't recommend otherwise any modifications to the smw.tippy.js will be made invalid by the next upgrade) anyway:
    • The Highlighter class creates the HTML code in PHP while
    • smw.tippy.js is the corresponding tandem on the JS side to create and invoke the tippy instance (see atomiks/tippyjs)
  • This PR adds two new parameters to #info:
    • max-width: to define the maximum width with a tooltip, allowing it to be wider than the default to display more information at once
    • theme (square-border, square-border-light) to use a slightly different theme for the tooltip appearance

This PR includes:

  • Tests (unit/integration)
  • CI build passed

Example

{{#info: message=Integer eu ... |max-width=350 |theme=square-border }}

image

image

@mwjames mwjames added the enhancement Alters an existing functionality or behaviour label Feb 22, 2020
@mwjames
Copy link
Contributor Author

mwjames commented Feb 22, 2020

@kghbln The added parameters should be enough to cover most use cases that rely on #info while the height remains as-is otherwise this becomes anything but a tooltip.

PS: As an official note, hacking smw.tippy.js is not recommended!

@mwjames mwjames merged commit ab4499d into master Feb 22, 2020
@mwjames mwjames deleted the info-parserfunction branch February 22, 2020 14:52
@kghbln kghbln added this to the SMW 3.2.0 milestone Feb 22, 2020
@kghbln
Copy link
Member

kghbln commented Feb 22, 2020

Really cool. Thank you!

otherwise this becomes anything but a tooltip

What about introducing #supobjects for pages that show instead of the pages they are embedded on. :D

@mwjames
Copy link
Contributor Author

mwjames commented Feb 22, 2020

What about introducing #supobjects pages that show instead of the pages they are embedded on. :D

Not sure I can follow!

@kghbln
Copy link
Member

kghbln commented Feb 22, 2020

Not sure I can follow!

This was a joke. #supobject in contrast to #subobject.

@mwjames
Copy link
Contributor Author

mwjames commented Feb 22, 2020

This was a joke. #supobject in contrast to #subobject.

Right. Its quite late for me hence I'm a bit slow.

@kghbln
Copy link
Member

kghbln commented Feb 23, 2020

Life example and documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Alters an existing functionality or behaviour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants