From ffc3e05a656175029eba1a6b04c6001a341f2c1f Mon Sep 17 00:00:00 2001 From: checktheroads Date: Tue, 14 May 2019 16:53:47 -0700 Subject: [PATCH] added new org_name config variable for T&C block --- hyperglass/configuration/__init__.py | 8 ++++++++ hyperglass/configuration/configuration.toml.example | 1 + hyperglass/render/__init__.py | 5 ++++- hyperglass/render/templates/footer.md | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/hyperglass/configuration/__init__.py b/hyperglass/configuration/__init__.py index 3dc9438..da1a039 100644 --- a/hyperglass/configuration/__init__.py +++ b/hyperglass/configuration/__init__.py @@ -78,6 +78,14 @@ class gen: else: return g["primary_asn"] + def org_name(): + list = [] + for g in general: + if len(g["org_name"]) == 0: + return "The Company" + else: + return g["org_name"] + def debug(): list = [] for a in general: diff --git a/hyperglass/configuration/configuration.toml.example b/hyperglass/configuration/configuration.toml.example index 11ac3af..831556f 100644 --- a/hyperglass/configuration/configuration.toml.example +++ b/hyperglass/configuration/configuration.toml.example @@ -1,6 +1,7 @@ # General site-wide parameters [[general]] primary_asn = "" +org_name = "" debug = false google_analytics = "" message_error = "" diff --git a/hyperglass/render/__init__.py b/hyperglass/render/__init__.py index 7353d52..176f417 100644 --- a/hyperglass/render/__init__.py +++ b/hyperglass/render/__init__.py @@ -19,7 +19,9 @@ env = jinja2.Environment(loader=file_loader) # Converts templates/footer.md from Markdown to HTML md = Markdown() footer_template = env.get_template("templates/footer.md") -footer_jinja = footer_template.render(title=configuration.brand.title()) +footer_jinja = footer_template.render( + site_title=configuration.brand.site_title(), org_name=configuration.gen.org_name() +) footer = footer_jinja # Functions for rendering Jinja2 templates & importing variables @@ -38,6 +40,7 @@ class html: return template.render( # General primary_asn=configuration.gen.primary_asn(), + org_name=configuration.gen.org_name(), google_analytics=configuration.gen.google_analytics(), enable_recaptcha=configuration.gen.enable_recaptcha(), enable_bgp_route=configuration.gen.enable_bgp_route(), diff --git a/hyperglass/render/templates/footer.md b/hyperglass/render/templates/footer.md index 0e4efbe..2341ce1 100644 --- a/hyperglass/render/templates/footer.md +++ b/hyperglass/render/templates/footer.md @@ -1 +1 @@ -By using {{ title }}, you agree to be bound by the following terms of use: All queries executed on this page are logged for analysis and troubleshooting. Users are prohibited from automating queries, or attempting to process queries in bulk. This service is provided on a best effort basis, and {{ title }} makes no availability or performance warranties or guarantees whatsoever. +By using {{ site_title }}, you agree to be bound by the following terms of use: All queries executed on this page are logged for analysis and troubleshooting. Users are prohibited from automating queries, or attempting to process queries in bulk. This service is provided on a best effort basis, and {{ org_name }} makes no availability or performance warranties or guarantees whatsoever.