Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add current Sponsor logo to the sponsor edit page #1956

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/views/admin/sponsors/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
- if current_user.has_role?(:admin)
= f.input :level, collection: Sponsor.levels.keys, label_method: :humanize
= f.input :avatar, as: :file, required: [email protected]?
- if @sponsor.avatar?
= image_tag(@sponsor.avatar.url, alt: "#{@sponsor.name} logo", class: 'small-image mw-100 mb-4', 'data-test': 'sponsor-logo')
= f.hidden_field :image_cache

#contacts.card.bg-light.border-info.mb-4.mb-md-0
Expand Down
1 change: 0 additions & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,6 @@ en:
remote: Only check if the role is fully remote only
salary: Annual pay before tax, without commas or decimal points
sponsor:
avatar: The avatar is displayed in sponsors and on the event pages.
accessibility_info: Is the office on the second floor? Is there a lift? How can someone with a handicap get there.
contacts:
mailing_list_consent: Adds contact to sponsors mailing list and triggers email enabling contact to self opt-out.
Expand Down
12 changes: 12 additions & 0 deletions spec/features/admin/manage_sponsor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@
sponsor = Fabricate(:sponsor)

visit edit_admin_sponsor_path(sponsor)
puts page.body

expect(page.find('.small-image')['alt']).to match("#{sponsor.name} logo")

fill_in 'Accessibility information', with: 'This venue is fully accessible to wheelchair users.'
fill_in 'Description', with: 'This sponsor has great WiFi.'
Expand All @@ -75,6 +78,15 @@
expect(page).to have_content 'Office is located on the third floor.'
end
end
context 'with existing avatar' do
it 'shows the current avatar on the edit page' do
sponsor = Fabricate(:sponsor)

visit edit_admin_sponsor_path(sponsor)

expect(page.find('*[data-test=sponsor-logo]')['alt']).to match("#{sponsor.name} logo")
end
end
end

describe 'adding contact information to a sponsor' do
Expand Down
Loading