diff --git a/app/views/conference/_sponsor.html.haml b/app/views/conference/_sponsor.html.haml
new file mode 100644
index 00000000..2e957dd4
--- /dev/null
+++ b/app/views/conference/_sponsor.html.haml
@@ -0,0 +1,23 @@
+= content_for :splash_nav do
+ %li
+ %a{ href: '#sponsors' } Sponsors
+%div.container#sponsors.text-center
+ %div.row
+ %div.col-md-12
+ %h2 Sponsors
+ -if !@conference.sponsor_description.blank?
+ %p #{ @conference.sponsor_description }
+ -if !@conference.sponsor_email.blank?
+ %h3= mail_to "#{ @conference.sponsor_email }", 'Become a Sponsor'
+ - if !@conference.sponsorship_levels.blank?
+ - @conference.sponsorship_levels.each do |l|
+ - if !l.sponsors.blank?
+ %div.row
+ %h4 #{l.title}
+ - l.sponsors.each_with_index do |r,index|
+ %div.col-md-4
+ - if !r.logo.blank?
+ = link_to image_tag(r.logo(:large), class: 'img-responsive', alt: "#{r.name} Logo", title: "#{r.description}"), "http://#{r.website_url}"
+ - unless index == 0
+ - if index%2 == 0
+ %div.clearfix.visible-md.visible-lg
diff --git a/app/views/conference/show.html.haml b/app/views/conference/show.html.haml
index 29ec9699..d0ae1e61 100644
--- a/app/views/conference/show.html.haml
+++ b/app/views/conference/show.html.haml
@@ -7,4 +7,6 @@
-unless @conference.call_for_papers.blank?
%div#callforpapers
= render 'call_for_papers'
+%div#sponsors
+ = render 'sponsor'
diff --git a/spec/factories/sponsors.rb b/spec/factories/sponsors.rb
index 88d1ad90..961cb77f 100644
--- a/spec/factories/sponsors.rb
+++ b/spec/factories/sponsors.rb
@@ -5,6 +5,10 @@ FactoryGirl.define do
name 'Example sponsor'
website_url 'http://www.example.com'
description 'Lorem Ipsum Dolor'
+ logo_file_name 'rails.jpg'
+ logo_file_size 2000
+ logo_content_type 'image/jpeg'
+ logo_updated_at DateTime.current
sponsorship_level
conference
end
diff --git a/spec/views/conference/show.html.haml_spec.rb b/spec/views/conference/show.html.haml_spec.rb
index 8e32e586..95940230 100644
--- a/spec/views/conference/show.html.haml_spec.rb
+++ b/spec/views/conference/show.html.haml_spec.rb
@@ -4,8 +4,14 @@ describe 'conference/show.html.haml' do
@conference = create(:conference, registration_description: 'Lorem Ipsum Dolor',
registration_start_date: Date.today,
registration_end_date: Date.tomorrow,
- description: 'Lorem Ipsum')
+ description: 'Lorem Ipsum',
+ sponsor_description: 'Lorem Ipsum Dolor',
+ sponsor_email: 'example@example.com')
@conference.call_for_papers = create(:call_for_papers, conference: @conference)
+ @conference.sponsorship_levels << create(:sponsorship_level, conference: @conference)
+ @sponsorship_level = @conference.sponsorship_levels.first
+ @sponsorship_level.sponsors << create(:sponsor, sponsorship_level: @sponsorship_level,
+ conference: @conference)
assign :conference, @conference
render
end
@@ -23,4 +29,15 @@ describe 'conference/show.html.haml' do
it 'renders call_for_papers partial' do
expect(render).to include("#{@conference.call_for_papers.description}")
end
+
+ it 'renders sponsors partial' do
+ expect(view).to render_template(partial: 'conference/_sponsor')
+ expect(rendered).to include('Lorem Ipsum Dolor')
+ expect(rendered).to include('example@example.com')
+ expect(rendered).to include('Platin')
+ expect(rendered).to include('Example sponsor')
+ expect(rendered).to include('http://www.example.com')
+ expect(rendered).to include('Lorem Ipsum Dolor')
+ expect(rendered).to include('rails.jpg')
+ end
end