SQLpage icon indicating copy to clipboard operation
SQLpage copied to clipboard

Add link & target props to big_number.handlebars

Open hanskihyv opened this issue 9 months ago • 3 comments

We needed link functionality for the Big Number component

This PR introduces support for adding links to both the title and the value fields in the Big Number component. It also allows specifying whether those links should open in the same tab (_self) or a new tab (_blank). The goal is to enable more interactive dashboards where users can navigate between pages directly by clicking on a Big Number’s text. Usage

Added four optional properties:

  • title_link (string): the URL or path that the Big Number’s title should link to, if any
  • title_target (string): how the title link is opened, e.g. "_self" for same tab, or "_blank" for a new tab
  • value_link (string): the URL or path that the Big Number’s value should link to, if any
  • value_target (string): how the value link is opened, e.g. "_self" or "_blank"
-- adding link + target properties for both title and value.

SELECT 
    'big_number'    AS component,
    'Weekly Stats'  AS title,
    '/stats_page.sql' AS title_link,   -- Link for the title
    '_blank'        AS title_target,   -- Opens in new tab
    42              AS value,
    '/details.sql'  AS value_link,     -- Link for the value
    '_self'         AS value_target,   -- Opens in same tab
    'green'         AS color,
    'Check out stats' AS description;

hanskihyv avatar Mar 19 '25 11:03 hanskihyv

Thanks Hansky !

As I said in https://github.com/sqlpage/SQLPage/issues/859 , I think target=_blank is not the most user friendly for people who are not already familiar with html. Maybe true as title_link_new_tab ?

By the way, do you work with @accforgithubtest ?

lovasoa avatar Mar 19 '25 15:03 lovasoa

Thanks Hansky !

As I said in #859 , I think target=_blank is not the most user friendly for people who are not already familiar with html. Maybe true as title_link_new_tab ?

By the way, do you work with @accforgithubtest ?

No, I don't work @accforgithubtest and didn't read that discussion beforehand.

I did do some modifications regarding that title_link_new_tab and modified 49_big_number.sql. As I'm new with git / github, not sure if everything has been done correctly now. At least on second commit today I got the 49_big_number.sql added.

hanskihyv avatar Mar 20 '25 10:03 hanskihyv

No, I don't work @accforgithubtest and didn't read that discussion beforehand.

Well, then you both had the same idea at almost the same time :) You'll make someone happy !

lovasoa avatar Mar 20 '25 11:03 lovasoa

Hi @hanskihyv ! I'm sorry for the long delay.

I made the last few changes I needed to this pr and merged it. Thank you again for your contribution !

This will be in v0.35

lovasoa avatar May 19 '25 23:05 lovasoa