calendars_controller.rb 1007 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
  2. class CalendarsController < ApplicationController
  3. prepend_before_action { authentication_check && authorize! }
  4. def init
  5. assets = {}
  6. record_ids = []
  7. Calendar.all.order(:name, :created_at).each do |calendar|
  8. record_ids.push calendar.id
  9. assets = calendar.assets(assets)
  10. end
  11. ical_feeds = Calendar.ical_feeds
  12. timezones = Calendar.timezones
  13. render json: {
  14. record_ids: record_ids,
  15. ical_feeds: ical_feeds,
  16. timezones: timezones,
  17. assets: assets,
  18. }, status: :ok
  19. end
  20. def index
  21. model_index_render(Calendar, params)
  22. end
  23. def show
  24. model_show_render(Calendar, params)
  25. end
  26. def create
  27. model_create_render(Calendar, params)
  28. end
  29. def update
  30. model_update_render(Calendar, params)
  31. end
  32. def destroy
  33. model_destroy_render(Calendar, params)
  34. end
  35. def timezones
  36. render json: {
  37. timezones: Calendar.timezones
  38. }
  39. end
  40. end