has_taskbars.rb 553 B

123456789101112131415161718192021222324252627282930
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module HasTaskbars
  3. extend ActiveSupport::Concern
  4. included do
  5. before_destroy :destroy_taskbars
  6. end
  7. class_methods do
  8. # Defines the entities which are available for the taskbar.
  9. def taskbar_entities(*entities)
  10. @taskbar_entities ||= entities
  11. end
  12. end
  13. =begin
  14. destroy all taskbars for the class object id
  15. model = Model.find(123)
  16. model.destroy
  17. =end
  18. def destroy_taskbars
  19. Taskbar.where(key: "#{self.class}-#{id}").destroy_all
  20. end
  21. end