diff --git a/app/controllers/admin/events_controller.rb b/app/controllers/admin/events_controller.rb index 61e7f0910..755279b1d 100644 --- a/app/controllers/admin/events_controller.rb +++ b/app/controllers/admin/events_controller.rb @@ -3,7 +3,7 @@ class Admin::EventsController < Admin::ApplicationController before_action :find_event, only: %i[edit update] def new - @event = Event.new + @event = Event.new(timezone: 'London') end def create @@ -74,7 +74,7 @@ def set_event def event_params params.require(:event).permit( :virtual, :name, :slug, :date_and_time, :begins_at, :ends_at, :description, :info, :schedule, :venue_id, - :external_url, :coach_spaces, :student_spaces, :email, :announce_only, :tito_url, :invitable, + :external_url, :coach_spaces, :student_spaces, :email, :announce_only, :tito_url, :invitable, :timezone, :student_questionnaire, :confirmation_required, :surveys_required, :audience, :coach_questionnaire, :show_faq, :display_coaches, :display_students, bronze_sponsor_ids: [], silver_sponsor_ids: [], gold_sponsor_ids: [], sponsor_ids: [], chapter_ids: [] diff --git a/app/models/event.rb b/app/models/event.rb index e247d334b..ed859ab77 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -101,7 +101,7 @@ def sponsors?(level = nil) private def time_zone - 'London' + timezone || 'London' end def duplicated_sponsors diff --git a/app/views/admin/events/_form.html.haml b/app/views/admin/events/_form.html.haml index a93a1ce50..ee865209d 100644 --- a/app/views/admin/events/_form.html.haml +++ b/app/views/admin/events/_form.html.haml @@ -8,10 +8,13 @@ = f.input :slug, placeholder: 'for URI, e.g. 24-pull-requests' .col-12 = f.input :date_and_time, as: :string, required: true, label: 'Date' - .col-12.col-md-6 + .col-12.col-md-4 = f.input :begins_at, as: :string, required: true - .col-12.col-md-6 + .col-12.col-md-4 = f.input :ends_at, as: :string, required: true + .col-12.col-md-4 + %label.form-check-label{ for: "event_timezone" } Time zone + = f.time_zone_select :timezone .col-12 = f.input :description, as: :text, input_html: { rows: 3 }, hint: 'Use this space to write an invitation message and description of the event. This copy will also be used in the email invitation. You can use HTML here!' diff --git a/app/views/admin/events/edit.html.haml b/app/views/admin/events/edit.html.haml index 4d566204f..c032f79b9 100644 --- a/app/views/admin/events/edit.html.haml +++ b/app/views/admin/events/edit.html.haml @@ -15,10 +15,13 @@ = f.input :slug .col-12 = f.input :date_and_time, as: :string, required: true, label: 'Date', input_html: { data: { value: @event.date_and_time.strftime('%d/%m/%Y') } } - .col-12.col-md-6 + .col-12.col-md-4 = f.input :begins_at, as: :string, required: true, input_html: { data: { value: @event.date_and_time.time.strftime('%H:%M') }} - .col-6.col-md-6 + .col-12.col-md-4 = f.input :ends_at, as: :string, required: true, input_html: { data: { value: @event.ends_at.strftime('%H:%M') }} + .col-12.col-md-4 + %label.form-check-label{ for: "event_timezone" } Time zone + = f.time_zone_select :timezone .col-12 = f.input :description, as: :text, input_html: { rows: 3 }, hint: 'Use this space to write an invitation message and description of the event. This copy will also be used in the email invitation. You can use HTML here!'