From a56ac2413ecdae88598211d42da336c518be0e3a Mon Sep 17 00:00:00 2001 From: Cavasin F Date: Thu, 9 Nov 2023 11:42:44 +0100 Subject: [PATCH 1/9] Add status_dot component --- templates/components/status.html.twig | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/templates/components/status.html.twig b/templates/components/status.html.twig index 761e649..106fc05 100644 --- a/templates/components/status.html.twig +++ b/templates/components/status.html.twig @@ -14,3 +14,19 @@ {%- endapply -%} {% endmacro %} + +{% macro status_dot(options) %} + {% import '@Tabler/includes/utils.html.twig' as utils %} + + {% set _color = options.color ?? null %} + {% set _animated = (options.animated ?? true) is same as true %} + {% set _extraClass = options.extraClass ?? '' %} + {% set _attr = options.attr ?? {} %} + + {%- apply spaceless -%} + + {%- endapply -%} +{% endmacro %} From f9d306c704b196b64748586d73d1f1e3d8a714ea Mon Sep 17 00:00:00 2001 From: Cavasin F Date: Thu, 9 Nov 2023 11:43:19 +0100 Subject: [PATCH 2/9] Re-use self macro --- templates/components/status.html.twig | 45 +++++++++++++++++---------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/templates/components/status.html.twig b/templates/components/status.html.twig index 106fc05..8b6379a 100644 --- a/templates/components/status.html.twig +++ b/templates/components/status.html.twig @@ -1,19 +1,32 @@ -{% macro status(text, options) %} - {% set _color = options.color ?? 'green' %} - {% set _animated = options.animated ?? true %} - {% set _lite = options.lite is defined ? options.lite : false %} - {% set _with_dot = options.with_dot is defined ? options.with_dot : false %} - {% set _extraClass = options.extraClass ?? '' %} - - {%- apply spaceless -%} - - {% if _with_dot %} - - {% endif %} - {{ text }} - - {%- endapply -%} -{% endmacro %} +{% macro status(text, options) %} + {% import '@Tabler/components/status.html.twig' as macro %} + {% import '@Tabler/includes/utils.html.twig' as utils %} + + {% set _color = options.color ?? 'green' %} + {% set _animated = (options.animated ?? true) is same as true %} + {% set _lite = (options.lite ?? false) is same as true %} + {% if options.with_dot is defined %} + {% deprecated 'with_dot option is deprecated, use withDot option instead!' %} + {% set _withDot = options.with_dot is same as true %} + {% else %} + {% set _withDot = (options.withDot ?? false) is same as true %} + {% endif %} + + {% set _extraClass = options.extraClass ?? '' %} + {% set _attr = options.attr ?? {} %} + + {%- apply spaceless -%} + + {% if _withDot %} + {{ macro.status_dot({animated : _animated}) }} + {% endif %} + {{ text }} + + {%- endapply -%} +{% endmacro %} {% macro status_dot(options) %} {% import '@Tabler/includes/utils.html.twig' as utils %} From 2b81e3f825d51bc90dc72ed300b0247b28b44ad8 Mon Sep 17 00:00:00 2001 From: Cavasin F Date: Thu, 9 Nov 2023 11:43:58 +0100 Subject: [PATCH 3/9] status_indicator add `attr` option --- .../components/status_indicator.html.twig | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/templates/components/status_indicator.html.twig b/templates/components/status_indicator.html.twig index 0b83aef..4608803 100644 --- a/templates/components/status_indicator.html.twig +++ b/templates/components/status_indicator.html.twig @@ -1,13 +1,18 @@ -{% macro status_indicator(options) %} - - {% set _color = options.color ?? 'green' %} - {% set _animated = options.animated ?? true %} - {% set _extraClass = options.extraClass ?? '' %} - - - - - - - -{% endmacro %} +{% macro status_indicator(options) %} + {% import '@Tabler/includes/utils.html.twig' as utils %} + + {% set _color = options.color ?? 'green' %} + {% set _animated = (options.animated ?? true) is same as true %} + {% set _extraClass = options.extraClass ?? '' %} + {% set _attr = options.attr ?? {} %} + + + + + + + +{% endmacro %} From dc263d1ce67bc155da7b1ba3653c3902e5d60f5f Mon Sep 17 00:00:00 2001 From: Cavasin F Date: Mon, 11 Dec 2023 10:25:04 +0100 Subject: [PATCH 4/9] Removing self import --- templates/components/status.html.twig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/templates/components/status.html.twig b/templates/components/status.html.twig index 8b6379a..211c70f 100644 --- a/templates/components/status.html.twig +++ b/templates/components/status.html.twig @@ -1,5 +1,4 @@ {% macro status(text, options) %} - {% import '@Tabler/components/status.html.twig' as macro %} {% import '@Tabler/includes/utils.html.twig' as utils %} {% set _color = options.color ?? 'green' %} @@ -21,7 +20,7 @@ {{ utils.attr_to_html(_attr) }} > {% if _withDot %} - {{ macro.status_dot({animated : _animated}) }} + {{ _self.status_dot({animated : _animated}) }} {% endif %} {{ text }} From 259d69f6596b36d047764e85469437a5e9dd21e7 Mon Sep 17 00:00:00 2001 From: Cavasin F Date: Mon, 11 Dec 2023 10:27:17 +0100 Subject: [PATCH 5/9] Removing spaceless --- templates/components/status.html.twig | 30 ++++++++++++--------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/templates/components/status.html.twig b/templates/components/status.html.twig index 211c70f..ece44ae 100644 --- a/templates/components/status.html.twig +++ b/templates/components/status.html.twig @@ -14,17 +14,15 @@ {% set _extraClass = options.extraClass ?? '' %} {% set _attr = options.attr ?? {} %} - {%- apply spaceless -%} - - {% if _withDot %} - {{ _self.status_dot({animated : _animated}) }} - {% endif %} - {{ text }} - - {%- endapply -%} + + {% if _withDot %} + {{ _self.status_dot({animated : _animated}) }} + {% endif %} + {{ text }} + {% endmacro %} {% macro status_dot(options) %} @@ -35,10 +33,8 @@ {% set _extraClass = options.extraClass ?? '' %} {% set _attr = options.attr ?? {} %} - {%- apply spaceless -%} - - {%- endapply -%} + {% endmacro %} From 3bd78c59b66ad9c7c5bbf8a553a9f2da062e756f Mon Sep 17 00:00:00 2001 From: Cavasin F Date: Mon, 11 Dec 2023 14:18:04 +0100 Subject: [PATCH 6/9] Update status_dot component --- templates/components/status_dot.html.twig | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/templates/components/status_dot.html.twig b/templates/components/status_dot.html.twig index 7ff6e8b..43371ae 100644 --- a/templates/components/status_dot.html.twig +++ b/templates/components/status_dot.html.twig @@ -1,7 +1,13 @@ {% macro status_dot(options) %} + {% import '@Tabler/includes/utils.html.twig' as utils %} + {% set _color = options.color ?? 'green' %} - {% set _animated = options.animated ?? true %} + {% set _animated = (options.animated ?? true) is same as true %} {% set _extraClass = options.extraClass ?? '' %} + {% set _attr = options.attr ?? {} %} - + {% endmacro %} From f97bfb2d3ebb196eacd5fbfe8e7a32b8b37cf1cc Mon Sep 17 00:00:00 2001 From: Cavasin F Date: Mon, 11 Dec 2023 14:18:26 +0100 Subject: [PATCH 7/9] Re-use existing `status_dot` --- templates/components/status.html.twig | 17 ++--------------- templates/components/status_indicator.html.twig | 1 - 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/templates/components/status.html.twig b/templates/components/status.html.twig index ece44ae..ad9a830 100644 --- a/templates/components/status.html.twig +++ b/templates/components/status.html.twig @@ -1,5 +1,6 @@ {% macro status(text, options) %} {% import '@Tabler/includes/utils.html.twig' as utils %} + {% import '@Tabler/components/status_dot.html.twig' as status_dot %} {% set _color = options.color ?? 'green' %} {% set _animated = (options.animated ?? true) is same as true %} @@ -19,22 +20,8 @@ {{ utils.attr_to_html(_attr) }} > {% if _withDot %} - {{ _self.status_dot({animated : _animated}) }} + {{ status_dot({animated : _animated}) }} {% endif %} {{ text }} {% endmacro %} - -{% macro status_dot(options) %} - {% import '@Tabler/includes/utils.html.twig' as utils %} - - {% set _color = options.color ?? null %} - {% set _animated = (options.animated ?? true) is same as true %} - {% set _extraClass = options.extraClass ?? '' %} - {% set _attr = options.attr ?? {} %} - - -{% endmacro %} diff --git a/templates/components/status_indicator.html.twig b/templates/components/status_indicator.html.twig index 4608803..e2d2398 100644 --- a/templates/components/status_indicator.html.twig +++ b/templates/components/status_indicator.html.twig @@ -14,5 +14,4 @@ - {% endmacro %} From e167bb6f79e7d7ff38bccd813669848d0e4a2bfa Mon Sep 17 00:00:00 2001 From: Cavasin F Date: Mon, 11 Dec 2023 14:35:56 +0100 Subject: [PATCH 8/9] Use status color as status_dot color --- templates/components/status.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/components/status.html.twig b/templates/components/status.html.twig index ad9a830..f9b751e 100644 --- a/templates/components/status.html.twig +++ b/templates/components/status.html.twig @@ -20,7 +20,7 @@ {{ utils.attr_to_html(_attr) }} > {% if _withDot %} - {{ status_dot({animated : _animated}) }} + {{ status_dot({color: _color, animated : _animated}) }} {% endif %} {{ text }} From 85c23bf10f8433c6d40230a5995210290f86a681 Mon Sep 17 00:00:00 2001 From: Florian CAVASIN Date: Tue, 12 Dec 2023 16:29:19 +0100 Subject: [PATCH 9/9] remove color twig concat Co-authored-by: Kevin Papst --- templates/components/status_indicator.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/components/status_indicator.html.twig b/templates/components/status_indicator.html.twig index e2d2398..afc5aab 100644 --- a/templates/components/status_indicator.html.twig +++ b/templates/components/status_indicator.html.twig @@ -7,7 +7,7 @@ {% set _attr = options.attr ?? {} %}