From 417bf07be0088dce6a0c3d5432df8875dbd6b5a9 Mon Sep 17 00:00:00 2001 From: Alice Heaton <aliceh@aptivate.org> Date: Thu, 6 Aug 2015 11:14:21 +0100 Subject: [PATCH] Add a basic html tab for tabs that just contain text (and for testing) --- django/website/tabbed_page/tab_pool.py | 23 +++++++++++++++++++ .../templates/tabbed_page/basic_html_tab.html | 12 ++++++++++ 2 files changed, 35 insertions(+) create mode 100644 django/website/tabbed_page/templates/tabbed_page/basic_html_tab.html diff --git a/django/website/tabbed_page/tab_pool.py b/django/website/tabbed_page/tab_pool.py index f3aa1ee9..cf8e2c7f 100644 --- a/django/website/tabbed_page/tab_pool.py +++ b/django/website/tabbed_page/tab_pool.py @@ -24,3 +24,26 @@ def clear_tabs(): global _pool _pool = {} + + +class BasicHtmlTab(object): + """ A simple tab to display html + + Settings: + title: The title of the tab + (in the header, not in + the tab) + body: The tab html + """ + template_name = 'tabbed_page/basic_html_tab.html' + + def get_context_data(self, **kwargs): + title = kwargs.get('title', '(no title)') + body = kwargs.get('body', '(no body)') + return { + 'title': title, + 'body': body + } + + +register_tab('basic-html-tab', BasicHtmlTab()) diff --git a/django/website/tabbed_page/templates/tabbed_page/basic_html_tab.html b/django/website/tabbed_page/templates/tabbed_page/basic_html_tab.html new file mode 100644 index 00000000..c9542322 --- /dev/null +++ b/django/website/tabbed_page/templates/tabbed_page/basic_html_tab.html @@ -0,0 +1,12 @@ +{% load i18n %} +<div class="panel panel-default"> + <div class="panel-heading container-fluid"> + <div class="col-sm-5 col-xs-12"> + <span class="fa fa-align-justify fa-fw"></span> + {% trans title %} + </div> + </div> + <div class="panel-body"> + {{ body|safe }} + </div> +</div> -- GitLab