diff --git a/app/controllers/admin/conferences_controller.rb b/app/controllers/admin/conferences_controller.rb index d8c101d1..8f8f2959 100644 --- a/app/controllers/admin/conferences_controller.rb +++ b/app/controllers/admin/conferences_controller.rb @@ -193,6 +193,7 @@ module Admin def edit @conferences = Conference.all @date_string = date_string(@conference.start_date, @conference.end_date) + @affected_event_count = @conference.program.events.scheduled(@conference.program.selected_schedule_id).count respond_to do |format| format.html format.json { render json: @conference.to_json } diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f77d7963..b5e2892e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -163,6 +163,12 @@ module ApplicationHelper end end + def rescheduling_hint(affected_event_count) + if affected_event_count > 0 + "You have #{affected_event_count} scheduled #{'event'.pluralize(affected_event_count)}. Changing the conference hours will unschedule those scheduled outside the conference hours." + end + end + ## # ====Gets # a conference object diff --git a/app/views/admin/conferences/edit.html.haml b/app/views/admin/conferences/edit.html.haml index b14fd7bb..ac90610d 100644 --- a/app/views/admin/conferences/edit.html.haml +++ b/app/views/admin/conferences/edit.html.haml @@ -22,8 +22,8 @@ = f.input :timezone, as: :time_zone, hint: 'The conference time zone' = f.input :start_date, as: :string, input_html: { id: 'conference-start-datepicker', readonly: 'readonly' } = f.input :end_date, as: :string, input_html: { id: 'conference-end-datepicker', readonly: 'readonly' } - = f.input :start_hour, input_html: {size: 2, type: 'number', min: 0, max: 23} - = f.input :end_hour, input_html: {size: 2, type: 'number', min: 1, max: 24} + = f.input :start_hour, input_html: {size: 2, type: 'number', min: 0, max: 23}, hint: rescheduling_hint(@affected_event_count) + = f.input :end_hour, input_html: {size: 2, type: 'number', min: 1, max: 24}, hint: rescheduling_hint(@affected_event_count) = f.inputs name: 'Registrations' do = f.input :registration_limit, as: :number, in: 0..9999, hint: 'Limit the number of registrations to the conference (0 no limit). Please note that the registration limit doesn\'t apply to speakers of confirmed events (they will still be able to register even if it has been reached). You currently have ' + pluralize(@conference.registrations.count, 'registration') = f.inputs name: 'Booths' do