Remove sponsorship level from view and test

This commit is contained in:
Aditya Prakash 2016-04-21 21:22:14 +05:30
parent 8da80f28e2
commit d662ebd252
3 changed files with 52 additions and 6 deletions

View file

@ -63,6 +63,15 @@ We recommend to run OSEM in production with [mod_passenger](https://www.phusionp
and the [apache web-server](https://www.apache.org/). There are tons of guides on how to deploy rails apps on various
base operating systems. Check Google ;-)
#### ImageMagick
We use imagemagic for image manipulation of sponsor logo. You can get it from [direct install](http://software.opensuse.org/package/ImageMagick) page of the package or else check out [Download page](http://www.imagemagick.org/script/binary-releases.php) of ImageMagick.
If you are upgrading your osem instance and would like to resize the exisiting logos, you would need to `reprocess!` the images:
```
$ rails c
> Sponsor.find_each { |s| s.logo.reprocess! }
```
#### Use openID
In order to use the OpenID feature you need to register your application with the providers
(Google and Facebook) and enter their API keys in config/secrets.yml file, changing the existing sample values.

View file

@ -4,16 +4,14 @@
.container
.row
.col-md-12
.col-md-12.text-center
%h2 Sponsors
- @conference.sponsorship_levels.each do |sponsorship_level|
-if sponsorship_level.sponsors.any?
%h4
= sponsorship_level.title
- sponsorship_level.sponsors.each_slice(3) do |slice|
.row
.row.row-centered
- slice.each do |sponsor|
.col-md-4.col-sm-4.col-top
.col-md-4.col-sm-4.col-centered.col-top
%a{ href: '#', data: { toggle: 'modal', target: "#modal_#{sponsor.id}" } }
= image_tag get_logo(sponsor), class: "img-responsive img-sponsor img-sponsor-#{sponsorship_level.position}"
@ -41,4 +39,3 @@
Want to sponsor #{@conference.short_title}?
= link_to("mailto: #{@conference.contact.sponsor_email}?subject=#{@conference.short_title}%20Sponsorship") do
Please contact us!

View file

@ -0,0 +1,40 @@
require 'spec_helper'
describe SponsorsHelper, type: :helper do
let(:sponsor) { create(:sponsor) }
describe '#get_logo' do
context 'first sponsorship_level' do
before do
first_sponsorship_level = create(:sponsorship_level, position: 1)
sponsor.update_attributes(sponsorship_level: first_sponsorship_level)
end
it 'returns correct url' do
expect(get_logo(sponsor)).to match %r{.*(\bfirst/rails.jpg\b)}
end
end
context 'second sponsorship_level' do
before do
second_sponsorship_level = create(:sponsorship_level, position: 2)
sponsor.update_attributes(sponsorship_level: second_sponsorship_level)
end
it 'returns correct url' do
expect(get_logo(sponsor)).to match %r{.*(\bsecond/rails.jpg\b)}
end
end
context 'other sponsorship_level' do
before do
other_sponsorship_level = create(:sponsorship_level, position: 3)
sponsor.update_attributes(sponsorship_level: other_sponsorship_level)
end
it 'returns correct url' do
expect(get_logo(sponsor)).to match %r{.*(\bothers/rails.jpg\b)}
end
end
end
end