From 567d8689b80ce976b691a53a89e3a965b43a05b6 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Fri, 21 Nov 2014 13:22:20 +0100 Subject: [PATCH] Make sure an empty splash works --- app/models/contact.rb | 5 +++++ app/views/conference/_program.html.haml | 2 +- app/views/conference/show.html.haml | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index 829088b7..3eecfb43 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -10,4 +10,9 @@ class Contact < ActiveRecord::Base validates :facebook, :twitter, :googleplus, :instagram, format: URI::regexp(%w(http https)), allow_blank: true + + def has_social_media? + return true if !facebook.blank? || !twitter.blank? || !googleplus.blank? || !instagram.blank? + false + end end diff --git a/app/views/conference/_program.html.haml b/app/views/conference/_program.html.haml index 0e1a1f98..a07de85a 100644 --- a/app/views/conference/_program.html.haml +++ b/app/views/conference/_program.html.haml @@ -6,7 +6,7 @@ %p.lead.text-center = @conference.short_title has the most awesome program ever! - - if @conference.splashpage and @conference.splashpage.include_tracks + - if @conference.splashpage and @conference.tracks.any? and @conference.splashpage.include_tracks See rock-star speakers cover the topics of - if @conference.splashpage and @conference.splashpage.include_tracks - @conference.tracks.each_slice(3) do |slice| diff --git a/app/views/conference/show.html.haml b/app/views/conference/show.html.haml index ec8b72b9..35cfce79 100644 --- a/app/views/conference/show.html.haml +++ b/app/views/conference/show.html.haml @@ -53,7 +53,7 @@ %section#sponsors = render 'sponsors' - - if @conference.splashpage.include_social_media + - if @conference.splashpage.include_social_media and @conference.contact.has_social_media? %section#social-media = render 'social_media'