calendars_controller.rb 900 B

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