diff --git a/powerdnsadmin/__init__.py b/powerdnsadmin/__init__.py index 5adf748..c8f3b40 100755 --- a/powerdnsadmin/__init__.py +++ b/powerdnsadmin/__init__.py @@ -74,9 +74,9 @@ def create_app(config=None): app.jinja_env.filters['display_record_name'] = utils.display_record_name app.jinja_env.filters['display_master_name'] = utils.display_master_name app.jinja_env.filters['display_second_to_time'] = utils.display_time - app.jinja_env.filters[ - 'display_setting_state'] = utils.display_setting_state + 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 # Register context proccessors from .models.setting import Setting diff --git a/powerdnsadmin/lib/utils.py b/powerdnsadmin/lib/utils.py index f63a11c..c763bcb 100644 --- a/powerdnsadmin/lib/utils.py +++ b/powerdnsadmin/lib/utils.py @@ -225,6 +225,7 @@ class customBoxes: } order = ["reverse", "ip6arpa", "inaddrarpa"] + def pretty_domain_name(domain_name): # Add a debugging statement to print out the domain name print("Received domain name:", domain_name) @@ -258,9 +259,16 @@ def to_idna(value, action): elif action == 'decode': for split in splits: if not split.startswith('_') and not split.startswith('--'): - result.append(idna.decode(split)) + result.append(idna.decode(split)) else: result.append(split) else: raise Exception('No valid action received') return '.'.join(result) + + +def format_datetime(value, format_str="%Y-%m-%d %I:%M %p"): + """Format a date time to (Default): YYYY-MM-DD HH:MM P""" + if value is None: + return "" + return value.strftime(format_str) diff --git a/powerdnsadmin/templates/base.html b/powerdnsadmin/templates/base.html index 54bb019..4f050c9 100644 --- a/powerdnsadmin/templates/base.html +++ b/powerdnsadmin/templates/base.html @@ -1,427 +1,424 @@ - {% block head %} - - - - {% block title %} - - {{ SITE_NAME }} - + {% block head %} + + + + {% block title %}{{ SITE_NAME }}{% endblock %} + + + + + + + + {% assets "css_main" -%}{%- endassets %} + {% if SETTING.get('custom_css') %} + + {% endif %} {% endblock %} - - - - - - - - - {% assets "css_main" -%} - - {%- endassets %} - {% if SETTING.get('custom_css') %} - - {% endif %} - {% endblock %} - {% set user_image_url = url_for('user.image', username=current_user.username) %} -
- {% block pageheader %} - +{% set user_image_url = url_for('user.image', username=current_user.username) %} +
+ {% block pageheader %} + - {% endblock %} - - + + +
+ {% block dashboard_stat %} + +
+
+
+
+

+ Dashboard + Control panel +

+
+
+ +
+
+
+
+ {% endblock %} + {% block content %} + {% endblock %}
- {% endblock %} - {% block content %} - {% endblock %} -
- - + +
- {% block scripts %} -{% assets "js_main" -%} - - {% if SETTING.get('warn_session_timeout') and current_user.is_authenticated %} - + {% if SETTING.get('warn_session_timeout') and current_user.is_authenticated %} + - {% endif %} -{%- endassets %} + function showSuccessModal(message) { + var modal = $("#modal_success"); + modal.find('.modal-body p').text(message); + modal.modal('show'); + } + + {% endif %} + {%- endassets %} {% endblock %} {% block extrascripts %} {% endblock %} {% block defaultmodals %} -