Changed splash layout

Changed view spec to render with content_for
This commit is contained in:
Gopesh Tulsyan 2014-06-20 18:28:42 +05:30
parent 8ebf9de76c
commit 23ad35caea
3 changed files with 57 additions and 53 deletions

View file

@ -1,42 +1,42 @@
= content_for :brand do
= link_to @conference.title, conference_url(@conference.short_title), class: 'navbar-brand'
= content_for :splash do
- unless @conference.description.blank?
%p= @conference.description
- unless @conference.description.blank?
%p= @conference.description
- if @conference.include_program_in_splash?
%section{ id: 'program' }
.pad
= render 'program'
- if @conference.include_program_in_splash?
%section{ id: 'program' }
- if @conference.include_registrations_in_splash?
%section{ id: 'registration' }
.pad
= render 'program'
- if @conference.include_registrations_in_splash?
%section{ id: 'registration' }
.pad
= render 'registration'
= render 'registration'
-unless @conference.call_for_papers.blank?
- if @conference.call_for_papers.include_cfp_in_splash?
%section{ id:'callforpapers' }
-unless @conference.call_for_papers.blank?
- if @conference.call_for_papers.include_cfp_in_splash?
%section{ id:'callforpapers' }
.pad
= render 'call_for_papers'
-unless @conference.venue.blank?
- if @conference.venue.include_venue_in_splash?
%section{ id: 'location' }
.pad
= render 'location'
- unless @conference.venue.lodgings.empty?
- if @conference.venue.include_lodgings_in_splash?
= render 'lodging'
- if @conference.include_sponsors_in_splash?
%section{ id: 'sponsors' }
.pad
= render 'call_for_papers'
= render 'sponsor'
-unless @conference.venue.blank?
- if @conference.venue.include_venue_in_splash?
%section{ id: 'location' }
- if @conference.include_social_media_in_splash?
%section{ id: 'social-media' }
.pad
= render 'location'
- unless @conference.venue.lodgings.empty?
- if @conference.venue.include_lodgings_in_splash?
= render 'lodging'
- if @conference.include_sponsors_in_splash?
%section{ id: 'sponsors' }
.pad
= render 'sponsor'
- if @conference.include_social_media_in_splash?
%section{ id: 'social-media' }
.pad
= render 'social_media'
= render 'social_media'

View file

@ -25,8 +25,12 @@
.row
.col-md-12
= render 'layouts/messages'
.container#content
= yield
- if content_for :splash
#content
= yield :splash
-else
.container#content
= yield
#footer
.container

View file

@ -31,49 +31,49 @@ describe 'conference/show.html.haml' do
end
it 'renders program partial' do
expect(render).to include("#{@conference.description}")
expect(view.content_for(:splash)).to include("#{@conference.description}")
expect(view).to render_template(partial: 'conference/_program')
end
it 'renders registration partial' do
expect(rendered).to include("#{@conference.registration_description}")
expect(view.content_for(:splash)).to include("#{@conference.registration_description}")
expect(view).to render_template(partial: 'conference/_registration')
end
it 'renders call_for_papers partial' do
expect(render).to include("#{@conference.call_for_papers.description}")
expect(view.content_for(:splash)).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')
expect(view.content_for(:splash)).to include('Lorem Ipsum Dolor')
expect(view.content_for(:splash)).to include('example@example.com')
expect(view.content_for(:splash)).to include('Platin')
expect(view.content_for(:splash)).to include('Example sponsor')
expect(view.content_for(:splash)).to include('http://www.example.com')
expect(view.content_for(:splash)).to include('Lorem Ipsum Dolor')
expect(view.content_for(:splash)).to include('rails.jpg')
end
it 'renders social media partial' do
expect(view).to render_template('conference/_social_media')
expect(rendered).to include('http://www.fbexample.com')
expect(rendered).to include('http://www.google-example.com')
expect(rendered).to include('http://youtu.be/rtyutut')
expect(view.content_for(:splash)).to include('http://www.fbexample.com')
expect(view.content_for(:splash)).to include('http://www.google-example.com')
expect(view.content_for(:splash)).to include('http://youtu.be/rtyutut')
end
it 'renders location partial' do
expect(view).to render_template(partial: 'conference/_location')
expect(rendered).to include('Suse Office')
expect(rendered).to include('Maxfeldstrasse 5 \n90409 Nuremberg')
expect(rendered).to include('www.opensuse.org')
expect(rendered).to include('Lorem Ipsum Dolor')
expect(view.content_for(:splash)).to include('Suse Office')
expect(view.content_for(:splash)).to include('Maxfeldstrasse 5 \n90409 Nuremberg')
expect(view.content_for(:splash)).to include('www.opensuse.org')
expect(view.content_for(:splash)).to include('Lorem Ipsum Dolor')
end
it 'renders lodging partial' do
expect(view).to render_template(partial: 'conference/_lodging')
expect(rendered).to include('Example Hotel')
expect(rendered).to include('Lorem Ipsum Dolor')
expect(rendered).to include('http://www.example.com')
expect(view.content_for(:splash)).to include('Example Hotel')
expect(view.content_for(:splash)).to include('Lorem Ipsum Dolor')
expect(view.content_for(:splash)).to include('http://www.example.com')
end
end