Skip to content

Commit

Permalink
Add link icon to plugin (for djangocms_text dropdown)
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun committed Oct 29, 2024
1 parent 0bf66e2 commit 84c8e69
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions djangocms_link/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class LinkAdmin(admin.ModelAdmin):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.link_url_name = f"{self.opts.app_label}_{self.opts.model_name}_urls"
self.global_link_url_name = f"{self.opts.app_label}_{self.opts.model_name}_urls"

def has_module_permission(self, request): # pragma: no cover
# Remove from admin
Expand All @@ -190,7 +190,7 @@ def get_urls(self):
return [
path("urls",
self.admin_site.admin_view(self.url_view),
name=self.link_url_name
name=self.global_link_url_name
),
]

Expand Down
7 changes: 7 additions & 0 deletions djangocms_link/cms_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ class LinkPlugin(CMSPluginBase):
model = Link
name = _('Link')
text_enabled = True
text_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"><path d="M4.715 6.542 3.343 7.914a3 3 0 1 0 4.243 4.243l1.828-1.829A3 3 0 0 0 8.586 '
"5.5L8 6.086a1 1 0 0 0-.154.199 2 2 0 0 1 .861 3.337L6.88 11.45a2 2 0 1 1-2.83-2.83l.793-.792a4 4 0 0 "
'1-.128-1.287z"/><path d="M6.586 4.672A3 3 0 0 0 7.414 9.5l.775-.776a2 2 0 0 1-.896-3.346L9.12 3.55a2 2 0 '
'1 1 2.83 2.83l-.793.792c.112.42.155.855.128 1.287l1.372-1.372a3 3 0 1 0-4.243-4.243z"/></svg>'
)
allow_children = True

fieldsets = [
Expand Down

0 comments on commit 84c8e69

Please sign in to comment.