Skip to content

Commit

Permalink
TI-4669 set icon_name
Browse files Browse the repository at this point in the history
For newer wagtail versions, this appears to be the best way to set
an icon for each listing
  • Loading branch information
easherma-truth committed May 24, 2024
1 parent dc46d3f commit 362526a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/wagtail_personalisation/wagtail_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,8 @@ def page_listing_more_buttons(page, user, is_parent=False, next_url=None, *args)
reverse("wagtailadmin_pages:edit", args=[vm.variant_id]),
attrs={
"title": _("Edit this variant"),
"class": "icon icon-edit" # does work but not needed
},
icon_name='edit', # seems to be the newer wagtail convention
classname="icon icon-edit", # dosen't seem to work but should
icon_name="edit",
priority=0,
)

Expand All @@ -204,15 +202,15 @@ def page_listing_more_buttons(page, user, is_parent=False, next_url=None, *args)
"%s variant" % (segment.name),
reverse("segment:copy_page", args=[page.pk, segment.pk]),
attrs={"title": _("Create this variant")},
classname=("icon", "icon-plus"),
icon_name="plus",
priority=100,
)

yield Button(
_("Create a new segment"),
reverse("wagtail_personalisation_segment_modeladmin_create"),
attrs={"title": _("Create a new segment")},
classname=("icon", "icon-snowflake"),
icon_name="snowflake",
priority=200,
)

Expand Down

0 comments on commit 362526a

Please sign in to comment.