Procházet zdrojové kódy

Convert ModelAdmin icons to SVG

Thibaud Colas před 2 roky
rodič
revize
2ebf0de3fc

+ 2 - 1
wagtail/contrib/modeladmin/helpers/button.py

@@ -6,7 +6,7 @@ from django.utils.translation import gettext as _
 class ButtonHelper:
 
     default_button_classnames = ["button"]
-    add_button_classnames = ["bicolor", "icon", "icon-plus"]
+    add_button_classnames = ["bicolor", "button--icon"]
     inspect_button_classnames = ["button-secondary"]
     edit_button_classnames = ["button-secondary"]
     delete_button_classnames = ["no"]
@@ -40,6 +40,7 @@ class ButtonHelper:
         return {
             "url": self.url_helper.create_url,
             "label": _("Add %(object)s") % {"object": self.verbose_name},
+            "icon": "plus",
             "classname": cn,
             "title": _("Add a new %(object)s") % {"object": self.verbose_name},
         }

+ 2 - 1
wagtail/contrib/modeladmin/templates/modeladmin/includes/button.html

@@ -1 +1,2 @@
-<a{% if button.url %} href="{{ button.url }}"{% endif %} class="{{ button.classname }}" title="{{ button.title }}"{% if button.target %} target="{{ button.target }}"{% endif %}{% if button.rel %} rel="{{ button.rel }}"{% endif %}>{{ button.label }}</a>
+{% load wagtailadmin_tags %}
+<a{% if button.url %} href="{{ button.url }}"{% endif %} class="{{ button.classname }}" title="{{ button.title }}"{% if button.target %} target="{{ button.target }}"{% endif %}{% if button.rel %} rel="{{ button.rel }}"{% endif %}>{% if button.icon %}{% icon name=button.icon wrapped=1 %}{% endif %}{{ button.label }}</a>