Skip to content

Commit

Permalink
Merge pull request #235 from fnf-org/232-role-as-event-option
Browse files Browse the repository at this point in the history
require collection of guest roles as event option
  • Loading branch information
beingmattlevy authored Jul 15, 2024
2 parents 0a9a41c + ce53307 commit 4fb568c
Show file tree
Hide file tree
Showing 17 changed files with 688 additions and 487 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.0
1.2.1
2 changes: 0 additions & 2 deletions Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ brew 'minikube'
brew 'kubernetes-cli'

cask 'chromedriver'
cask 'github'

cask 'font-andale-mono'
cask 'font-anonymice-powerline'
Expand Down Expand Up @@ -112,6 +111,5 @@ cask 'font-roboto'
cask 'font-roboto-mono-nerd-font'
cask 'font-share-tech-mono'
cask 'font-sometype-mono'
cask 'font-titillium'
cask 'font-ubuntu'
cask 'font-victor-mono'
898 changes: 535 additions & 363 deletions Brewfile.lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def permitted_params
max_kid_tickets_per_request
name
require_mailing_address
require_role
start_time
tickets_require_approval
]
Expand Down
9 changes: 8 additions & 1 deletion app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# name :string(255)
# photo :string(255)
# require_mailing_address :boolean default(FALSE), not null
# require_role :boolean default(TRUE), not null
# slug :text
# start_time :datetime
# ticket_requests_end_time :datetime
Expand All @@ -46,7 +47,7 @@ class Event < ApplicationRecord
:kid_ticket_price, :cabin_price, :max_adult_tickets_per_request,
:max_kid_tickets_per_request, :max_cabins_per_request, :max_cabin_requests,
:photo, :photo_cache, :tickets_require_approval, :require_mailing_address,
:allow_financial_assistance, :allow_donations,
:require_role, :allow_financial_assistance, :allow_donations,
:ticket_sales_start_time, :ticket_sales_end_time,
:ticket_requests_end_time

Expand All @@ -55,6 +56,7 @@ class Event < ApplicationRecord
normalize_attributes :name

before_validation :generate_slug!
before_validation :ensure_require_role_set_default

validates :name, presence: true, length: { maximum: MAX_NAME_LENGTH }
validates :start_time, presence: true
Expand Down Expand Up @@ -94,6 +96,7 @@ class Event < ApplicationRecord
allow_donations: true,

require_mailing_address: false,
require_role: true,

max_cabins_per_request: nil,
max_cabin_requests: nil,
Expand Down Expand Up @@ -234,4 +237,8 @@ def ensure_prices_set_if_maximum_specified
'can be set only if a cabin price is set')
end
end

def ensure_require_role_set_default
attributes[:require_role] = true if attributes[:require_role].nil?
end
end
1 change: 1 addition & 0 deletions app/views/devise/shared/_register.html.haml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
%h2 Register

- http_method = existing ? :put : :post
= form_for(resource, as: resource_name, url: user_registration_path, html: { method: http_method }, data: { turbo: false } ) do |f|
Expand Down
7 changes: 7 additions & 0 deletions app/views/events/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@
Check this box if you want to manually approve all requests before
allowing ticket to be purchased.

= f.label :require_role, class: 'checkbox' do
= f.check_box :require_role
Ticket requester event role required
%p.muted
Check this box if you want to collect a details of what role a ticket requester is
taking on for the event. e.g. volunteer, coordinator, etc....

= f.label :require_mailing_address, class: 'checkbox' do
= f.check_box :require_mailing_address
Mailing address required
Expand Down
57 changes: 57 additions & 0 deletions app/views/ticket_requests/_event_role.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
%h4 How are you contributing to the event?
.content-fluid
.row
.col-lg-6.col-xl-6.col-md-12.col-sm-12
.input-group-large
%fieldset
%p
= f.label :role_volunteer do
= f.label :role_volunteer, class: 'radio inline' do
= f.radio_button :role, TicketRequest::ROLE_VOLUNTEER,
data: { 'max-tickets' => TicketRequest::TICKET_LIMITS[TicketRequest::ROLE_VOLUNTEER] }
= TicketRequest::ROLES[TicketRequest::ROLE_VOLUNTEER]
= f.label :role_contributor, class: 'radio inline' do
= f.radio_button :role, TicketRequest::ROLE_CONTRIBUTOR,
data: { 'max-tickets' => TicketRequest::TICKET_LIMITS[TicketRequest::ROLE_CONTRIBUTOR] }
= TicketRequest::ROLES[TicketRequest::ROLE_CONTRIBUTOR]
= f.label :role_coordinator, class: 'radio inline' do
= f.radio_button :role, TicketRequest::ROLE_COORDINATOR,
data: { 'max-tickets' => TicketRequest::TICKET_LIMITS[TicketRequest::ROLE_COORDINATOR] }
= TicketRequest::ROLES[TicketRequest::ROLE_COORDINATOR]
= f.label :role_uber_coordinator, class: 'radio inline' do
= f.radio_button :role, TicketRequest::ROLE_UBER_COORDINATOR,
data: { 'max-tickets' => TicketRequest::TICKET_LIMITS[TicketRequest::ROLE_UBER_COORDINATOR] }
= TicketRequest::ROLES[TicketRequest::ROLE_UBER_COORDINATOR]
= f.label :role_other, class: 'radio inline' do
= f.radio_button :role, TicketRequest::ROLE_OTHER,
data: { 'max-tickets' => TicketRequest::TICKET_LIMITS[TicketRequest::ROLE_OTHER] }
= TicketRequest::ROLES[TicketRequest::ROLE_OTHER]

.col-lg-6.col-xl-6.col-md-12.col-sm-12.align-content-md-center
%p.muted.role-explanation{ class: TicketRequest::ROLE_VOLUNTEER }
You are working one or more shifts at the event

%p.muted.role-explanation.hidden{ class: TicketRequest::ROLE_CONTRIBUTOR }
Working before and during or during and after; actively involved in
planning the campout e.g. a coordinator assistant or apprentice. Bringing
gear, driving trucks, art committee, etc.

%p.muted.role-explanation.hidden{ class: TicketRequest::ROLE_COORDINATOR }
Listed on the Coordinator Sheet as someone who is leading a major area of
camp out planning; working before, during, and after the event including
things like resource coordination, significant gear prep, pre/post-site
visits, etc.

%p.muted.role-explanation.hidden{ class: TicketRequest::ROLE_OTHER }
Art Grantee or DJ

= f.text_area :role_explanation,
placeholder: 'Briefly describe your role',
rows: 4, width: 400, maxlength: 200, required: false, style: 'min-width: 100% !important; font-size: 11pt;'

.row
.col-lg-6.col-xl-6.col-md-12.col-sm-12
- if @event.require_role
= f.label :previous_contribution, 'What was your role last year?'
= f.text_area :previous_contribution, style: 'min-width: 100%',
rows: 2, maxlength: 250, required: false
134 changes: 40 additions & 94 deletions app/views/ticket_requests/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -87,101 +87,47 @@

- if !@ticket_request.post_payment? || (@event.admin?(current_user) && is_update)
%hr
%h4 How are you contributing to the event?
.content-fluid
.row
.col-lg-6.col-xl-6.col-md-12.col-sm-12
.input-group-large
%fieldset
%p
= f.label :role_volunteer do
= f.label :role_volunteer, class: 'radio inline' do
= f.radio_button :role, TicketRequest::ROLE_VOLUNTEER,
data: { 'max-tickets' => TicketRequest::TICKET_LIMITS[TicketRequest::ROLE_VOLUNTEER] }
= TicketRequest::ROLES[TicketRequest::ROLE_VOLUNTEER]
= f.label :role_contributor, class: 'radio inline' do
= f.radio_button :role, TicketRequest::ROLE_CONTRIBUTOR,
data: { 'max-tickets' => TicketRequest::TICKET_LIMITS[TicketRequest::ROLE_CONTRIBUTOR] }
= TicketRequest::ROLES[TicketRequest::ROLE_CONTRIBUTOR]
= f.label :role_coordinator, class: 'radio inline' do
= f.radio_button :role, TicketRequest::ROLE_COORDINATOR,
data: { 'max-tickets' => TicketRequest::TICKET_LIMITS[TicketRequest::ROLE_COORDINATOR] }
= TicketRequest::ROLES[TicketRequest::ROLE_COORDINATOR]
= f.label :role_uber_coordinator, class: 'radio inline' do
= f.radio_button :role, TicketRequest::ROLE_UBER_COORDINATOR,
data: { 'max-tickets' => TicketRequest::TICKET_LIMITS[TicketRequest::ROLE_UBER_COORDINATOR] }
= TicketRequest::ROLES[TicketRequest::ROLE_UBER_COORDINATOR]
= f.label :role_other, class: 'radio inline' do
= f.radio_button :role, TicketRequest::ROLE_OTHER,
data: { 'max-tickets' => TicketRequest::TICKET_LIMITS[TicketRequest::ROLE_OTHER] }
= TicketRequest::ROLES[TicketRequest::ROLE_OTHER]

.col-lg-6.col-xl-6.col-md-12.col-sm-12.align-content-md-center
%p.muted.role-explanation{ class: TicketRequest::ROLE_VOLUNTEER }
You are working one or more shifts at the event

%p.muted.role-explanation.hidden{ class: TicketRequest::ROLE_CONTRIBUTOR }
Working before and during or during and after; actively involved in
planning the campout e.g. a coordinator assistant or apprentice. Bringing
gear, driving trucks, art committee, etc.

%p.muted.role-explanation.hidden{ class: TicketRequest::ROLE_COORDINATOR }
Listed on the Coordinator Sheet as someone who is leading a major area of
camp out planning; working before, during, and after the event including
things like resource coordination, significant gear prep, pre/post-site
visits, etc.

%p.muted.role-explanation.hidden{ class: TicketRequest::ROLE_OTHER }
Art Grantee or DJ

= f.text_area :role_explanation,
placeholder: 'Briefly describe your role',
rows: 4, width: 400, maxlength: 200, required: false, style: 'min-width: 100% !important; font-size: 11pt;'

.row
.col-lg-6.col-xl-6.col-md-12.col-sm-12
= f.label :previous_contribution, 'What was your role last year?'
= f.text_area :previous_contribution, style: 'min-width: 100%',
rows: 2, maxlength: 250, required: false
- if @event.require_role
= render partial: :event_role

- if signed_in? && @event.admin?(current_user) && is_update
.well
= f.label :special_price, 'Total Special Price ($)'

%p.text-error
Editable by event admins only. Leave blank to use default price.
= f.number_field :special_price, class: 'input-small', min: 0

= f.label :adults, 'Number of adult tickets' + " @ $#{@event.adult_ticket_price.to_i} each"
= f.number_field :adults, class: 'input-mini', min: 1, required: true,
max: @event.max_adult_tickets_per_request,
data: { default_price: @event.adult_ticket_price.to_i }

%br

- if @event.kid_ticket_price
%table.w-100.m-0.p-0
%tbody.m-0.p-0
%tr.align-middle
%td.w-90.m-0.p-0.text-start
= f.label :kids do
Number of children (12 and under) you are bringing with you
(not transferable to adults; babes in arms are free)
= f.number_field :kids, class: 'input-mini', min: 0,
max: @event.max_kid_tickets_per_request,
data: { default_price: @event.kid_ticket_price.to_i,
custom_prices: price_rules_to_json(@event) }

%td.w-10.text-end
= tooltip_box help_text_for(:kids), title: "Kid Tickets"

- if signed_in? && @event.admin?(current_user) && is_update
.well
= f.label :special_price, 'Total Special Price ($)'

%p.text-error
Editable by event admins only. Leave blank to use default price.
= f.number_field :special_price, class: 'input-small', min: 0

= f.label :adults, 'Number of adult tickets' + " @ $#{@event.adult_ticket_price.to_i} each"
= f.number_field :adults, class: 'input-mini', min: 1, required: true,
max: @event.max_adult_tickets_per_request,
data: { default_price: @event.adult_ticket_price.to_i }

%br

- if @event.kid_ticket_price
%table.w-100.m-0.p-0
%tbody.m-0.p-0
%tr.align-middle
%td.w-90.m-0.p-0.text-start
= f.label :kids do
Number of children (12 and under) you are bringing with you
(not transferable to adults; babes in arms are free)
= f.number_field :kids, class: 'input-mini', min: 0,
max: @event.max_kid_tickets_per_request,
data: { default_price: @event.kid_ticket_price.to_i,
custom_prices: price_rules_to_json(@event) }

%td.w-10.text-end
= tooltip_box help_text_for(:kids), title: "Kid Tickets"

- unless is_update
.card.bg-warning-subtle.mb-3{:style => "max-width: 100%;"}
.card-body.bg-success-subtle.text-dark.pt-1
%h5.card-title Please Note:
%p.card-text
Once you submit this ticket request, and it's approved, you'll receive an email stating so. You can also bookmark this URL and return to it at a later date.
In order to pay for the ticket(s) you are required to fill out the list of guests (if any) and kids (if any) you are bringing and/or inviting.
- unless is_update
.card.bg-warning-subtle.mb-3{:style => "max-width: 100%;"}
.card-body.bg-success-subtle.text-dark.pt-1
%h5.card-title Please Note:
%p.card-text
Once you submit this ticket request, and it's approved, you'll receive an email stating so. You can also bookmark this URL and return to it at a later date.
In order to pay for the ticket(s) you are required to fill out the list of guests (if any) and kids (if any) you are bringing and/or inviting.

.col-lg-6.col-xl-6.col-md-12.col-sm-12
.control-group
Expand Down
11 changes: 6 additions & 5 deletions app/views/ticket_requests/_table_ticket_requests.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

%tr
%th.bg-dark-subtle Name
%th.bg-dark-subtle.optional-medium Role
%th.bg-dark-subtle
- if event.require_role
%th.bg-dark-subtle.optional-medium Role
%th.bg-dark-subtle Notes
%th.bg-dark-subtle.text-end.optional-medium Tickets
- if event.kid_ticket_price
%th.bg-dark-subtle.text-end.optional-medium Kids
Expand All @@ -30,9 +31,9 @@
= link_to event_ticket_request_path(event, ticket_request) do
= ticket_request.user.name
%td.muted.align-content-center.optional-medium
= TicketRequest::ROLES[ticket_request.role]
- if ticket_request.role_explanation.present?
- if event.require_role
%td.muted.align-content-center.optional-medium
= TicketRequest::ROLES[ticket_request.role]
%i.icon-comment.hover-tooltip{ title: ticket_request.role_explanation }
%td.align-content-center.text-start.text-nowrap
Expand Down
15 changes: 8 additions & 7 deletions app/views/ticket_requests/_ticket_request_show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,14 @@
%br
= ticket_request.country_name

%tr
%td.text-end.small.p-2.px-4.text-nowrap= "Role:"
%td
%strong
= TicketRequest::ROLES[ticket_request.role]
- if ticket_request.role_explanation.present?
%blockquote= ticket_request.role_explanation
- if event.require_role
%tr
%td.text-end.small.p-2.px-4.text-nowrap= "Role:"
%td
%strong
= TicketRequest::ROLES[ticket_request.role]
- if ticket_request.role_explanation.present?
%blockquote= ticket_request.role_explanation


%tr
Expand Down
2 changes: 1 addition & 1 deletion bin/site-index
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ index_path="${RAILS_ROOT}/${dir}"
index_file="${index_path}/${file}"

temp="$(mktemp)"
ls -1 "${index_path}"/[a-z]* | xargs -n 1 basename | awk '{printf "%s \"%s\";\n", "@import", $1}' > "${temp}"
ls -1 "${index_path}"/[a-z]* | xargs -n 1 basename | awk '{printf "%s \"%s\";\n", "@import", $1}' | grep -v '@import "Mobile"' > "${temp}"

export _diff
if [[ -f "${index_file}" ]]; then
Expand Down
7 changes: 7 additions & 0 deletions db/migrate/20240710231611_add_require_role_to_event.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class AddRequireRoleToEvent < ActiveRecord::Migration[7.1]
def change
add_column :events, :require_role, :boolean, default: true, null: false
end
end
4 changes: 3 additions & 1 deletion db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ CREATE TABLE public.events (
ticket_requests_end_time timestamp without time zone,
early_arrival_price numeric(8,2) DEFAULT 0,
late_departure_price numeric(8,2) DEFAULT 0,
slug text
slug text,
require_role boolean DEFAULT true NOT NULL
);


Expand Down Expand Up @@ -713,6 +714,7 @@ CREATE UNIQUE INDEX unique_schema_migrations ON public.schema_migrations USING b
SET search_path TO "$user", public;

INSERT INTO "schema_migrations" (version) VALUES
('20240710231611'),
('20240523173316'),
('20240516225937'),
('20240513035005'),
Expand Down
Loading

0 comments on commit 4fb568c

Please sign in to comment.