Skip to content

Commit

Permalink
Merge pull request #1956 from codebar/add-current-logo-to-sponsor-edi…
Browse files Browse the repository at this point in the history
…t-page

Add current Sponsor logo to the sponsor edit page
  • Loading branch information
matyikriszta authored Oct 24, 2023
2 parents 4b03b8a + fbeeab7 commit 57a3fc1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
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: !@sponsor.avatar?
- 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

0 comments on commit 57a3fc1

Please sign in to comment.