From 5ab95863195314efc1fd5f01c7f8708a5ce8094d Mon Sep 17 00:00:00 2001 From: Christina Lin <44586776+chrstinalin@users.noreply.github.com> Date: Thu, 3 Apr 2025 16:13:07 -0400 Subject: [PATCH] Link Extension Workshop for Markdown Field Syntax --- .../devhub/templates/devhub/addons/edit/describe.html | 4 ++-- .../devhub/templates/devhub/addons/edit/technical.html | 4 ++-- .../devhub/templates/devhub/addons/submit/describe.html | 6 +++--- src/olympia/devhub/templates/devhub/includes/macros.html | 7 ++----- .../devhub/templates/devhub/includes/policy_form.html | 6 +++--- src/olympia/devhub/templates/devhub/versions/edit.html | 4 ++-- src/olympia/devhub/views.py | 4 ---- src/olympia/translations/models.py | 4 ---- 8 files changed, 14 insertions(+), 25 deletions(-) diff --git a/src/olympia/devhub/templates/devhub/addons/edit/describe.html b/src/olympia/devhub/templates/devhub/addons/edit/describe.html index 97e0a9c3e3f8..83584e366b24 100644 --- a/src/olympia/devhub/templates/devhub/addons/edit/describe.html +++ b/src/olympia/devhub/templates/devhub/addons/edit/describe.html @@ -1,4 +1,4 @@ -{% from "devhub/includes/macros.html" import tip, empty_unless, flags, select_cats, supported_syntax_tip, trans_readonly %} +{% from "devhub/includes/macros.html" import tip, empty_unless, flags, select_cats, supported_syntax_link, trans_readonly %}
- {{ supported_syntax_tip(allowed_markdown) }} + {{ supported_syntax_link(settings) }} {% else %} {% call empty_unless(addon.description) %}
diff --git a/src/olympia/devhub/templates/devhub/addons/edit/technical.html b/src/olympia/devhub/templates/devhub/addons/edit/technical.html index c9269afb8b71..1fa3408aedda 100644 --- a/src/olympia/devhub/templates/devhub/addons/edit/technical.html +++ b/src/olympia/devhub/templates/devhub/addons/edit/technical.html @@ -1,4 +1,4 @@ -{% from "devhub/includes/macros.html" import tip, supported_syntax_tip, empty_unless, flags %} +{% from "devhub/includes/macros.html" import tip, supported_syntax_link, empty_unless, flags %} @@ -32,7 +32,7 @@

{% if editable %} {{ main_form.developer_comments }} {{ main_form.developer_comments.errors }} - {{ supported_syntax_tip(allowed_markdown) }} + {{ supported_syntax_link(settings) }} {% else %} {% call empty_unless(addon.developer_comments) %}
{{ addon|all_locales('developer_comments', nl2br=True) }}
diff --git a/src/olympia/devhub/templates/devhub/addons/submit/describe.html b/src/olympia/devhub/templates/devhub/addons/submit/describe.html index 01ef7e266eee..3ae8cd9f4dc2 100644 --- a/src/olympia/devhub/templates/devhub/addons/submit/describe.html +++ b/src/olympia/devhub/templates/devhub/addons/submit/describe.html @@ -1,4 +1,4 @@ -{% from "devhub/includes/macros.html" import supported_syntax_tip, select_cats %} +{% from "devhub/includes/macros.html" import supported_syntax_link, select_cats %} {% from "includes/forms.html" import tip %} {% extends "devhub/addons/submit/base.html" %} @@ -113,7 +113,7 @@

{{ _('Describe Add-on') }}

data-for-startswith="{{ describe_form.description.auto_id }}_" data-minlength="{{ describe_form.description.field.min_length }}">
- {{ supported_syntax_tip(allowed_markdown) }} + {{ supported_syntax_link(settings) }} {% endif %} {% if addon.type != amo.ADDON_STATICTHEME %} @@ -180,7 +180,7 @@

{{ _('Describe Add-on') }}

{{ license_form.text.errors }} {{ license_form.text.label_tag() }} {{ license_form.text }} - {{ supported_syntax_tip(allowed_markdown) }} + {{ supported_syntax_link(settings) }} {% endif %} diff --git a/src/olympia/devhub/templates/devhub/includes/macros.html b/src/olympia/devhub/templates/devhub/includes/macros.html index 142af8d7206c..b687429a95d4 100644 --- a/src/olympia/devhub/templates/devhub/includes/macros.html +++ b/src/olympia/devhub/templates/devhub/includes/macros.html @@ -1,11 +1,8 @@ {% extends "includes/forms.html" %} -{% macro supported_syntax_tip(allowed_markdown, title=None) %} +{% macro supported_syntax_link(settings) %}

-{# L10n: %s is a list of markdown syntax. #} -{{ _('Some Markdown supported.') }} + {{ _('Some Markdown supported.') }}

{% endmacro %} diff --git a/src/olympia/devhub/templates/devhub/includes/policy_form.html b/src/olympia/devhub/templates/devhub/includes/policy_form.html index 3700912f50d3..3cecd34d18c6 100644 --- a/src/olympia/devhub/templates/devhub/includes/policy_form.html +++ b/src/olympia/devhub/templates/devhub/includes/policy_form.html @@ -1,4 +1,4 @@ -{% from "devhub/includes/macros.html" import tip, supported_syntax_tip %} +{% from "devhub/includes/macros.html" import tip, supported_syntax_link %} {{ tip(_('End-User License Agreement'), _('Please note that a EULA is not ' @@ -13,7 +13,7 @@ {{ policy_form.eula.label }} {{ policy_form.eula }} - {{ supported_syntax_tip(allowed_markdown) }} + {{ supported_syntax_link(settings) }} @@ -31,7 +31,7 @@ {{ policy_form.privacy_policy.label }} {{ policy_form.privacy_policy }} - {{ supported_syntax_tip(allowed_markdown) }} + {{ supported_syntax_link(settings) }} diff --git a/src/olympia/devhub/templates/devhub/versions/edit.html b/src/olympia/devhub/templates/devhub/versions/edit.html index f0114707975a..d5c829ea1b8b 100644 --- a/src/olympia/devhub/templates/devhub/versions/edit.html +++ b/src/olympia/devhub/templates/devhub/versions/edit.html @@ -1,6 +1,6 @@ {% extends "devhub/base.html" %} -{% from "devhub/includes/macros.html" import tip, supported_syntax_tip, empty_unless, compat %} +{% from "devhub/includes/macros.html" import tip, supported_syntax_link, empty_unless, compat %} {% set title = _('Manage Version {0}')|format_html(version.version) %} @@ -73,7 +73,7 @@

{{ title }}

{{ field.errors }} {{ field }} - {{ supported_syntax_tip(allowed_markdown) }} + {{ supported_syntax_link(settings) }} {% endwith %} diff --git a/src/olympia/devhub/views.py b/src/olympia/devhub/views.py index 9d80882d9fcb..273c33d3c9d4 100644 --- a/src/olympia/devhub/views.py +++ b/src/olympia/devhub/views.py @@ -71,7 +71,6 @@ from olympia.reviewers.forms import PublicWhiteboardForm from olympia.reviewers.models import Whiteboard from olympia.reviewers.utils import ReviewHelper -from olympia.translations.models import PurifiedTranslation from olympia.users.models import ( DeveloperAgreementRestriction, SuppressedEmailVerification, @@ -962,7 +961,6 @@ def addons_section(request, addon_id, addon, section, editable=False): 'whiteboard_form': whiteboard_form, 'valid_slug': valid_slug, 'supported_image_types': amo.SUPPORTED_IMAGE_TYPES, - 'allowed_markdown': PurifiedTranslation.get_allowed_tags(), } return TemplateResponse( @@ -1176,7 +1174,6 @@ def version_edit(request, addon_id, addon, version_id): 'is_admin': is_admin, 'choices': File.STATUS_CHOICES, 'files': (version.file,), - 'allowed_markdown': PurifiedTranslation.get_allowed_tags(), } ) @@ -1813,7 +1810,6 @@ def _submit_details(request, addon, version): 'version': version, 'sources_provided': latest_version.sources_provided, 'submit_page': 'version' if version else 'addon', - 'allowed_markdown': PurifiedTranslation.get_allowed_tags(), } post_data = request.POST if request.method == 'POST' else None diff --git a/src/olympia/translations/models.py b/src/olympia/translations/models.py index fca8b18dff26..f77422581370 100644 --- a/src/olympia/translations/models.py +++ b/src/olympia/translations/models.py @@ -240,10 +240,6 @@ def clean_localized_string(self): return cleaner.clean(str(self.localized_string)) - @classmethod - def get_allowed_tags(cls): - return ', '.join(cls.allowed_tags) - class PurifiedMarkdownTranslation(PurifiedTranslation): class Meta: