__init__.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. from django.conf.urls import url
  2. from django.utils.translation import gettext_lazy as _
  3. from .views.attachments import AttachmentsList, DeleteAttachment
  4. from .views.attachmenttypes import (
  5. AttachmentTypesList,
  6. DeleteAttachmentType,
  7. EditAttachmentType,
  8. NewAttachmentType,
  9. )
  10. class MisagoAdminExtension:
  11. def register_urlpatterns(self, urlpatterns):
  12. # Attachment
  13. urlpatterns.namespace(r"^attachments/", "attachments")
  14. urlpatterns.patterns(
  15. "attachments",
  16. url(r"^$", AttachmentsList.as_view(), name="index"),
  17. url(r"^(?P<page>\d+)/$", AttachmentsList.as_view(), name="index"),
  18. url(r"^delete/(?P<pk>\d+)/$", DeleteAttachment.as_view(), name="delete"),
  19. )
  20. # AttachmentType
  21. urlpatterns.namespace(r"^attachment-types/", "attachment-types", "settings")
  22. urlpatterns.patterns(
  23. "settings:attachment-types",
  24. url(r"^$", AttachmentTypesList.as_view(), name="index"),
  25. url(r"^new/$", NewAttachmentType.as_view(), name="new"),
  26. url(r"^edit/(?P<pk>\d+)/$", EditAttachmentType.as_view(), name="edit"),
  27. url(
  28. r"^delete/(?P<pk>\d+)/$", DeleteAttachmentType.as_view(), name="delete"
  29. ),
  30. )
  31. def register_navigation_nodes(self, site):
  32. site.add_node(
  33. name=_("Attachments"),
  34. icon="fas fa-paperclip",
  35. after="permissions:index",
  36. namespace="attachments",
  37. )
  38. site.add_node(
  39. name=_("Attachment types"), parent="settings", namespace="attachment-types"
  40. )