From 4934ed1d931197b0e80edd174bbff0a2e5f731f9 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 25 Aug 2024 20:25:14 -0500 Subject: [PATCH] feat: add basic user feedback email mechanism this definitely needs some more work. using pyramid_mailer for testing although not ready to declare that dependency. for now this is "broken" without it being installed. --- src/wuttaweb/templates/base.mako | 165 +++++++++++++++++- .../templates/temporary/feedback.html.mako | 40 +++++ .../templates/temporary/feedback.txt.mako | 23 +++ src/wuttaweb/templates/wutta-components.mako | 77 ++++++++ src/wuttaweb/views/common.py | 92 ++++++++++ tests/views/test_common.py | 66 +++++++ 6 files changed, 461 insertions(+), 2 deletions(-) create mode 100644 src/wuttaweb/templates/temporary/feedback.html.mako create mode 100644 src/wuttaweb/templates/temporary/feedback.txt.mako diff --git a/src/wuttaweb/templates/base.mako b/src/wuttaweb/templates/base.mako index 3b3f115..dbad2e2 100644 --- a/src/wuttaweb/templates/base.mako +++ b/src/wuttaweb/templates/base.mako @@ -420,7 +420,153 @@ <%def name="render_theme_picker()"> -<%def name="render_feedback_button()"> +<%def name="render_feedback_button()"> + % if request.has_perm('common.feedback'): + + % endif + + +<%def name="render_vue_template_feedback()"> + + + +<%def name="render_vue_script_feedback()"> + + <%def name="render_vue_script_whole_page()"> + % if request.has_perm('common.feedback'): + + % endif <%def name="make_vue_app()"> diff --git a/src/wuttaweb/templates/temporary/feedback.html.mako b/src/wuttaweb/templates/temporary/feedback.html.mako new file mode 100644 index 0000000..c483f1a --- /dev/null +++ b/src/wuttaweb/templates/temporary/feedback.html.mako @@ -0,0 +1,40 @@ +## -*- coding: utf-8 -*- + + + + + +

User feedback from website

+ + +

+ % if user: + ${user} + % else: + ${user_name} + % endif +

+ + +

${referrer}

+ + +

${client_ip}

+ + +

${message}

+ + + diff --git a/src/wuttaweb/templates/temporary/feedback.txt.mako b/src/wuttaweb/templates/temporary/feedback.txt.mako new file mode 100644 index 0000000..b0d396a --- /dev/null +++ b/src/wuttaweb/templates/temporary/feedback.txt.mako @@ -0,0 +1,23 @@ +## -*- coding: utf-8; -*- + +# User feedback from website + +**User Name** + +% if user: + ${user} +% else: + ${user_name} +% endif + +**Referring URL** + +${referrer} + +**Client IP** + +${client_ip} + +**Message** + +${message} diff --git a/src/wuttaweb/templates/wutta-components.mako b/src/wuttaweb/templates/wutta-components.mako index 888944e..b52992e 100644 --- a/src/wuttaweb/templates/wutta-components.mako +++ b/src/wuttaweb/templates/wutta-components.mako @@ -1,10 +1,87 @@ <%def name="make_wutta_components()"> + ${self.make_wutta_request_mixin()} ${self.make_wutta_button_component()} ${self.make_wutta_filter_component()} ${self.make_wutta_filter_value_component()} +<%def name="make_wutta_request_mixin()"> + + + <%def name="make_wutta_button_component()">