From 6263762ac495806cadb890dd6ef24fdfe68cf4e4 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 11 May 2018 10:09:24 +0200 Subject: [PATCH] Fixes issue #1971 - Admin UI does not allow to select Timezone in "Calendars" options. --- .../app/controllers/calendar.coffee | 21 +++-- .../javascripts/app/models/calendar.coffee | 2 +- .../views/generic/searchable_select.jst.eco | 2 +- app/controllers/calendars_controller.rb | 14 +-- config/routes/calendar.rb | 1 + script/build/test_slice_tests.sh | 6 ++ test/browser/admin_calendar_sla_test.rb | 84 +++++++++++++++++ test/browser_test_helper.rb | 85 ++++++++++++++++++ test/controllers/calendar_controller_test.rb | 90 +++++++++++++++++++ test/controllers/sla_controller_test.rb | 70 +++++++++++++++ 10 files changed, 358 insertions(+), 17 deletions(-) create mode 100644 test/browser/admin_calendar_sla_test.rb create mode 100644 test/controllers/calendar_controller_test.rb create mode 100644 test/controllers/sla_controller_test.rb diff --git a/app/assets/javascripts/app/controllers/calendar.coffee b/app/assets/javascripts/app/controllers/calendar.coffee index 30ab707f2..0b7007afa 100644 --- a/app/assets/javascripts/app/controllers/calendar.coffee +++ b/app/assets/javascripts/app/controllers/calendar.coffee @@ -12,15 +12,18 @@ class Index extends App.ControllerSubContent super @subscribeId = App.Calendar.subscribe(@render) - callback = (data) => - App.Config.set('ical_feeds', data.ical_feeds) - App.Config.set('timezones', data.timezones) - @stopLoading() - @render() @startLoading() - App.Calendar.fetchFull( - callback - clear: true + @ajax( + id: 'calendar_index' + type: 'GET' + url: @apiPath + '/calendars_init' + processData: true + success: (data, status, xhr) => + App.Config.set('ical_feeds', data.ical_feeds) + App.Config.set('timezones', data.timezones) + App.Collection.loadAssets(data.assets) + @stopLoading() + @render() ) render: => @@ -59,7 +62,7 @@ class Index extends App.ControllerSubContent if !_.isEmpty(calendars) showDescription = true else - description = marked(App[ @genericObject ].description) + description = marked(App.Calendar.description) @html App.view('calendar/index')( calendars: calendars diff --git a/app/assets/javascripts/app/models/calendar.coffee b/app/assets/javascripts/app/models/calendar.coffee index 771bab8cf..29c10cf47 100644 --- a/app/assets/javascripts/app/models/calendar.coffee +++ b/app/assets/javascripts/app/models/calendar.coffee @@ -5,7 +5,7 @@ class App.Calendar extends App.Model @configure_attributes = [ { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, null: false }, - { name: 'timezone', display: 'Time zone', tag: 'timezone', null: false } + { name: 'timezone', display: 'Time zone', tag: 'timezone', null: false } { name: 'business_hours', display: 'Business Hours', tag: 'business_hours', null: true } { name: 'ical_url', display: 'Holidays iCalendar Feed', tag: 'ical_feed', placeholder: 'http://example.com/public_holidays.ical', null: true } { name: 'public_holidays',display: 'Holidays', tag: 'holiday_selector', null: true } diff --git a/app/assets/javascripts/app/views/generic/searchable_select.jst.eco b/app/assets/javascripts/app/views/generic/searchable_select.jst.eco index 70139147e..ea66976d6 100644 --- a/app/assets/javascripts/app/views/generic/searchable_select.jst.eco +++ b/app/assets/javascripts/app/views/generic/searchable_select.jst.eco @@ -1,7 +1,7 @@