Skip to content

Commit

Permalink
usability cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
beingmattlevy committed Jul 29, 2024
1 parent ebf0684 commit ab06351
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/models/addon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Addon < ApplicationRecord
CATEGORY_CAMP = 'camp'].freeze

HUMANIZED_CATEGORIES = {
CATEGORY_PASS => 'Passes',
CATEGORY_PASS => 'Event Passes',
CATEGORY_CAMP => 'Camping Permits'
}.freeze

Expand Down
2 changes: 1 addition & 1 deletion app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class Event < ApplicationRecord
kid_ticket_price: 0,

max_adult_tickets_per_request: 6,
max_kid_tickets_per_request: 4,
max_kid_tickets_per_request: 0,

tickets_require_approval: true,
allow_financial_assistance: true,
Expand Down
4 changes: 4 additions & 0 deletions app/models/event_addon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,8 @@ class EventAddon < ApplicationRecord
def set_default_values
self.price ||= addon.default_price
end

def category_and_name
"#{humanized_category}: #{name} ($)"
end
end
2 changes: 1 addition & 1 deletion app/views/events/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
- @event.sorted_event_addons.each do |event_addon|
= f.fields_for :event_addons, event_addon do |event_addon_form|
= event_addon_form.hidden_field :addon_id, value: event_addon.addon_id
= event_addon_form.label :name, "#{event_addon.humanized_category}: #{event_addon.name} ($)"
= event_addon_form.label :name, "#{event_addon.category_and_name}"
= event_addon_form.number_field :price, class: 'input-small', min: 0

= f.submit " ▶︎ Update Event", class: 'btn btn-primary btn-large'
2 changes: 1 addition & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def create_events
def create_addons
return if Addon.count.positive?

Addon.create category: Addon::CATEGORY_PASS, name: 'Early Arrival', default_price: 20
Addon.create category: Addon::CATEGORY_PASS, name: 'Early Arrival', default_price: 0
Addon.create category: Addon::CATEGORY_PASS, name: 'Late Departure', default_price: 30
Addon.create category: Addon::CATEGORY_CAMP, name: 'Car Camping', default_price: 50
Addon.create category: Addon::CATEGORY_CAMP, name: 'RV under 20ft', default_price: 100
Expand Down

0 comments on commit ab06351

Please sign in to comment.