Rename JS file, use code icon and other fixes
This commit is contained in:
parent
df521783f8
commit
a30c737920
4 changed files with 11 additions and 12 deletions
|
@ -6,6 +6,6 @@ from .views import choose_snippet_link_model, choose_snippet_embed_model
|
||||||
app_name = "wagtaildraftailsnippet"
|
app_name = "wagtaildraftailsnippet"
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r"^choose-link-model/$", choose_snippet_link_model, name="choose_snippet_link_model"),
|
url(r"^choose-link-model/$", choose_snippet_link_model, name="choose-snippet-link-model"),
|
||||||
url(r"^choose-embed-model/$", choose_snippet_embed_model, name="choose_snippet_embed_model"),
|
url(r"^choose-embed-model/$", choose_snippet_embed_model, name="choose-snippet-embed-model"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
from wagtail.core.utils import camelcase_to_underscore
|
|
||||||
|
|
||||||
|
|
||||||
def get_snippet_link_frontend_template(app_name, 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))
|
return "%s/%s_snippet_link.html" % (app_name, model_name)
|
||||||
|
|
||||||
|
|
||||||
def get_snippet_embed_frontend_template(app_name, model_name):
|
def get_snippet_embed_frontend_template(app_name, model_name):
|
||||||
return "%s/%s_snippet_embed.html" % (app_name, camelcase_to_underscore(model_name))
|
return "%s/%s_snippet_embed.html" % (app_name, model_name)
|
||||||
|
|
|
@ -3,13 +3,13 @@ from django.urls import reverse
|
||||||
from django.utils.html import format_html
|
from django.utils.html import format_html
|
||||||
from django.utils.translation import ugettext
|
from django.utils.translation import ugettext
|
||||||
|
|
||||||
import wagtail.admin.rich_text.editors.draftail.features as draftail_features
|
from wagtail.admin.rich_text.editors.draftail import features as draftail_features
|
||||||
from wagtail.core import hooks
|
from wagtail.core import hooks
|
||||||
|
|
||||||
from . import urls
|
from . import urls
|
||||||
from .richtext import (
|
from .richtext import (
|
||||||
ContentstateSnippetLinkConversionRule, ContentstateSnippetEmbedConversionRule,
|
ContentstateSnippetLinkConversionRule, ContentstateSnippetEmbedConversionRule,
|
||||||
SnippetEmbedHandler, SnippetLinkHandler
|
SnippetLinkHandler, SnippetEmbedHandler,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ def register_snippet_link_feature(features):
|
||||||
js=[
|
js=[
|
||||||
"wagtailsnippets/js/snippet-chooser-modal.js",
|
"wagtailsnippets/js/snippet-chooser-modal.js",
|
||||||
"wagtail_draftail_snippet/js/snippet-model-chooser-modal.js",
|
"wagtail_draftail_snippet/js/snippet-model-chooser-modal.js",
|
||||||
"wagtail_draftail_snippet/js/wagtail_draftail_snippet.js",
|
"wagtail_draftail_snippet/js/wagtail-draftail-snippet.js",
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -49,11 +49,11 @@ def register_snippet_embed_feature(features):
|
||||||
"draftail",
|
"draftail",
|
||||||
feature_name,
|
feature_name,
|
||||||
draftail_features.EntityFeature(
|
draftail_features.EntityFeature(
|
||||||
{"type": type_, "icon": "media", "description": ugettext("Snippet Embed")},
|
{"type": type_, "icon": "code", "description": ugettext("Snippet Embed")},
|
||||||
js=[
|
js=[
|
||||||
"wagtailsnippets/js/snippet-chooser-modal.js",
|
"wagtailsnippets/js/snippet-chooser-modal.js",
|
||||||
"wagtail_draftail_snippet/js/snippet-model-chooser-modal.js",
|
"wagtail_draftail_snippet/js/snippet-model-chooser-modal.js",
|
||||||
"wagtail_draftail_snippet/js/wagtail_draftail_snippet.js",
|
"wagtail_draftail_snippet/js/wagtail-draftail-snippet.js",
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -72,8 +72,8 @@ def editor_js():
|
||||||
window.chooserUrls.snippetEmbedModelChooser = '{1}';
|
window.chooserUrls.snippetEmbedModelChooser = '{1}';
|
||||||
</script>
|
</script>
|
||||||
""",
|
""",
|
||||||
reverse("wagtaildraftailsnippet:choose_snippet_link_model"),
|
reverse("wagtaildraftailsnippet:choose-snippet-link-model"),
|
||||||
reverse("wagtaildraftailsnippet:choose_snippet_embed_model"),
|
reverse("wagtaildraftailsnippet:choose-snippet-embed-model"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue