From 754d201b0141387ed56cdfe37be2fc7beb32cfec Mon Sep 17 00:00:00 2001 From: James Mason Date: Wed, 29 Nov 2017 15:29:06 -0800 Subject: [PATCH] FIXUP fragment caching issues --- app/controllers/conferences_controller.rb | 2 +- app/views/conferences/_booths.haml | 2 - app/views/conferences/_modal_description.haml | 41 ++++++++++--------- app/views/conferences/_program.haml | 4 ++ app/views/conferences/_sponsors.haml | 6 ++- app/views/conferences/_venue.haml | 10 ++--- app/views/layouts/application.html.haml | 2 +- 7 files changed, 36 insertions(+), 31 deletions(-) diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index e5626aa1..9bd0a4df 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -12,7 +12,6 @@ class ConferencesController < ApplicationController @conference = Conference.unscoped.eager_load( :organization, :splashpage, - :venue, :registration_period, :tickets, :confirmed_tracks, @@ -26,6 +25,7 @@ class ConferencesController < ApplicationController :sponsors, :call_for_sponsors, :contact, + venue: [:commercial], highlighted_events: [:speakers], sponsorship_levels: [:sponsors] ).order( diff --git a/app/views/conferences/_booths.haml b/app/views/conferences/_booths.haml index 87c6cac5..a6b09251 100644 --- a/app/views/conferences/_booths.haml +++ b/app/views/conferences/_booths.haml @@ -13,5 +13,3 @@ - else .caption %h3.text-center= booth.title - - content_for :modals do - = render 'modal_description', object: booth diff --git a/app/views/conferences/_modal_description.haml b/app/views/conferences/_modal_description.haml index a8d1b1d2..eb6f2b69 100644 --- a/app/views/conferences/_modal_description.haml +++ b/app/views/conferences/_modal_description.haml @@ -1,21 +1,22 @@ - content_for :modals do - .modal.fade{ id: "modal-#{object.class.name.downcase}-#{object.id}" } - .modal-dialog - .modal-content - .modal-header - %button.close{ data: { dismiss: 'modal' } } - %i.fa.fa-close - %h3.modal-title - = object.try(:title) || object.try(:name) - .modal-body - %p.logo - = link_to object.website_url || '#', target: '_blank' do - - img_classes = ['img-responsive center-block'] - - if object.is_a? Sponsor - - img_classes << ['img-sponsor', - "img-sponsor-#{object.sponsorship_level.position}"] - = image_tag get_logo(object), class: img_classes - %p.description - = object.description - .modal-footer - = link_to nil, object.website_url, target: '_blank' + - cache [object, '#modal'] do + .modal.fade{ id: "modal-#{object.class.name.downcase}-#{object.id}" } + .modal-dialog + .modal-content + .modal-header + %button.close{ data: { dismiss: 'modal' } } + %i.fa.fa-close + %h3.modal-title + = object.try(:title) || object.try(:name) + .modal-body + %p.logo + = link_to object.website_url || '#', target: '_blank' do + - img_classes = ['img-responsive center-block'] + - if object.is_a? Sponsor + - img_classes << ['img-sponsor', + "img-sponsor-#{object.sponsorship_level.position}"] + = image_tag get_logo(object), class: img_classes + %p.description + = object.description + .modal-footer + = link_to nil, object.website_url, target: '_blank' diff --git a/app/views/conferences/_program.haml b/app/views/conferences/_program.haml index 67e058c7..eba300a1 100644 --- a/app/views/conferences/_program.haml +++ b/app/views/conferences/_program.haml @@ -31,3 +31,7 @@ = link_to(conference_schedule_path(conference.short_title), class: 'btn btn-success btn-lg') do Full Schedule + +- conference.confirmed_booths.each do |booth| + - content_for :modals do + = render 'modal_description', object: booth diff --git a/app/views/conferences/_sponsors.haml b/app/views/conferences/_sponsors.haml index 95856d72..e6cda589 100644 --- a/app/views/conferences/_sponsors.haml +++ b/app/views/conferences/_sponsors.haml @@ -21,8 +21,6 @@ class: ['img-responsive', 'img-sponsor', "img-sponsor-#{sponsorship_level.position}"], title: sponsor.name - - content_for :modals do - = render 'modal_description', object: sponsor - if conference.call_for_sponsors.try(:open?) .row @@ -31,3 +29,7 @@ Want to sponsor? = link_to(sponsorship_mailto(conference)) do Contact us! + +- conference.sponsors.each do |sponsor| + - content_for :modals do + = render 'modal_description', object: sponsor diff --git a/app/views/conferences/_venue.haml b/app/views/conferences/_venue.haml index c88695ac..2225341b 100644 --- a/app/views/conferences/_venue.haml +++ b/app/views/conferences/_venue.haml @@ -2,11 +2,11 @@ %li %a.smoothscroll{ href: '#venue' } Venue -- cache [conference.venue, conference.venue.commercial, '#splash#venue'] do - %section#venue - - if conference.venue.location? - = render '/conferences/venue_map', conference: conference - - else +%section#venue + - if conference.venue.location? + = render '/conferences/venue_map', conference: conference + - else + - cache [conference.venue, conference.venue.commercial, '#splash#venue'] do .container .row .col-md-6 diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index ee88a24c..aa155bcb 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -43,5 +43,5 @@ You can run, copy, distribute, study, change and improve it. The source code and the developers are on =link_to "github.", "https://github.com/openSUSE/osem" - = content_for(:script_body) + = yield :script_body = piwik_tracking_tag