Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add initial djangocms-link support #22

Merged
merged 2 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions djangocms_text/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def check_ckeditor_settings(app_configs, **kwargs):
f"The TEXT_ADDITIONAL_TAGS setting is deprecated and will be removed in a future release.\n"
f"{change_msg}",
f"TEXT_ADDITIONAL_ATTRIBUTES = "
f"""{{{', '.join([f'"{tag}": set()' for tag in settings.TEXT_ADDITIONAL_TAGS])}\"}}""",
f"""{{{', '.join([f'"{tag}": set()' for tag in settings.TEXT_ADDITIONAL_TAGS])}\"}}\n""",
id="text.W001",
obj="settings.TEXT_ADDITIONAL_TAGS",
)
Expand All @@ -79,7 +79,7 @@ def check_ckeditor_settings(app_configs, **kwargs):
warnings.append(
Warning(
f"The TEXT_ADDITIONAL_ATTRIBUTES setting has changed.\n{change_msg}",
f'TEXT_ADDITIONAL_ATTRIBUTES = {{"*": {set(settings.TEXT_ADDITIONAL_ATTRIBUTES)}}}',
f'TEXT_ADDITIONAL_ATTRIBUTES = {{"*": {set(settings.TEXT_ADDITIONAL_ATTRIBUTES)}}}\n',
id="text.W002",
obj="settings.TEXT_ADDITIONAL_ATTRIBUTES",
)
Expand Down
2 changes: 1 addition & 1 deletion djangocms_text/cms_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ def get_available_urls(self, request):
# django CMS 3
qs = list(
PageContent.objects.filter(language=language, title__icontains=search).order_by("page__node__path")
)
)
for page_content in qs:
# Patch the missing get_absolute_url method
page_content.get_absolute_url = lambda: page_content.page.get_absolute_url()
Expand Down
24 changes: 12 additions & 12 deletions djangocms_text/editors.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,24 +155,24 @@ def default(self, obj):
},
{
"name": "href",
"label": _("Type URL or search for a page"),
"label": _("Type URL or search for a destination"),
"placeholder": _("URL or search"),
"type": "text",
"class": "js-linkfield",
"required": False,
},
# {type: 'hr'},
# {"type": 'hr'},
# {
# name: 'target',
# label: 'Target',
# type: 'select',
# options: [
# {value: '', label: '-----'},
# {value: '_blank', label: 'New window'},
# {value: '_self', label: 'Same window'},
# {value: '_parent', label: 'Parent window'},
# ],
# required: false,
# "name": 'target',
# "label": 'Target',
# "type": 'select',
# "options": [
# {"value": '', "label": '-----'},
# {"value": '_blank', "label": 'New window'},
# {"value": '_self', "label": 'Same window'},
# {"value": '_parent', "label": 'Parent window'},
# ],
# "required": False
# }
],
"icon": '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-link-45deg" viewBox="0 0 16 16">\n'
Expand Down
3 changes: 2 additions & 1 deletion djangocms_text/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def render_dynamic_attributes(
for elem in update_queue:
for attr, value in elem.attrib.items():
if attr.startswith(prefix):
target_attr = attr[len(prefix) :]
target_attr = attr[len(prefix):]
try:
model, pk = value.rsplit(":", 1)
obj = from_db[model.strip()][int(pk.strip())]
Expand All @@ -268,6 +268,7 @@ def render_dynamic_attributes(
doc = doc.removeprefix("<body>").removesuffix("</body>") # remove body tags added by lxml
return doc


def register_attr(attr: str, render_func: callable) -> None:
dynamic_attr_pool[attr] = render_func

Expand Down
122 changes: 59 additions & 63 deletions djangocms_text/locale/ar/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-02-15 12:43+0100\n"
"POT-Creation-Date: 2024-10-27 21:26+0100\n"
"PO-Revision-Date: 2019-01-23 16:28+0000\n"
"Last-Translator: Angelo Dini <[email protected]>, 2019\n"
"Language-Team: Arabic (https://www.transifex.com/divio/teams/58664/ar/)\n"
Expand All @@ -22,187 +22,195 @@ msgstr ""
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
"&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"

#: cms_plugins.py:386
#: cms_plugins.py:370
msgid "You do not have permission to add a plugin."
msgstr ""

#: cms_plugins.py:449
#: cms_plugins.py:434
msgid "Unable to process your request. Invalid token."
msgstr ""

#: cms_toolbars.py:58
msgid "Toggle inline editing mode for text plugins"
msgstr ""

#: editor_toolbars.py:29
#: editors.py:31
msgid "Undo"
msgstr ""

#: editor_toolbars.py:33
#: editors.py:35
msgid "Redo"
msgstr ""

#: editor_toolbars.py:37
#: editors.py:39
msgid "Bold"
msgstr ""

#: editor_toolbars.py:43
#: editors.py:45
msgid "Italic"
msgstr ""

#: editor_toolbars.py:49
#: editors.py:51
msgid "Underline"
msgstr ""

#: editor_toolbars.py:55
#: editors.py:57
msgid "Strike"
msgstr ""

#: editor_toolbars.py:59
#: editors.py:61
msgid "Subscript"
msgstr ""

#: editor_toolbars.py:65
#: editors.py:67
msgid "Superscript"
msgstr ""

#: editor_toolbars.py:71
#: editors.py:73
msgid "Remove formatting"
msgstr ""

#: editor_toolbars.py:84
#: editors.py:86
msgid "Align left"
msgstr ""

#: editor_toolbars.py:90
#: editors.py:92
msgid "Align center"
msgstr ""

#: editor_toolbars.py:96
#: editors.py:98
msgid "Align right"
msgstr ""

#: editor_toolbars.py:102
#: editors.py:104
msgid "Justify"
msgstr ""

#: editor_toolbars.py:108
#: editors.py:110
msgid "Horizontal rule"
msgstr ""

#: editor_toolbars.py:114
#: editors.py:116
msgid "Numbered list"
msgstr ""

#: editor_toolbars.py:121
#: editors.py:123
msgid "Bullet list"
msgstr ""

#: editor_toolbars.py:127
#: editors.py:129
msgid "Outdent"
msgstr ""

#: editor_toolbars.py:134
#: editors.py:136
msgid "Indent"
msgstr ""

#: editor_toolbars.py:141
#: editors.py:143
msgid "Blockquote"
msgstr ""

#: editor_toolbars.py:147 editor_toolbars.py:182
#: editors.py:149
msgid "Link"
msgstr ""

#: editor_toolbars.py:156
msgid "Type URL or search for a page"
#: editors.py:158
msgid "Type URL or search for a destination"
msgstr ""

#: editor_toolbars.py:157
#: editors.py:159
msgid "URL or search"
msgstr ""

#: editor_toolbars.py:189
msgid "Image"
msgstr ""

#: editor_toolbars.py:196
#: editors.py:184
msgid "Unlink"
msgstr ""

#: editor_toolbars.py:204
#: editors.py:192
msgid "Table"
msgstr ""

#: editor_toolbars.py:207
#: editors.py:196
msgid "Code"
msgstr ""

#: editor_toolbars.py:213
#: editors.py:202
msgid "Small"
msgstr ""

#: editor_toolbars.py:216
#: editors.py:205
msgid "Keyboard input"
msgstr ""

#: editor_toolbars.py:222
#: editors.py:211
msgid "Code block"
msgstr ""

#: editor_toolbars.py:229
#: editors.py:218
msgid "Heading 1"
msgstr ""

#: editor_toolbars.py:235
#: editors.py:224
msgid "Heading 2"
msgstr ""

#: editor_toolbars.py:241
#: editors.py:230
msgid "Heading 3"
msgstr ""

#: editor_toolbars.py:247
#: editors.py:236
msgid "Heading 4"
msgstr ""

#: editor_toolbars.py:253
#: editors.py:242
msgid "Heading 5"
msgstr ""

#: editor_toolbars.py:259
#: editors.py:248
msgid "Heading 6"
msgstr ""

#: editor_toolbars.py:265
#: editors.py:254
msgid "Paragraph"
msgstr ""

#: editor_toolbars.py:271
#: editors.py:260
msgid "Anchor"
msgstr ""

#: editor_toolbars.py:274
msgid "Format"
#: editors.py:263
msgid "Block format"
msgstr ""

#: editor_toolbars.py:278
#: editors.py:267
msgid "Styles"
msgstr ""

#: editor_toolbars.py:282
#: editors.py:271
msgid "Font"
msgstr ""

#: editor_toolbars.py:285
#: editors.py:274
msgid "Font size"
msgstr ""

#: models.py:56
#: editors.py:277 editors.py:278 widgets.py:183 widgets.py:186
msgid "CMS Plugins"
msgstr ""

#: editors.py:279 widgets.py:185
msgid "Edit CMS Plugin"
msgstr ""

#: editors.py:280 widgets.py:184
msgid "Add CMS Plugin"
msgstr ""

#: models.py:51
msgid "body"
msgstr "المحتوى"

#: models.py:57
#: models.py:52
msgid "json"
msgstr ""

Expand All @@ -213,15 +221,3 @@ msgstr "النص"
#: settings.py:40
msgid "Generic"
msgstr ""

#: widgets.py:154 widgets.py:157
msgid "CMS Plugins"
msgstr ""

#: widgets.py:155
msgid "Add CMS Plugin"
msgstr ""

#: widgets.py:156
msgid "Edit CMS Plugin"
msgstr ""
Loading
Loading