From 9fe9983bf9e00284c041c725fd37af7c2ffd16b7 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 24 Dec 2022 14:56:12 -0600 Subject: [PATCH] Add basic support for editing page help info site admin should be able to point help wherever they want --- tailbone/helpers.py | 3 +- tailbone/static/themes/falafel/css/layout.css | 13 ++ tailbone/templates/generate_feature.mako | 17 +- tailbone/templates/page_help.mako | 204 ++++++++++++++++++ tailbone/templates/themes/falafel/base.mako | 20 +- tailbone/util.py | 12 ++ tailbone/views/common.py | 2 + tailbone/views/master.py | 72 +++++++ 8 files changed, 315 insertions(+), 28 deletions(-) create mode 100644 tailbone/templates/page_help.mako diff --git a/tailbone/helpers.py b/tailbone/helpers.py index a3d07f79..750d3f39 100644 --- a/tailbone/helpers.py +++ b/tailbone/helpers.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2021 Lance Edgar +# Copyright © 2010-2022 Lance Edgar # # This file is part of Rattail. # @@ -40,6 +40,7 @@ from webhelpers2.html.tags import * from tailbone.util import (csrf_token, get_csrf_token, pretty_datetime, raw_datetime, + render_markdown, route_exists) diff --git a/tailbone/static/themes/falafel/css/layout.css b/tailbone/static/themes/falafel/css/layout.css index b0fd0cc9..cc4d0015 100644 --- a/tailbone/static/themes/falafel/css/layout.css +++ b/tailbone/static/themes/falafel/css/layout.css @@ -112,6 +112,19 @@ header .level .theme-picker { margin-top: 1em; } +/****************************** + * markdown + ******************************/ + +.rendered-markdown p, +.rendered-markdown ul { + margin-bottom: 1rem; +} + +.rendered-markdown .codehilite { + margin-bottom: 2rem; +} + /****************************** * fix datepicker within modals * TODO: someday this may not be necessary? cf. diff --git a/tailbone/templates/generate_feature.mako b/tailbone/templates/generate_feature.mako index 005cc3c2..10d3d265 100644 --- a/tailbone/templates/generate_feature.mako +++ b/tailbone/templates/generate_feature.mako @@ -5,21 +5,6 @@ <%def name="content_title()"> -<%def name="extra_styles()"> - ${parent.extra_styles()} - - - <%def name="page_content()">
-
${rendered_result or ""|n}
+
${rendered_result or ""|n}
diff --git a/tailbone/templates/page_help.mako b/tailbone/templates/page_help.mako new file mode 100644 index 00000000..cd13011e --- /dev/null +++ b/tailbone/templates/page_help.mako @@ -0,0 +1,204 @@ +## -*- coding: utf-8; -*- + +<%def name="render_template()"> + + + +<%def name="declare_vars()"> + + + +<%def name="make_component()"> + + diff --git a/tailbone/templates/themes/falafel/base.mako b/tailbone/templates/themes/falafel/base.mako index fe3ef429..e46be1a5 100644 --- a/tailbone/templates/themes/falafel/base.mako +++ b/tailbone/templates/themes/falafel/base.mako @@ -3,6 +3,7 @@ <%namespace file="/autocomplete.mako" import="tailbone_autocomplete_template" /> <%namespace name="base_meta" file="/base_meta.mako" /> <%namespace file="/formposter.mako" import="declare_formposter_mixin" /> +<%namespace name="page_help" file="/page_help.mako" /> @@ -383,17 +384,9 @@ % endif - ## Help Button - % if help_url is not Undefined and help_url: -
- - Help - -
- % endif +
+ +
## Feedback Button / Dialog % if request.has_perm('common.feedback'): @@ -466,6 +459,8 @@ + ${page_help.render_template()} +