diff --git a/webapp/home/api.py b/webapp/home/api.py index a63cb0ba..3d86ba09 100644 --- a/webapp/home/api.py +++ b/webapp/home/api.py @@ -4,7 +4,7 @@ from django.http import JsonResponse, HttpResponse, HttpResponseBadRequest from utils.institution import is_institution_email -from .forms import SupportRequestForm +from .forms import LabFeedbackForm SESSION_COUNT_LIMIT = 5 @@ -30,13 +30,13 @@ def dismiss_notice(request): return HttpResponse('OK', status=201) -def subdomain_feedback(request, subdomain): +def lab_feedback(request, subdomain): """Process feedback form for *.usegalaxy.org.au subsites.""" if request.method != 'POST': return HttpResponseBadRequest() - form = SupportRequestForm(request.POST) + form = LabFeedbackForm(request.POST) if form.is_valid(): - form.dispatch(subject=f"{subdomain.title()} subdomain feedback") + form.dispatch(subject=f"{subdomain.title()} Lab feedback") return JsonResponse({'success': True}) return JsonResponse({ 'success': False, diff --git a/webapp/home/forms.py b/webapp/home/forms.py index 6fb395e5..02267294 100644 --- a/webapp/home/forms.py +++ b/webapp/home/forms.py @@ -212,6 +212,25 @@ def dispatch(self, subject=None): ) +class LabFeedbackForm(SupportRequestForm): + + to_address = forms.EmailField(required=False) + + def dispatch(self, subject=None): + """Dispatch content via the FreshDesk API.""" + data = self.cleaned_data + dispatch_form_mail( + to_address=data['to_address'] or settings.EMAIL_TO_ADDRESS, + reply_to=data['email'], + subject=subject or "Galaxy Australia Lab feedback", + text=( + f"Name: {data['name']}\n" + f"Email: {data['email']}\n\n" + + data['message'] + ) + ) + + class BaseAccessRequestForm(forms.Form): """Abstract form for requesting access to a resource. diff --git a/webapp/home/templates/home/subdomains/components/feedback-modal.html b/webapp/home/templates/home/subdomains/components/feedback-modal.html new file mode 100644 index 00000000..c69385c0 --- /dev/null +++ b/webapp/home/templates/home/subdomains/components/feedback-modal.html @@ -0,0 +1,135 @@ + + +{% load static %} + + + + diff --git a/webapp/home/templates/home/subdomains/exported.html b/webapp/home/templates/home/subdomains/exported.html index 700ef0d6..92d55809 100644 --- a/webapp/home/templates/home/subdomains/exported.html +++ b/webapp/home/templates/home/subdomains/exported.html @@ -64,6 +64,11 @@ +{% if feedback_email %} +{% include 'home/subdomains/components/feedback-modal.html' %} +{% endif %} + + {% if snippets.footer_md %} {{ snippets.footer_md|markdown }} {% endif %} diff --git a/webapp/home/templates/home/subdomains/genome.html b/webapp/home/templates/home/subdomains/genome.html deleted file mode 100644 index 84bc0925..00000000 --- a/webapp/home/templates/home/subdomains/genome.html +++ /dev/null @@ -1,110 +0,0 @@ -{% extends extend_template %} - -{% comment %} - This template renders the Genome Lab subdomain landing page. - See webapp/home/subdomains/genome for content to be rendered into this - template (sections, tools, workflows, etc). -{% endcomment %} - -{% load static %} - - -{% block head %} - - - - - - - - - -{% endblock %} - - -{% block content %} - -
- {% include 'home/subdomains/components/genome-community-modal.html' %} - {% include 'home/subdomains/components/info-modal.html' with subdomain='genome' site_name="Genome Lab" researchers="genomics" %} - {% include 'home/subdomains/components/feedback.html' with subdomain='genome' %} - -
- {% if snippets.header_logo %} - - {% else %} - - {% endif %} - {{ lab_name|default:"Genome Lab"|upper }} -
- - {% if snippets.intro_md %} - {{ snippets.intro_md|safe }} - {% else %} -
- {% include 'home/snippets/static-notices.html' %} - {% include 'home/snippets/cover-image.html' %} - -

- Welcome to the Galaxy {{ site_name }} {{ lab_name|default:"Genome Lab" }}. Get quick access to tools, workflows and tutorials for genome assembly and annotation. -
- - What is this page? - -

-
- {% endif %} - - {% for section in sections %} - {% include 'home/subdomains/components/section.html' with section=section %} - {% endfor %} - - {% if not export %} -
-

What's happening in {{ nationality }} genomics research?

- -
-
-

What do you think of the Genome Lab?

- -
- {% endif %} -
- - -{% if snippets.footer_md %} -{{ snippets.footer_md|safe }} -{% endif %} - -{% endblock %} - - -{% block script %} -{% endblock %} - - -{% block onload %} - // Ensure that notice links open in new tab if external - $('.notice a').each( (i, item) => { - if (!item.href.includes("{{ HOSTNAME }}")) { - item.target = '_blank'; - } - }); -{% endblock %} diff --git a/webapp/home/templates/home/subdomains/proteomics.html b/webapp/home/templates/home/subdomains/proteomics.html deleted file mode 100644 index ac5ae84f..00000000 --- a/webapp/home/templates/home/subdomains/proteomics.html +++ /dev/null @@ -1,156 +0,0 @@ -{% extends 'home/header.html' %} - -{% comment %} - This template renders the Proteomics Lab subdomain landing page. - See webapp/home/subdomains/proteomics for content to be rendered into this - template (sections, tools, workflows, etc). -{% endcomment %} - -{% load static %} - - -{% block head %} - - - - - - -{% endblock %} - - -{% block content %} - -
- {% include 'home/subdomains/components/proteomics-community-modal.html' %} - {% include 'home/subdomains/components/info-modal.html' with subdomain='proteomics' site_name="Proteomics Lab" researchers="proteomics" %} - {% include 'home/subdomains/components/feedback.html' with subdomain='proteomics' %} - -
- - PROTEOMICS LAB -
- -
- {% include 'home/snippets/static-notices.html' %} - {% include 'home/snippets/cover-image.html' %} - -

- Welcome to the Galaxy Australia Proteomics Lab. Get quick access to the - tools, workflows and tutorials you need to get started with proteomics on - Galaxy. -
- - What is this page? - -

- -

- This page is currently under development in consultation with the - - Australian Proteomics Bioinformatics community. -

-
- -
- -
- -
- -
- - {% include 'home/snippets/header-cards.html' %} - - {% for section in sections %} - {% include 'home/subdomains/components/section.html' with section=section %} - {% endfor %} - - -
- -{% endblock %} - - -{% block script %} -{% endblock %} - - -{% block onload %} - // Ensure that notice links open in new tab if external - $('.notice a').each( (i, item) => { - if (!item.href.includes("{{ HOSTNAME }}")) { - item.target = '_blank'; - } - }); -{% endblock %} diff --git a/webapp/home/urls.py b/webapp/home/urls.py index 640e250f..297d0bb9 100644 --- a/webapp/home/urls.py +++ b/webapp/home/urls.py @@ -10,7 +10,7 @@ path('notice/dismiss', api.dismiss_notice, name="api_notice_dismiss"), path('notice/', views.notice, name="home_notice"), path('lab/export', views.export_lab, name="home_export_lab"), - path('landing/', views.landing, name="home_landing"), + path('lab/feedback/', api.lab_feedback, name="lab_feedback"), path('request', views.user_request, name="user_request"), path('request/tool', views.user_request_tool, name="user_request_tool"), path('request/quota', views.user_request_quota, name="user_request_quota"), @@ -24,9 +24,6 @@ views.user_request_resource_access, name="user_request_resource_access"), path('aaf', views.aaf_info, name="home_aaf_info"), - path('feedback/', - api.subdomain_feedback, - name="subdomain_feedback"), path('unsubscribe', views.unsubscribe_user, name="unsubscribe_user"), path('institution/validate', api.validate_institutional_email,