2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
2015-09-09 06:52:05 +00:00
|
|
|
|
|
|
|
class CalendarsController < ApplicationController
|
2020-03-19 09:39:51 +00:00
|
|
|
prepend_before_action { authentication_check && authorize! }
|
2015-09-09 06:52:05 +00:00
|
|
|
|
2018-05-11 08:09:24 +00:00
|
|
|
def init
|
2016-03-20 19:09:52 +00:00
|
|
|
assets = {}
|
2018-05-11 08:09:24 +00:00
|
|
|
record_ids = []
|
2017-10-01 12:25:52 +00:00
|
|
|
Calendar.all.order(:name, :created_at).each do |calendar|
|
2018-05-11 08:09:24 +00:00
|
|
|
record_ids.push calendar.id
|
2015-09-16 08:40:18 +00:00
|
|
|
assets = calendar.assets(assets)
|
2017-10-01 12:25:52 +00:00
|
|
|
end
|
2015-09-16 08:40:18 +00:00
|
|
|
|
|
|
|
ical_feeds = Calendar.ical_feeds
|
|
|
|
timezones = Calendar.timezones
|
|
|
|
render json: {
|
2018-05-11 08:09:24 +00:00
|
|
|
record_ids: record_ids,
|
2015-09-16 08:40:18 +00:00
|
|
|
ical_feeds: ical_feeds,
|
2018-12-19 17:31:51 +00:00
|
|
|
timezones: timezones,
|
|
|
|
assets: assets,
|
2015-09-16 08:40:18 +00:00
|
|
|
}, status: :ok
|
2015-09-09 06:52:05 +00:00
|
|
|
end
|
|
|
|
|
2018-05-11 08:09:24 +00:00
|
|
|
def index
|
|
|
|
model_index_render(Calendar, params)
|
|
|
|
end
|
|
|
|
|
2015-09-09 06:52:05 +00:00
|
|
|
def show
|
|
|
|
model_show_render(Calendar, params)
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
model_create_render(Calendar, params)
|
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
model_update_render(Calendar, params)
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
2021-11-10 14:29:31 +00:00
|
|
|
model_references_check(Calendar, params)
|
2016-11-30 10:30:03 +00:00
|
|
|
model_destroy_render(Calendar, params)
|
2015-09-09 06:52:05 +00:00
|
|
|
end
|
2016-08-12 16:39:09 +00:00
|
|
|
|
2019-02-10 11:01:38 +00:00
|
|
|
def timezones
|
|
|
|
render json: {
|
|
|
|
timezones: Calendar.timezones
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2015-09-09 06:52:05 +00:00
|
|
|
end
|