Skip to content

Commit

Permalink
Adds timezone field to events
Browse files Browse the repository at this point in the history
  • Loading branch information
jhackett1 authored and matyikriszta committed Jan 4, 2024
1 parent 73115f1 commit 92faae3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/controllers/admin/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: []
Expand Down
2 changes: 1 addition & 1 deletion app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def sponsors?(level = nil)
private

def time_zone
'London'
timezone || 'London'
end

def duplicated_sponsors
Expand Down
7 changes: 5 additions & 2 deletions app/views/admin/events/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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!'
Expand Down
7 changes: 5 additions & 2 deletions app/views/admin/events/edit.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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!'
Expand Down

0 comments on commit 92faae3

Please sign in to comment.