From 23ad35caea30b1bbadb2043cf169de05ee60be94 Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Fri, 20 Jun 2014 18:28:42 +0530 Subject: [PATCH] Changed splash layout Changed view spec to render with content_for --- app/views/conference/show.html.haml | 62 ++++++++++---------- app/views/layouts/application.html.haml | 8 ++- spec/views/conference/show.html.haml_spec.rb | 40 ++++++------- 3 files changed, 57 insertions(+), 53 deletions(-) diff --git a/app/views/conference/show.html.haml b/app/views/conference/show.html.haml index a40b4f72..5f865265 100644 --- a/app/views/conference/show.html.haml +++ b/app/views/conference/show.html.haml @@ -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' diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 0a9063d1..fbda701f 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -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 diff --git a/spec/views/conference/show.html.haml_spec.rb b/spec/views/conference/show.html.haml_spec.rb index 77f4f58f..2c77b3c7 100644 --- a/spec/views/conference/show.html.haml_spec.rb +++ b/spec/views/conference/show.html.haml_spec.rb @@ -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