From df521783f8230e7004b753b4421ee74ac0871876 Mon Sep 17 00:00:00 2001 From: Parbhat Puri Date: Fri, 3 Apr 2020 20:02:17 +0530 Subject: [PATCH] Rename current Snippet feature snippet to snippet-link --- wagtail_draftail_snippet/richtext.py | 4 ++-- wagtail_draftail_snippet/utils.py | 4 ++-- wagtail_draftail_snippet/views.py | 4 ++-- wagtail_draftail_snippet/wagtail_hooks.py | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/wagtail_draftail_snippet/richtext.py b/wagtail_draftail_snippet/richtext.py index e6d8705..5320403 100644 --- a/wagtail_draftail_snippet/richtext.py +++ b/wagtail_draftail_snippet/richtext.py @@ -6,7 +6,7 @@ from wagtail.admin.rich_text.converters.contentstate_models import Entity from wagtail.admin.rich_text.converters.html_to_contentstate import LinkElementHandler, AtomicBlockEntityElementHandler from wagtail.core.rich_text import EmbedHandler, LinkHandler -from .utils import get_snippet_frontend_template, get_snippet_embed_frontend_template +from .utils import get_snippet_link_frontend_template, get_snippet_embed_frontend_template # Snippet Link @@ -22,7 +22,7 @@ class SnippetLinkHandler(LinkHandler): @classmethod def get_template(cls, attrs): - return get_snippet_frontend_template( + return get_snippet_link_frontend_template( attrs["data-app-name"], attrs["data-model-name"] ) diff --git a/wagtail_draftail_snippet/utils.py b/wagtail_draftail_snippet/utils.py index 1879ae8..74c5514 100644 --- a/wagtail_draftail_snippet/utils.py +++ b/wagtail_draftail_snippet/utils.py @@ -1,8 +1,8 @@ from wagtail.core.utils import camelcase_to_underscore -def get_snippet_frontend_template(app_name, model_name): - return "%s/%s_snippet.html" % (app_name, camelcase_to_underscore(model_name)) +def get_snippet_link_frontend_template(app_name, model_name): + return "%s/%s_snippet_link.html" % (app_name, camelcase_to_underscore(model_name)) def get_snippet_embed_frontend_template(app_name, model_name): diff --git a/wagtail_draftail_snippet/views.py b/wagtail_draftail_snippet/views.py index 50ec16f..f5c028f 100644 --- a/wagtail_draftail_snippet/views.py +++ b/wagtail_draftail_snippet/views.py @@ -3,7 +3,7 @@ from django.template.loader import TemplateDoesNotExist, get_template from wagtail.admin.modal_workflow import render_modal_workflow from wagtail.snippets.models import get_snippet_models -from .utils import get_snippet_frontend_template, get_snippet_embed_frontend_template +from .utils import get_snippet_link_frontend_template, get_snippet_embed_frontend_template def choose_snippet_link_model(request): @@ -11,7 +11,7 @@ def choose_snippet_link_model(request): # Only display those snippet models which have snippet link frontend template for snippet_model in get_snippet_models(): - snippet_frontend_template = get_snippet_frontend_template( + snippet_frontend_template = get_snippet_link_frontend_template( snippet_model._meta.app_label, snippet_model._meta.model_name ) diff --git a/wagtail_draftail_snippet/wagtail_hooks.py b/wagtail_draftail_snippet/wagtail_hooks.py index e6f7bed..4b7814e 100644 --- a/wagtail_draftail_snippet/wagtail_hooks.py +++ b/wagtail_draftail_snippet/wagtail_hooks.py @@ -14,8 +14,8 @@ from .richtext import ( @hooks.register("register_rich_text_features") -def register_snippet_feature(features): - feature_name = "snippet" +def register_snippet_link_feature(features): + feature_name = "snippet-link" type_ = "SNIPPET" features.register_link_type(SnippetLinkHandler) @@ -24,7 +24,7 @@ def register_snippet_feature(features): "draftail", feature_name, draftail_features.EntityFeature( - {"type": type_, "icon": "snippet", "description": ugettext("Snippet")}, + {"type": type_, "icon": "snippet", "description": ugettext("Snippet Link")}, js=[ "wagtailsnippets/js/snippet-chooser-modal.js", "wagtail_draftail_snippet/js/snippet-model-chooser-modal.js",