mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-13 02:32:59 +00:00
Mixin cleanup (#9142)
* Remove legacy SettingsContentMixin - Only used for rendering into old UI - No longer useful * Refactor path for NavigationMixin * Fix typos * Fix borked import
This commit is contained in:
parent
e447e4037b
commit
74e3122581
src/backend/InvenTree/plugin
base/integration
builtin/integration
mixins
@ -51,26 +51,3 @@ class NavigationMixin:
|
||||
def navigation_icon(self):
|
||||
"""Icon-name for navigation tab."""
|
||||
return getattr(self, 'NAVIGATION_TAB_ICON', 'fas fa-question')
|
||||
|
||||
|
||||
class SettingsContentMixin:
|
||||
"""Mixin which allows integration of custom HTML content into a plugins settings page.
|
||||
|
||||
The 'get_settings_content' method must return the HTML content to appear in the section
|
||||
"""
|
||||
|
||||
class MixinMeta:
|
||||
"""Meta for mixin."""
|
||||
|
||||
MIXIN_NAME = 'SettingsContent'
|
||||
|
||||
def __init__(self):
|
||||
"""Register mixin."""
|
||||
super().__init__()
|
||||
self.add_mixin('settingscontent', True, __class__)
|
||||
|
||||
def get_settings_content(self, view, request):
|
||||
"""This method *must* be implemented by the plugin class."""
|
||||
raise MixinNotImplementedError(
|
||||
f"{__class__} is missing the 'get_settings_content' method"
|
||||
)
|
@ -23,7 +23,7 @@ class BaseMixinDefinition:
|
||||
"""Mixin to test the meta functions of all mixins."""
|
||||
|
||||
def test_mixin_name(self):
|
||||
"""Test that the mixin registers itseld correctly."""
|
||||
"""Test that the mixin registers itself correctly."""
|
||||
# mixin name
|
||||
self.assertIn(
|
||||
self.MIXIN_NAME,
|
||||
@ -154,7 +154,7 @@ class NavigationMixinTest(BaseMixinDefinition, TestCase):
|
||||
|
||||
MIXIN_HUMAN_NAME = 'Navigation Links'
|
||||
MIXIN_NAME = 'navigation'
|
||||
MIXIN_ENABLE_CHECK = 'has_naviation'
|
||||
MIXIN_ENABLE_CHECK = 'has_navigation'
|
||||
|
||||
def setUp(self):
|
||||
"""Setup for all tests."""
|
||||
|
@ -11,7 +11,7 @@ import InvenTree.helpers
|
||||
import InvenTree.helpers_email
|
||||
import InvenTree.tasks
|
||||
from plugin import InvenTreePlugin, registry
|
||||
from plugin.mixins import BulkNotificationMethod, SettingsContentMixin, SettingsMixin
|
||||
from plugin.mixins import BulkNotificationMethod, SettingsMixin
|
||||
|
||||
|
||||
class PlgMixin:
|
||||
@ -25,9 +25,7 @@ class PlgMixin:
|
||||
return InvenTreeCoreNotificationsPlugin
|
||||
|
||||
|
||||
class InvenTreeCoreNotificationsPlugin(
|
||||
SettingsContentMixin, SettingsMixin, InvenTreePlugin
|
||||
):
|
||||
class InvenTreeCoreNotificationsPlugin(SettingsMixin, InvenTreePlugin):
|
||||
"""Core notification methods for InvenTree."""
|
||||
|
||||
NAME = 'InvenTreeCoreNotificationsPlugin'
|
||||
@ -70,7 +68,7 @@ class InvenTreeCoreNotificationsPlugin(
|
||||
"""
|
||||
|
||||
class EmailNotification(PlgMixin, BulkNotificationMethod):
|
||||
"""Notificationmethod for delivery via Email."""
|
||||
"""Notification method for delivery via Email."""
|
||||
|
||||
METHOD_NAME = 'mail'
|
||||
METHOD_ICON = 'fa-envelope'
|
||||
@ -123,7 +121,7 @@ class InvenTreeCoreNotificationsPlugin(
|
||||
return True
|
||||
|
||||
class SlackNotification(PlgMixin, BulkNotificationMethod):
|
||||
"""Notificationmethod for delivery via Slack channel messages."""
|
||||
"""Notification method for delivery via Slack channel messages."""
|
||||
|
||||
METHOD_NAME = 'slack'
|
||||
METHOD_ICON = 'fa-envelope'
|
||||
|
@ -8,7 +8,7 @@ from plugin.base.icons.mixins import IconPackMixin
|
||||
from plugin.base.integration.APICallMixin import APICallMixin
|
||||
from plugin.base.integration.AppMixin import AppMixin
|
||||
from plugin.base.integration.CurrencyExchangeMixin import CurrencyExchangeMixin
|
||||
from plugin.base.integration.mixins import NavigationMixin, SettingsContentMixin
|
||||
from plugin.base.integration.NavigationMixin import NavigationMixin
|
||||
from plugin.base.integration.ReportMixin import ReportMixin
|
||||
from plugin.base.integration.ScheduleMixin import ScheduleMixin
|
||||
from plugin.base.integration.SettingsMixin import SettingsMixin
|
||||
@ -32,7 +32,6 @@ __all__ = [
|
||||
'NavigationMixin',
|
||||
'ReportMixin',
|
||||
'ScheduleMixin',
|
||||
'SettingsContentMixin',
|
||||
'SettingsMixin',
|
||||
'SingleNotificationMethod',
|
||||
'SupplierBarcodeMixin',
|
||||
|
Loading…
x
Reference in New Issue
Block a user