From 4c1b693fcbe2945772dac36bbdd09883eec06f51 Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Tue, 3 Jun 2014 14:07:28 +0530 Subject: [PATCH 1/4] Added yield to application layout for conditional rendering of splash --- app/views/conference/show.html.haml | 13 +++++++------ app/views/layouts/application.html.haml | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/views/conference/show.html.haml b/app/views/conference/show.html.haml index cbadd6d3..51803b60 100644 --- a/app/views/conference/show.html.haml +++ b/app/views/conference/show.html.haml @@ -1,9 +1,10 @@ = content_for :brand do = link_to @conference.title, conference_url(@conference.short_title), class: 'navbar-brand' -%div#program - = render 'program' -%div#registration - = render 'registration' -%div#callforpapers - = render 'call_for_papers' += content_for :splash do + %div#program + = render 'program' + %div#registration + = render 'registration' + %div#callforpapers + = render 'call_for_papers' diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 0a9063d1..96e6ea2e 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -21,6 +21,7 @@ - if controller.class.name.split("::").first=="Admin" = render 'layouts/admin' -else + = yield :splash .container#messages .row .col-md-12 From 008c68807313d3620579fa2daf1d7a271de64ca6 Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Tue, 3 Jun 2014 14:34:04 +0530 Subject: [PATCH 2/4] view specs changed --- spec/views/conference/show.html.haml_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/views/conference/show.html.haml_spec.rb b/spec/views/conference/show.html.haml_spec.rb index 8e32e586..b356f9d4 100644 --- a/spec/views/conference/show.html.haml_spec.rb +++ b/spec/views/conference/show.html.haml_spec.rb @@ -11,16 +11,16 @@ describe 'conference/show.html.haml' do end it 'renders program partial' do - expect(render).to include("#{@conference.description}") - expect(view).to render_template(partial: 'conference/_program') + expect(view.content_for(:splash)).to include("#{@conference.description}") + expect(view.content_for(:splash)).to render_template(partial: 'conference/_program') end it 'renders registration partial' do - expect(rendered).to include("#{@conference.registration_description}") - expect(view).to render_template(partial: 'conference/_registration') + expect(view.content_for(:splash)).to include("#{@conference.registration_description}") + expect(view.content_for(:splash)).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 end From 1bc353d285110f3b7cd552baf150508a2c12d6d3 Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Tue, 3 Jun 2014 14:36:25 +0530 Subject: [PATCH 3/4] Changed splash rendering in layouts --- app/views/layouts/application.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 96e6ea2e..4315dbce 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -21,11 +21,11 @@ - if controller.class.name.split("::").first=="Admin" = render 'layouts/admin' -else - = yield :splash .container#messages .row .col-md-12 = render 'layouts/messages' + = yield :splash .container#content = yield From 7abfbc7587a1c37729e8c88614c789c72830a918 Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Tue, 3 Jun 2014 17:58:43 +0530 Subject: [PATCH 4/4] Modified rendering of splash in application layout --- app/views/layouts/application.html.haml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 4315dbce..f4d675fe 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -21,13 +21,18 @@ - if controller.class.name.split("::").first=="Admin" = render 'layouts/admin' -else - .container#messages - .row - .col-md-12 + - if content_for :splash + %div#splash + #messages = render 'layouts/messages' - = yield :splash - .container#content - = yield + = yield :splash + -else + .container#messages + .row + .col-md-12 + = render 'layouts/messages' + .container#content + = yield #footer .container