events.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. package views
  2. import (
  3. "github.com/qor5/web"
  4. "gorm.io/gorm"
  5. )
  6. const (
  7. openFileChooserEvent = "mediaLibrary_OpenFileChooserEvent"
  8. deleteFileEvent = "mediaLibrary_DeleteFileEvent"
  9. cropImageEvent = "mediaLibrary_CropImageEvent"
  10. loadImageCropperEvent = "mediaLibrary_LoadImageCropperEvent"
  11. imageSearchEvent = "mediaLibrary_ImageSearchEvent"
  12. imageJumpPageEvent = "mediaLibrary_ImageJumpPageEvent"
  13. uploadFileEvent = "mediaLibrary_UploadFileEvent"
  14. chooseFileEvent = "mediaLibrary_ChooseFileEvent"
  15. updateDescriptionEvent = "mediaLibrary_UpdateDescriptionEvent"
  16. deleteConfirmationEvent = "mediaLibrary_DeleteConfirmationEvent"
  17. doDeleteEvent = "mediaLibrary_DoDelete"
  18. )
  19. func registerEventFuncs(hub web.EventFuncHub, db *gorm.DB) {
  20. hub.RegisterEventFunc(openFileChooserEvent, fileChooser(db))
  21. hub.RegisterEventFunc(deleteFileEvent, deleteFileField())
  22. hub.RegisterEventFunc(cropImageEvent, cropImage(db))
  23. hub.RegisterEventFunc(loadImageCropperEvent, loadImageCropper(db))
  24. hub.RegisterEventFunc(imageSearchEvent, searchFile(db))
  25. hub.RegisterEventFunc(imageJumpPageEvent, jumpPage(db))
  26. hub.RegisterEventFunc(uploadFileEvent, uploadFile(db))
  27. hub.RegisterEventFunc(chooseFileEvent, chooseFile(db))
  28. hub.RegisterEventFunc(updateDescriptionEvent, updateDescription(db))
  29. hub.RegisterEventFunc(deleteConfirmationEvent, deleteConfirmation(db))
  30. hub.RegisterEventFunc(doDeleteEvent, doDelete(db))
  31. }