__init__.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. from django.urls import path
  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("attachments/", "attachments")
  14. urlpatterns.patterns(
  15. "attachments",
  16. path("", AttachmentsList.as_view(), name="index"),
  17. path("<int:page>/", AttachmentsList.as_view(), name="index"),
  18. path("delete/<int:pk>/", DeleteAttachment.as_view(), name="delete"),
  19. )
  20. # AttachmentType
  21. urlpatterns.namespace("attachment-types/", "attachment-types", "settings")
  22. urlpatterns.patterns(
  23. "settings:attachment-types",
  24. path("", AttachmentTypesList.as_view(), name="index"),
  25. path("new/", NewAttachmentType.as_view(), name="new"),
  26. path("edit/<int:pk>/", EditAttachmentType.as_view(), name="edit"),
  27. path("delete/<int:pk>/", DeleteAttachmentType.as_view(), name="delete"),
  28. )
  29. def register_navigation_nodes(self, site):
  30. site.add_node(
  31. name=_("Attachments"),
  32. icon="fas fa-paperclip",
  33. after="permissions:index",
  34. namespace="attachments",
  35. )
  36. site.add_node(
  37. name=_("Attachment types"),
  38. description=_("Specify what files may be uploaded on the forum."),
  39. parent="settings",
  40. namespace="attachment-types",
  41. )