Skip to content

Commit e95733e

Browse files
committed
fix big number
1 parent 59fd1a1 commit e95733e

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

examples/official-site/sqlpage/migrations/49_big_number.sql

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ INSERT INTO component(name, icon, description, introduced_in_version) VALUES
88
INSERT INTO parameter(component, name, description, type, top_level, optional) SELECT 'big_number', * FROM (VALUES
99
-- Top-level parameters (for the whole big_number list)
1010
('columns', 'The number of columns to display the big numbers in (default is one column per item).', 'INTEGER', TRUE, TRUE),
11+
('id', 'An optional ID to be used as an anchor for links.', 'TEXT', TRUE, TRUE),
12+
('class', 'An optional CSS class to be added to the component for custom styling', 'TEXT', TRUE, TRUE),
1113
-- Item-level parameters (for each big number)
1214
('title', 'The title or label for the big number.', 'TEXT', FALSE, TRUE),
1315
('value', 'The main value to be displayed prominently.', 'TEXT', FALSE, FALSE),
@@ -45,12 +47,12 @@ INSERT INTO example(component, description, properties) VALUES
4547
INSERT INTO example(component, description, properties) VALUES
4648
('big_number', 'Big numbers with dropdowns and customized layout',
4749
json('[
48-
{"component":"big_number", "columns":3},
50+
{"component":"big_number", "columns":3, "id":"colorfull_dashboard"},
4951
{"title":"Users", "value":"1,234", "color": "red" },
5052
{"title":"Orders", "value":56, "color": "green" },
5153
{"title":"Revenue", "value":"9,876", "unit": "€", "color": "blue", "dropdown_item": [
52-
{"label":"This week", "link":"?days=7"},
53-
{"label":"This month", "link":"?days=30"},
54-
{"label":"This quarter", "link":"?days=90"}
54+
{"label":"This week", "link":"?days=7&component=big_number#colorfull_dashboard"},
55+
{"label":"This month", "link":"?days=30&component=big_number#colorfull_dashboard"},
56+
{"label":"This quarter", "link":"?days=90&component=big_number#colorfull_dashboard"}
5557
]}
5658
]'));

sqlpage/templates/big_number.handlebars

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
<div class="row g-3 h-100
2-
{{~#if columns}} row-cols-1 row-cols-sm-2 row-cols-md-{{columns~}}{{/if~}}
1+
<div {{#if id}} id="{{id}}" {{/if~}}
2+
class="row g-3 h-100
3+
{{~#if columns}} row-cols-1 row-cols-sm-2 row-cols-md-{{columns~}} {{/if~}}
4+
{{~#if class}} {{class}} {{/if}}
35
">
46
{{#each_row}}
5-
<div class="col d-flex">
7+
<div class="col d-flex {{~#if class}} {{class}}{{/if}}"
8+
{{~#if id}} id="{{id}}"{{/if~}}
9+
>
610
<div class="card flex-fill {{#if color}}bg-{{color}}-lt{{/if}}">
711
<div class="card-body d-flex flex-column">
812
{{#if title}}
@@ -43,17 +47,16 @@
4347
{{/if}}
4448
</span>
4549
</div>
46-
{{/if}}
50+
{{~/if~}}
4751
</div>
48-
{{/if}}
49-
50-
{{#if progress_percent}}
52+
{{~/if~}}
53+
{{~#if progress_percent~}}
5154
<div class="progress progress-sm">
5255
<div class="progress-bar bg-{{progress_color}}" style="width: {{progress_percent}}%" role="progressbar" aria-valuenow="{{progress_percent}}" aria-valuemin="0" aria-valuemax="100" aria-label="{{progress_percent}}% Complete">
5356
<span class="visually-hidden">{{progress_percent}}% Complete</span>
5457
</div>
5558
</div>
56-
{{/if}}
59+
{{~/if~}}
5760
</div>
5861
</div>
5962
</div>

0 commit comments

Comments
 (0)