Преглед на файлове

Tweak PluginMenuButton icon_class to require additional "fa" class

Jeremy Stretch преди 5 години
родител
ревизия
5de085d83d
променени са 3 файла, в които са добавени 6 реда и са изтрити 6 реда
  1. 3 3
      docs/plugins/development.md
  2. 2 2
      netbox/extras/tests/dummy_plugin/navigation.py
  3. 1 1
      netbox/templates/inc/plugin_menu_items.html

+ 3 - 3
docs/plugins/development.md

@@ -304,8 +304,8 @@ menu_items = (
         link='plugins:netbox_animal_sounds:random_animal',
         link_text='Random sound',
         buttons=(
-            PluginMenuButton('home', 'Button A', 'fa-info', ButtonColorChoices.BLUE),
-            PluginMenuButton('home', 'Button B', 'fa-warning', ButtonColorChoices.GREEN),
+            PluginMenuButton('home', 'Button A', 'fa fa-info', ButtonColorChoices.BLUE),
+            PluginMenuButton('home', 'Button B', 'fa fa-warning', ButtonColorChoices.GREEN),
         )
     ),
 )
@@ -322,7 +322,7 @@ A `PluginMenuButton` has the following attributes:
 
 * `link` - The name of the URL path to which this button links
 * `title` - The tooltip text (displayed when the mouse hovers over the button)
-* `icon_class` - Button icon CSS class
+* `icon_class` - Button icon CSS class (NetBox currently supports [Font Awesome 4.7](https://fontawesome.com/v4.7.0/icons/))
 * `color` - One of the choices provided by `ButtonColorChoices` (optional)
 * `permissions` - A list of permissions required to display this button (optional)
 

+ 2 - 2
netbox/extras/tests/dummy_plugin/navigation.py

@@ -9,12 +9,12 @@ menu_items = (
             PluginMenuButton(
                 link='admin:dummy_plugin_dummymodel_add',
                 title='Add a new dummy model',
-                icon_class='fa-plus',
+                icon_class='fa fa-plus',
             ),
             PluginMenuButton(
                 link='admin:dummy_plugin_dummymodel_add',
                 title='Add a new dummy model',
-                icon_class='fa-plus',
+                icon_class='fa fa-plus',
             ),
         )
     ),

+ 1 - 1
netbox/templates/inc/plugin_menu_items.html

@@ -10,7 +10,7 @@
                         <div class="buttons pull-right">
                             {% for button in menu_item.buttons %}
                                 {% if not button.permissions or request.user|has_perms:button.permissions %}
-                                    <a href="{% url button.link %}" class="btn btn-xs btn-{{ button.color }}" title="{{ button.title }}"><i class="fa {{ button.icon_class }}"></i></a>
+                                    <a href="{% url button.link %}" class="btn btn-xs btn-{{ button.color }}" title="{{ button.title }}"><i class="{{ button.icon_class }}"></i></a>
                                 {% endif %}
                             {% endfor %}
                         </div>