Skip to content

Commit bfb8855

Browse files
committed
Rename LinkPlugin to TextLinkPlugin
2 parents 3a44667 + 17278bc commit bfb8855

File tree

4 files changed

+30
-7
lines changed

4 files changed

+30
-7
lines changed

djangocms_frontend/contrib/link/cms_plugins.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def get_fieldsets(self, request, obj=None):
8181
return fieldsets
8282

8383

84-
class LinkPlugin(mixin_factory("Link"), AttributesMixin, SpacingMixin, LinkPluginMixin, CMSUIPlugin):
84+
class TextLinkPlugin(mixin_factory("Link"), AttributesMixin, SpacingMixin, LinkPluginMixin, CMSUIPlugin):
8585
"""
8686
Components > "Button" Plugin
8787
https://getbootstrap.com/docs/5.0/components/buttons/
@@ -113,7 +113,6 @@ def get_plugin_urls(self):
113113
]
114114

115115

116-
if "djangocms_frontend.contrib.link" in django_settings.INSTALLED_APPS and "LinkPlugin" not in plugin_pool.plugins:
116+
if "djangocms_frontend.contrib.link" in django_settings.INSTALLED_APPS:
117117
# Only register plugin if in INSTALLED_APPS
118-
119-
plugin_pool.register_plugin(LinkPlugin)
118+
plugin_pool.register_plugin(TextLinkPlugin)

djangocms_frontend/contrib/link/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def get_link_choices(request, term="", lang=None, nbsp=None):
8585
dict(
8686
id=f"{type_id}-{page}",
8787
# django admin's autocomplete view requires unescaped strings
88-
# get_page_choices escepes strings, so we undo the escape
88+
# get_page_choices escapes strings, so we undo the escape
8989
text=unescape(name, nbsp),
9090
)
9191
for page, name in descr
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Generated by Django 5.0.6 on 2024-05-22 20:33
2+
3+
from django.db import migrations
4+
5+
6+
def rename(apps, old_name, new_name):
7+
UIItem = apps.get_model("djangocms_frontend", "FrontendUIItem")
8+
UIItem.objects.filter(ui_item=old_name).update(ui_item=new_name, plugin_type=f"{new_name}Plugin")
9+
10+
11+
class Migration(migrations.Migration):
12+
13+
dependencies = [
14+
('link', '0001_initial'),
15+
]
16+
17+
18+
operations = [
19+
migrations.RunPython(
20+
lambda apps, schema_editor: rename(apps, "Link", "TextLink"),
21+
lambda apps, schema_editor: rename(apps, "TextLink", "Link"),
22+
elidable=True,
23+
),
24+
]

djangocms_frontend/contrib/navigation/cms_plugins.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from ...common.background import BackgroundMixin
88
from ...helpers import first_choice, get_plugin_template, get_template_path
99
from .. import navigation
10-
from ..link.cms_plugins import LinkPlugin, LinkPluginMixin
10+
from ..link.cms_plugins import LinkPluginMixin, TextLinkPlugin
1111
from . import forms, models
1212

1313
mixin_factory = settings.get_renderer(navigation)
@@ -166,7 +166,7 @@ class NavContainerPlugin(
166166
@plugin_pool.register_plugin
167167
class NavLinkPlugin(
168168
mixin_factory("NavLink"),
169-
LinkPlugin,
169+
TextLinkPlugin,
170170
):
171171
"""
172172
A plugin that allows creating navigation links for the frontend.

0 commit comments

Comments
 (0)