Skip to content

Commit ed144a3

Browse files
committed
Adds Community partner option to Sponsor levels
1 parent 019b014 commit ed144a3

File tree

8 files changed

+33
-6
lines changed

8 files changed

+33
-6
lines changed

app/helpers/application_helper.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ def number_to_currency(number, options = {})
6060
super(number, options)
6161
end
6262

63+
def sponsorship_level_title(level)
64+
return t('sponsors.standard_title') if level === 'standard'
65+
return t('sponsors.community_partner_title') if level === 'community'
66+
67+
"#{level.humanize} sponsors"
68+
end
69+
6370
private
6471

6572
def humanize_date_with_time(datetime, end_time)

app/models/sponsor.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ class Sponsor < ActiveRecord::Base
99
standard: 1,
1010
bronze: 2,
1111
silver: 3,
12-
gold: 4
12+
gold: 4,
13+
community: 5
1314
}
1415

1516
has_one :address

app/views/sponsors/index.html.haml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@
1111
If you are interested in becoming a host please do get in touch with us at #{mail_to "[email protected]", "[email protected]"}
1212
='.'
1313

14-
15-
- ['gold', 'silver', 'bronze', 'standard'].each do |level|
14+
- ['gold', 'silver', 'bronze', 'community', 'standard'].each do |level|
1615
- if @sponsor_levels[level]
1716
.stripe.reverse
1817
.row
1918
.large-12.columns
2019
%h3.sponsor-header-margin.text-center
21-
#{level == 'standard' ? 'And thanks to our other ' : level.humanize} sponsors
20+
= sponsorship_level_title(level)
2221
- @sponsor_levels[level].in_groups_of(6) do |grouped_sponsors|
2322
.row.sponsor-row
2423
- grouped_sponsors.compact.each do |sponsor|

config/locales/en.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ en:
287287
contact: "contact us"
288288
email_subject: "Regarding code of conduct"
289289
sponsors:
290+
standard_title: And thanks to our other sponsors
291+
community_partner_title: Community partners
290292
sponsoring: "Sponsoring"
291293
members:
292294
sign_up: "Sign up"

db/migrate/20180307221521_add_level_to_sponsors.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ def up
55
# bronze: 2,
66
# silver: 3,
77
# gold: 4,
8+
# community: 5,
89
add_column :sponsors, :level, :integer, null: false, default: 1, index: true
910
end
1011

spec/features/admin/event_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
expect(page).to have_content('Event successfully created')
3333

3434
expect(page).to have_content('A test event')
35-
expect(page).to have_content("#{I18n.l(date, format: :humanised)} | 16:00 - 18:00 GMT (GMT+00:00)")
35+
expect(page).to have_content(humanize_date(date))
3636
expect(page).to have_content('A test event description')
3737
expect(page).to have_content('25 student spots, 19 coach spots')
3838
expect(find('#schedule', visible: false).text).to eq('9:00 Sign up & breakfast 9:30 kick off')

spec/helpers/application_helper_spec.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,21 @@
4949
expect(helper.dot_markdown(text)).to include(expected)
5050
end
5151
end
52+
53+
describe '#sponsorship_level_title' do
54+
it 'returns title for sponsorship level sections on /sponsors page' do
55+
title = helper.sponsorship_level_title('gold')
56+
expect(title).to eq('Gold sponsors')
57+
end
58+
59+
it 'returns custom title for standard level' do
60+
title = helper.sponsorship_level_title('standard')
61+
expect(title).to eq('And thanks to our other sponsors')
62+
end
63+
64+
it 'returns custom title for community level' do
65+
title = helper.sponsorship_level_title('community')
66+
expect(title).to eq('Community partners')
67+
end
68+
end
5269
end

spec/models/sponsor_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
it 'defines enum level' do
6161
is_expected.to define_enum_for(:level)
62-
.with_values(%i[hidden standard bronze silver gold])
62+
.with_values(%i[hidden standard bronze silver gold community])
6363
end
6464
end
6565
end

0 commit comments

Comments
 (0)