From 4f83879e95f85a0905506d9e65b572029071faba Mon Sep 17 00:00:00 2001 From: Matt Scott Date: Sun, 19 Feb 2023 09:48:43 -0500 Subject: [PATCH] Added Jinja filter for handle formatting of zone type labels to enforce modern social standards. Removed text label of dashboard domain list action menu to reduce size. Continuing work on re-design and clean-up of dashboard view. --- powerdnsadmin/__init__.py | 1 + powerdnsadmin/lib/utils.py | 10 ++++++++++ powerdnsadmin/templates/dashboard.html | 5 ++++- powerdnsadmin/templates/dashboard_domain.html | 8 ++++---- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/powerdnsadmin/__init__.py b/powerdnsadmin/__init__.py index c8f3b40..0b2c5a1 100755 --- a/powerdnsadmin/__init__.py +++ b/powerdnsadmin/__init__.py @@ -77,6 +77,7 @@ def create_app(config=None): app.jinja_env.filters['display_setting_state'] = utils.display_setting_state app.jinja_env.filters['pretty_domain_name'] = utils.pretty_domain_name app.jinja_env.filters['format_datetime_local'] = utils.format_datetime + app.jinja_env.filters['format_zone_type'] = utils.format_zone_type # Register context proccessors from .models.setting import Setting diff --git a/powerdnsadmin/lib/utils.py b/powerdnsadmin/lib/utils.py index c763bcb..f75a103 100644 --- a/powerdnsadmin/lib/utils.py +++ b/powerdnsadmin/lib/utils.py @@ -132,6 +132,16 @@ def display_master_name(data): return ", ".join(matches) +def format_zone_type(data): + """Formats the given zone type for modern social standards.""" + data = str(data).lower() + if data == 'master': + data = 'primary' + elif data == 'slave': + data = 'secondary' + return data.title() + + def display_time(amount, units='s', remove_seconds=True): """ Convert timestamp to normal time format diff --git a/powerdnsadmin/templates/dashboard.html b/powerdnsadmin/templates/dashboard.html index 1409728..a72c55b 100755 --- a/powerdnsadmin/templates/dashboard.html +++ b/powerdnsadmin/templates/dashboard.html @@ -199,7 +199,7 @@
+ class="table table-striped table-hover records table-sm"> @@ -236,6 +236,9 @@ {% block head_styles %}
Name